@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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [TBD]
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,7 @@ interface ContentSummaryProps {
7
7
  interface Clickable {
8
8
  clickable?: boolean;
9
9
  }
10
- export declare const BodyTextRelative: import("styled-components").StyledComponent<({ children, size, color, className, bold, ...props }: import("../../../types/typography").IGenericTypographyProps<HTMLParagraphElement>) => import("react").JSX.Element, any, {}, never>;
10
+ export declare const BodyTextRelative: import("styled-components").StyledComponent<({ children, size, color, className, ...props }: import("../../../types/typography").IGenericTypographyProps<HTMLParagraphElement>) => import("react").JSX.Element, any, {}, never>;
11
11
  export declare const ContentSummaryWrapper: import("styled-components").StyledComponent<"article", any, Clickable, never>;
12
12
  export declare const ContentSummaryImageWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
13
13
  export declare const ContentSummaryTextWrapper: import("styled-components").StyledComponent<"div", any, ContentSummaryProps, never>;
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { ISearchBarProps } from '../../../types/navigation';
3
- declare const SearchBar: ({ onClick, onClose, className, inputRef }: ISearchBarProps) => React.JSX.Element;
3
+ declare const SearchBar: ({ onClick, onClose, className, inputRef, trapFocus }: ISearchBarProps) => React.JSX.Element;
4
4
  export default SearchBar;
@@ -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
 
@@ -5765,8 +5787,12 @@ var InputContainer = /*#__PURE__*/styled__default.div(_templateObject5$a || (_te
5765
5787
  var TextLinkWrapper$1 = /*#__PURE__*/styled__default(TextLink)(_templateObject6$7 || (_templateObject6$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: var(--color-primary-red);\n"])));
5766
5788
  var SearchArrowContainer = /*#__PURE__*/styled__default.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"])));
5767
5789
 
5768
- function useFocusTrap(containerRef, onEscape) {
5790
+ function useFocusTrap(containerRef, onEscape, enabled) {
5791
+ if (enabled === void 0) {
5792
+ enabled = true;
5793
+ }
5769
5794
  React.useEffect(function () {
5795
+ if (!enabled) return undefined;
5770
5796
  var container = containerRef.current;
5771
5797
  if (!container) return undefined;
5772
5798
  var focusableSelectors = 'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])';
@@ -5799,7 +5825,9 @@ var SearchBar = function SearchBar(_ref) {
5799
5825
  var onClick = _ref.onClick,
5800
5826
  onClose = _ref.onClose,
5801
5827
  className = _ref.className,
5802
- inputRef = _ref.inputRef;
5828
+ inputRef = _ref.inputRef,
5829
+ _ref$trapFocus = _ref.trapFocus,
5830
+ trapFocus = _ref$trapFocus === void 0 ? true : _ref$trapFocus;
5803
5831
  var _useState = React.useState(false),
5804
5832
  showSearchLink = _useState[0],
5805
5833
  setShowSearchLink = _useState[1];
@@ -5809,7 +5837,7 @@ var SearchBar = function SearchBar(_ref) {
5809
5837
  var internalRef = React.useRef(null);
5810
5838
  var finalInputRef = inputRef != null ? inputRef : internalRef;
5811
5839
  var containerRef = React.useRef(null);
5812
- useFocusTrap(containerRef, onClose);
5840
+ useFocusTrap(containerRef, onClose, trapFocus);
5813
5841
  var onSearchHandler = function onSearchHandler(value) {
5814
5842
  onClick(value);
5815
5843
  setSearchValue('');
@@ -5889,7 +5917,7 @@ var SearchBar = function SearchBar(_ref) {
5889
5917
  onClick: onCloseHandler,
5890
5918
  onKeyDown: onKeyboardCloseHandler,
5891
5919
  "data-testid": "close-icon",
5892
- "aria-label": "Close search bar"
5920
+ "aria-label": "Clear the search bar"
5893
5921
  }, /*#__PURE__*/React__default.createElement(Icon, {
5894
5922
  iconName: "Close"
5895
5923
  })));
@@ -6933,7 +6961,7 @@ var core = /*#__PURE__*/_extends({}, common, {
6933
6961
  colors: /*#__PURE__*/_extends({}, commonColors, colors, {
6934
6962
  primary: colors.core,
6935
6963
  primaryButton: colors.core,
6936
- secondaryButton: commonColors.white,
6964
+ secondaryButton: colors.core,
6937
6965
  tertiaryButton: 'transparent',
6938
6966
  auxiliaryButton: 'transparent',
6939
6967
  primaryButtonReverseBg: colors.cinema,
@@ -6946,7 +6974,7 @@ var stream = /*#__PURE__*/_extends({}, common, {
6946
6974
  primaryButton: colors.stream,
6947
6975
  primaryButtonReverseBg: colors.cinema,
6948
6976
  primaryButtonReverse: commonColors.white,
6949
- secondaryButton: commonColors.white,
6977
+ secondaryButton: colors.stream,
6950
6978
  tertiaryButton: 'transparent',
6951
6979
  auxiliaryButton: 'transparent'
6952
6980
  })
@@ -6957,7 +6985,7 @@ var cinema = /*#__PURE__*/_extends({}, common, {
6957
6985
  primaryButton: commonColors.white,
6958
6986
  primaryButtonReverseBg: commonColors.white,
6959
6987
  primaryButtonReverse: colors.cinema,
6960
- secondaryButton: commonColors.white,
6988
+ secondaryButton: colors.cinema,
6961
6989
  tertiaryButton: 'transparent',
6962
6990
  auxiliaryButton: 'transparent'
6963
6991
  })
@@ -6968,7 +6996,7 @@ var schools = /*#__PURE__*/_extends({}, common, {
6968
6996
  primaryButton: colors.core,
6969
6997
  primaryButtonReverseBg: colors.cinema,
6970
6998
  primaryButtonReverse: commonColors.white,
6971
- secondaryButton: commonColors.white,
6999
+ secondaryButton: colors.core,
6972
7000
  tertiaryButton: 'transparent',
6973
7001
  auxiliaryButton: 'transparent'
6974
7002
  }),
@@ -7056,17 +7084,23 @@ var TextOnly = function TextOnly(_ref) {
7056
7084
  })(exports.ButtonType || (exports.ButtonType = {}));
7057
7085
 
7058
7086
  var _templateObject$J, _templateObject2$x, _templateObject3$n, _templateObject4$i, _templateObject5$d, _templateObject6$b, _templateObject7$7, _templateObject8$4;
7059
- 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);
7087
+ 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);
7060
7088
  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"])));
7061
7089
  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) {
7062
7090
  var theme = _ref.theme;
7063
7091
  return theme.colors.primary;
7064
7092
  }, exports.Colors.White);
7065
- var ButtonContainer = /*#__PURE__*/styled__default.div(_templateObject4$i || (_templateObject4$i = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 2em;\n width: fit-content;\n"])));
7093
+ 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) {
7094
+ var stackCtasEarly = _ref2.stackCtasEarly;
7095
+ return stackCtasEarly ? devices.smallDesktop + ", " + devices.mobileAndTablet : devices.mobile;
7096
+ }, function (_ref3) {
7097
+ var stackCtasEarly = _ref3.stackCtasEarly;
7098
+ return stackCtasEarly && "\n @media " + devices.smallDesktop + ", " + devices.mobileAndTablet + " {\n * {\n width: 100%;\n }\n }\n ";
7099
+ });
7066
7100
  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"])));
7067
7101
  var OfferTextWrapper = /*#__PURE__*/styled__default.div(_templateObject6$b || (_templateObject6$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n & > * {\n margin-bottom: 0.5em;\n }\n margin-bottom: 1em;\n"])));
7068
7102
  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"])));
7069
- 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"])));
7103
+ 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"])));
7070
7104
 
7071
7105
  // Set max. character length
7072
7106
  var setMaxCharLength = function setMaxCharLength(value, maxLength) {
@@ -7109,8 +7143,13 @@ var UpsellCard = function UpsellCard(_ref) {
7109
7143
  flag = _ref.flag,
7110
7144
  offerTexts = _ref.offerTexts,
7111
7145
  link = _ref.link,
7146
+ secondaryLink = _ref.secondaryLink,
7147
+ _ref$stackCtasEarly = _ref.stackCtasEarly,
7148
+ stackCtasEarly = _ref$stackCtasEarly === void 0 ? false : _ref$stackCtasEarly,
7112
7149
  _ref$theme = _ref.theme,
7113
- theme = _ref$theme === void 0 ? exports.ThemeType.Core : _ref$theme;
7150
+ theme = _ref$theme === void 0 ? exports.ThemeType.Core : _ref$theme,
7151
+ _ref$secondaryTheme = _ref.secondaryTheme,
7152
+ secondaryTheme = _ref$secondaryTheme === void 0 ? exports.ThemeType.Core : _ref$secondaryTheme;
7114
7153
  var truncate = function truncate(str, n) {
7115
7154
  return str.length >= n ? str.slice(0, n) : str;
7116
7155
  };
@@ -7129,13 +7168,17 @@ var UpsellCard = function UpsellCard(_ref) {
7129
7168
  level: 4
7130
7169
  }, formatPrice(promoPrice)))) : (/*#__PURE__*/React__default.createElement(PriceRow, null, /*#__PURE__*/React__default.createElement(AltHeader, {
7131
7170
  level: 4
7132
- }, formatPrice(price))))), (reducedOfferTexts == null ? void 0 : reducedOfferTexts.length) && reducedOfferTexts.map(function (offerText) {
7171
+ }, formatPrice(price))))), (reducedOfferTexts == null ? void 0 : reducedOfferTexts.length) && reducedOfferTexts.map(function (offerText, index) {
7133
7172
  return /*#__PURE__*/React__default.createElement(OfferText, {
7134
- key: offerText.title,
7173
+ key: "offer-" + index,
7135
7174
  title: offerText.title,
7136
7175
  description: offerText.description
7137
7176
  });
7138
- }), link && (/*#__PURE__*/React__default.createElement(ButtonContainer, null, /*#__PURE__*/React__default.createElement(PrimaryButton, Object.assign({}, link), truncate(link.text, LENGTH_SMALL_TEXT))))));
7177
+ }), ((link == null ? void 0 : link.text) || (secondaryLink == null ? void 0 : secondaryLink.text)) && (/*#__PURE__*/React__default.createElement(ButtonContainer, {
7178
+ stackCtasEarly: stackCtasEarly
7179
+ }, (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, {
7180
+ theme: secondaryTheme
7181
+ }, /*#__PURE__*/React__default.createElement(SecondaryButton, Object.assign({}, secondaryLink), truncate(secondaryLink.text, LENGTH_SMALL_TEXT))))))));
7139
7182
  };
7140
7183
 
7141
7184
  var _templateObject$K;
@@ -7145,7 +7188,7 @@ var UpsellCards = function UpsellCards(_ref) {
7145
7188
  var upsellCards = _ref.upsellCards;
7146
7189
  return /*#__PURE__*/React__default.createElement(Wrapper$3, null, upsellCards == null ? void 0 : upsellCards.map(function (card, index) {
7147
7190
  return /*#__PURE__*/React__default.createElement(UpsellCard, {
7148
- key: "upsell-card-" + index,
7191
+ key: "card-" + index,
7149
7192
  title: card.title,
7150
7193
  subTitle: card.subTitle,
7151
7194
  price: card.price,
@@ -7153,7 +7196,10 @@ var UpsellCards = function UpsellCards(_ref) {
7153
7196
  flag: card.flag,
7154
7197
  offerTexts: card.offerTexts,
7155
7198
  link: card.link,
7156
- theme: card.theme
7199
+ secondaryLink: card.secondaryLink,
7200
+ stackCtasEarly: true,
7201
+ theme: card.theme,
7202
+ secondaryTheme: card.secondaryTheme
7157
7203
  });
7158
7204
  }));
7159
7205
  };
@@ -7167,7 +7213,8 @@ var UpsellSection = function UpsellSection(_ref) {
7167
7213
  theme = _ref$theme === void 0 ? exports.ThemeType.Core : _ref$theme;
7168
7214
  var themedUpsellCards = upsellCards ? [].concat(upsellCards).map(function (card) {
7169
7215
  return _extends({}, card, {
7170
- theme: card.theme || theme
7216
+ theme: card.theme || theme,
7217
+ secondaryTheme: card.secondaryTheme || theme
7171
7218
  });
7172
7219
  }) : [];
7173
7220
  return /*#__PURE__*/React__default.createElement(Theme, {
@@ -8683,14 +8730,16 @@ var ContentSummary = function ContentSummary(_ref) {
8683
8730
  "data-roh": "content-summary-item"
8684
8731
  }, showImage && image && (/*#__PURE__*/React__default.createElement(ContentSummaryImageWrapper, {
8685
8732
  "data-testid": "image-wrapper"
8686
- }, /*#__PURE__*/React__default.createElement(ImageAspectRatioWrapper, {
8687
- aspectRatio: exports.AspectRatio['4:3']
8688
8733
  }, link != null && link.href ? (/*#__PURE__*/React__default.createElement("a", {
8689
8734
  href: link.href
8735
+ }, /*#__PURE__*/React__default.createElement(ImageAspectRatioWrapper, {
8736
+ aspectRatio: exports.AspectRatio['4:3']
8690
8737
  }, /*#__PURE__*/React__default.createElement("img", {
8691
8738
  src: image.src,
8692
8739
  alt: image.alt
8693
- }))) : (/*#__PURE__*/React__default.createElement("img", {
8740
+ })))) : (/*#__PURE__*/React__default.createElement(ImageAspectRatioWrapper, {
8741
+ aspectRatio: exports.AspectRatio['4:3']
8742
+ }, /*#__PURE__*/React__default.createElement("img", {
8694
8743
  src: image.src,
8695
8744
  alt: image.alt
8696
8745
  }))))), /*#__PURE__*/React__default.createElement(ContentSummaryTextWrapper, {