@wlloyalty/wll-react-sdk 1.0.88 → 1.0.90

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.
@@ -0,0 +1,6 @@
1
+ type CarouselNavButtonProps = {
2
+ direction: 'left' | 'right';
3
+ onPress: () => void;
4
+ };
5
+ export declare const CarouselNavButton: ({ direction, onPress, }: CarouselNavButtonProps) => JSX.Element;
6
+ export default CarouselNavButton;
@@ -0,0 +1,22 @@
1
+ export declare const useNavButtonStyles: () => {
2
+ navButton: {
3
+ position: "absolute";
4
+ top: "50%";
5
+ transform: {
6
+ translateY: number;
7
+ }[];
8
+ width: number;
9
+ height: number;
10
+ borderRadius: number;
11
+ backgroundColor: string;
12
+ justifyContent: "center";
13
+ alignItems: "center";
14
+ zIndex: number;
15
+ };
16
+ navButtonLeft: {
17
+ left: number;
18
+ };
19
+ navButtonRight: {
20
+ right: number;
21
+ };
22
+ };
@@ -1,4 +1,5 @@
1
1
  export { default as Carousel } from './Carousel';
2
+ export { default as CarouselNavButton } from './CarouselNavButton';
2
3
  export { default as Grid } from './Grid';
3
4
  export { default as ProgressIndicator } from './ProgressIndicator';
4
5
  export { default as SectionHeader } from './SectionHeader';
package/dist/web.js CHANGED
@@ -7877,11 +7877,9 @@ var useMakeRequest = function (config) {
7877
7877
  return [4 /*yield*/, fetch(url, createRequestOptions())];
7878
7878
  case 3:
7879
7879
  response = _a.sent();
7880
- console.log('response', response);
7881
7880
  return [4 /*yield*/, response.json()];
7882
7881
  case 4:
7883
7882
  json = _a.sent();
7884
- console.log('json', json);
7885
7883
  if (json.status === 'fail') {
7886
7884
  return [2 /*return*/, {
7887
7885
  status: 'fail',
@@ -20181,7 +20179,12 @@ var useContentTileStyles = function (hasArtwork) {
20181
20179
  paddingHorizontal: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet),
20182
20180
  flex: 1
20183
20181
  },
20184
- header: getHeaderStyle(hasArtwork)
20182
+ header: getHeaderStyle(hasArtwork),
20183
+ tileTitle: {
20184
+ maxWidth: '90%',
20185
+ flex: 1,
20186
+ marginRight: 8
20187
+ }
20185
20188
  });
20186
20189
  };
20187
20190
 
@@ -20236,14 +20239,23 @@ var ContentTileSummary = function () {
20236
20239
 
20237
20240
  var ContentTileTitle = function () {
20238
20241
  var tileContext = useTileContext();
20242
+ var styles = useContentTileStyles();
20239
20243
  if (!isContextValid(tileContext)) return null;
20240
- var title = tileContext.configuration.title;
20244
+ var _a = tileContext.configuration,
20245
+ title = _a.title,
20246
+ ctaLink = _a.ctaLink;
20241
20247
  if (!title) return null;
20248
+ var handleTitleWidth = function () {
20249
+ if (IS_MOBILE && ctaLink) {
20250
+ return styles.titleWithLink;
20251
+ }
20252
+ };
20242
20253
  return /*#__PURE__*/React.createElement(Text, {
20243
20254
  variant: "title",
20244
20255
  accessibilityRole: "header",
20245
20256
  accessibilityLabel: title,
20246
20257
  numberOfLines: 1,
20258
+ style: handleTitleWidth(),
20247
20259
  testID: "content-tile-title"
20248
20260
  }, title);
20249
20261
  };
@@ -20584,18 +20596,10 @@ var Carousel = function (_a) {
20584
20596
  }
20585
20597
  }, /*#__PURE__*/React.createElement(View$2, {
20586
20598
  style: styles.carouselContainer
20587
- }, showPrevButton && (/*#__PURE__*/React.createElement(Pressable$1, {
20588
- style: [styles.navButton, styles.navButtonLeft, {
20589
- backgroundColor: theme.background
20590
- }],
20591
- onPress: handlePrev,
20592
- accessibilityLabel: "Previous slide",
20593
- role: "button"
20594
- }, /*#__PURE__*/React.createElement(Icon, {
20595
- name: "ArrowLeft",
20596
- size: 20,
20597
- color: theme.primary
20598
- }))), /*#__PURE__*/React.createElement(ScrollView$2, {
20599
+ }, showPrevButton && (/*#__PURE__*/React.createElement(CarouselNavButton, {
20600
+ direction: "left",
20601
+ onPress: handlePrev
20602
+ })), /*#__PURE__*/React.createElement(ScrollView$2, {
20599
20603
  ref: scrollViewRef,
20600
20604
  horizontal: true,
20601
20605
  pagingEnabled: true,
@@ -20603,7 +20607,7 @@ var Carousel = function (_a) {
20603
20607
  onScroll: handleScroll,
20604
20608
  onMomentumScrollEnd: handleScrollEnd,
20605
20609
  scrollEventThrottle: 16,
20606
- style: [styles.carouselContent],
20610
+ style: styles.carouselContent,
20607
20611
  contentContainerStyle: {
20608
20612
  width: containerWidth * sortedTiles.length
20609
20613
  },
@@ -20619,18 +20623,10 @@ var Carousel = function (_a) {
20619
20623
  }, /*#__PURE__*/React.createElement(BannerTile$1, {
20620
20624
  tile: tile
20621
20625
  }));
20622
- })), showNextButton && (/*#__PURE__*/React.createElement(Pressable$1, {
20623
- style: [styles.navButton, styles.navButtonRight, {
20624
- backgroundColor: theme.background
20625
- }],
20626
- onPress: handleNext,
20627
- accessibilityLabel: "Next slide",
20628
- role: "button"
20629
- }, /*#__PURE__*/React.createElement(Icon, {
20630
- name: "ArrowRight",
20631
- size: 20,
20632
- color: theme.primary
20633
- })))), displayControls && (/*#__PURE__*/React.createElement(View$2, {
20626
+ })), showNextButton && (/*#__PURE__*/React.createElement(CarouselNavButton, {
20627
+ direction: "right",
20628
+ onPress: handleNext
20629
+ }))), displayControls && (/*#__PURE__*/React.createElement(View$2, {
20634
20630
  style: dynamicStyles.indicators
20635
20631
  }, sortedTiles.map(function (_, index) {
20636
20632
  var width = animatedIndex.interpolate({
@@ -20650,6 +20646,53 @@ var Carousel = function (_a) {
20650
20646
  })))));
20651
20647
  };
20652
20648
 
20649
+ var useNavButtonStyles = function () {
20650
+ var theme = useWllSdk().theme;
20651
+ var buttonSize = IS_MOBILE ? BUTTON_SIZE * 0.75 : BUTTON_SIZE;
20652
+ return StyleSheet$1.create({
20653
+ navButton: {
20654
+ position: 'absolute',
20655
+ top: '50%',
20656
+ transform: [{
20657
+ translateY: -buttonSize / 2
20658
+ }],
20659
+ width: buttonSize,
20660
+ height: buttonSize,
20661
+ borderRadius: buttonSize / 2,
20662
+ backgroundColor: theme.background,
20663
+ justifyContent: 'center',
20664
+ alignItems: 'center',
20665
+ zIndex: 1
20666
+ },
20667
+ navButtonLeft: {
20668
+ left: -buttonSize / 2
20669
+ },
20670
+ navButtonRight: {
20671
+ right: -buttonSize / 2
20672
+ }
20673
+ });
20674
+ };
20675
+
20676
+ var CarouselNavButton = function (_a) {
20677
+ var direction = _a.direction,
20678
+ onPress = _a.onPress;
20679
+ var theme = useWllSdk().theme;
20680
+ var isRight = direction === 'right';
20681
+ var styles = useNavButtonStyles();
20682
+ return /*#__PURE__*/React.createElement(Pressable$1, {
20683
+ style: [styles.navButton, isRight ? styles.navButtonRight : styles.navButtonLeft, {
20684
+ backgroundColor: theme.background
20685
+ }],
20686
+ onPress: onPress,
20687
+ accessibilityLabel: "".concat(isRight ? 'Next' : 'Previous', " slide"),
20688
+ role: "button"
20689
+ }, /*#__PURE__*/React.createElement(Icon, {
20690
+ name: isRight ? 'ArrowRight' : 'ArrowLeft',
20691
+ size: 20,
20692
+ color: theme.primary
20693
+ }));
20694
+ };
20695
+
20653
20696
  var Grid = function (_a) {
20654
20697
  var section = _a.section;
20655
20698
  if (section.type !== exports.SectionType.Grid) {
@@ -21704,6 +21747,11 @@ var useRewardTileStyles = function () {
21704
21747
  header: {
21705
21748
  width: '100%',
21706
21749
  marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet)
21750
+ },
21751
+ tileTitle: {
21752
+ maxWidth: '90%',
21753
+ flex: 1,
21754
+ marginRight: 8
21707
21755
  }
21708
21756
  });
21709
21757
  };
@@ -21813,9 +21861,15 @@ var RewardTileSummary = function () {
21813
21861
  */
21814
21862
  var RewardTileTitle = function () {
21815
21863
  var tileContext = useTileContext();
21864
+ var styles = useRewardTileStyles();
21816
21865
  if (!isContextValid(tileContext)) return null;
21817
21866
  var name = tileContext.configuration.name;
21818
21867
  if (!name) return null;
21868
+ var handleTitleWidth = function () {
21869
+ if (IS_MOBILE) {
21870
+ return styles.titleWithLink;
21871
+ }
21872
+ };
21819
21873
  return /*#__PURE__*/React.createElement(Text, {
21820
21874
  variant: "title",
21821
21875
  ellipsizeMode: "tail",
@@ -21823,10 +21877,7 @@ var RewardTileTitle = function () {
21823
21877
  accessibilityRole: "header",
21824
21878
  accessibilityLabel: "Reward title: ".concat(name),
21825
21879
  testID: "reward-tile-title",
21826
- style: {
21827
- flex: 1,
21828
- marginRight: 8
21829
- }
21880
+ style: handleTitleWidth()
21830
21881
  }, name);
21831
21882
  };
21832
21883
 
@@ -22122,6 +22173,7 @@ exports.BaseBanner = BaseBanner;
22122
22173
  exports.BaseTile = BaseTile;
22123
22174
  exports.Button = Button;
22124
22175
  exports.Carousel = Carousel;
22176
+ exports.CarouselNavButton = CarouselNavButton;
22125
22177
  exports.Column = Column;
22126
22178
  exports.ContentTile = ContentTile$1;
22127
22179
  exports.ContentTileConfig = ContentTileConfig;