@wlloyalty/wll-react-sdk 1.2.0 → 1.3.0
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/dist/native.js +72 -25
- package/dist/native.js.map +1 -1
- package/dist/types/components/organisms/ContentTile/ContentTile.stories.d.ts +27 -0
- package/dist/types/components/organisms/Group/Group.stories.d.ts +1 -0
- package/dist/types/constants/responsive.d.ts +2 -2
- package/dist/web.js +72 -28
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
package/dist/native.js
CHANGED
|
@@ -1917,8 +1917,8 @@ var DIMENSION_MODES = {
|
|
|
1917
1917
|
TABLET: 'tablet',
|
|
1918
1918
|
MOBILE: 'mobile',
|
|
1919
1919
|
};
|
|
1920
|
-
var TABLET_SCREEN_WIDTH =
|
|
1921
|
-
var SMALL_SCREEN_WIDTH =
|
|
1920
|
+
var TABLET_SCREEN_WIDTH = 768;
|
|
1921
|
+
var SMALL_SCREEN_WIDTH = 480;
|
|
1922
1922
|
|
|
1923
1923
|
var isWeb = reactNative.Platform.OS === 'web';
|
|
1924
1924
|
function getDimensionMode(window) {
|
|
@@ -2387,7 +2387,7 @@ var Text = function (_a) {
|
|
|
2387
2387
|
case 'eyebrow':
|
|
2388
2388
|
return __assign(__assign({}, baseStyle), { fontSize: useResponsiveValue(theme.sizes.md, theme.sizes.sm, isDesktop, isTablet), marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet) });
|
|
2389
2389
|
case 'title':
|
|
2390
|
-
return __assign(__assign({}, baseStyle), { fontSize: useResponsiveValue(theme.sizes.
|
|
2390
|
+
return __assign(__assign({}, baseStyle), { fontSize: useResponsiveValue(theme.sizes.xl, theme.sizes.md, isDesktop, isTablet), fontWeight: 'bold' });
|
|
2391
2391
|
case 'body':
|
|
2392
2392
|
return {
|
|
2393
2393
|
color: theme.derivedSurfaceText[20],
|
|
@@ -2398,7 +2398,7 @@ var Text = function (_a) {
|
|
|
2398
2398
|
case 'description':
|
|
2399
2399
|
case 'label':
|
|
2400
2400
|
default:
|
|
2401
|
-
return __assign(__assign({}, baseStyle), { fontSize: useResponsiveValue(theme.sizes.sm, theme.sizes.
|
|
2401
|
+
return __assign(__assign({}, baseStyle), { fontSize: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet) });
|
|
2402
2402
|
}
|
|
2403
2403
|
};
|
|
2404
2404
|
var variantStyle = getVariantStyle(variant);
|
|
@@ -3323,6 +3323,7 @@ var BadgeTileDateEarned = function () {
|
|
|
3323
3323
|
*/
|
|
3324
3324
|
var BadgeTileDescription = function () {
|
|
3325
3325
|
var tileContext = useTileContext();
|
|
3326
|
+
var width = reactNative.useWindowDimensions().width;
|
|
3326
3327
|
if (!isContextValid(tileContext))
|
|
3327
3328
|
return null;
|
|
3328
3329
|
var _a = tileContext.configuration, count = _a.count, description = _a.description, type = _a.type;
|
|
@@ -3332,7 +3333,19 @@ var BadgeTileDescription = function () {
|
|
|
3332
3333
|
// For Specific type, always show description
|
|
3333
3334
|
if (count === 0 && type === exports.BadgeTileType.Latest)
|
|
3334
3335
|
return null;
|
|
3335
|
-
|
|
3336
|
+
var numberOfLines = React.useMemo(function () {
|
|
3337
|
+
if (width <= 480)
|
|
3338
|
+
return 2;
|
|
3339
|
+
if (width <= 768)
|
|
3340
|
+
return 3;
|
|
3341
|
+
if (width <= 1024)
|
|
3342
|
+
return 1;
|
|
3343
|
+
return 2;
|
|
3344
|
+
}, [width]);
|
|
3345
|
+
return (jsxRuntimeExports.jsx(reactNative.View, { accessible: true, accessibilityLabel: "Badge description: ".concat(description), testID: "badge-tile-description", style: {
|
|
3346
|
+
width: '100%',
|
|
3347
|
+
overflow: 'hidden',
|
|
3348
|
+
}, children: jsxRuntimeExports.jsx(Text, { variant: "body", numberOfLines: numberOfLines, ellipsizeMode: "tail", accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: description }) }));
|
|
3336
3349
|
};
|
|
3337
3350
|
|
|
3338
3351
|
/**
|
|
@@ -3394,7 +3407,7 @@ var BadgeTileTitle = function () {
|
|
|
3394
3407
|
: name;
|
|
3395
3408
|
if (!displayText)
|
|
3396
3409
|
return null;
|
|
3397
|
-
return (jsxRuntimeExports.jsx(reactNative.View, { accessible: true, accessibilityLabel: "Badge title: ".concat(displayText), testID: "badge-tile-title", children: jsxRuntimeExports.jsx(Text, { variant: "title", style: styles.titleText, numberOfLines:
|
|
3410
|
+
return (jsxRuntimeExports.jsx(reactNative.View, { accessible: true, accessibilityLabel: "Badge title: ".concat(displayText), testID: "badge-tile-title", children: jsxRuntimeExports.jsx(Text, { variant: "title", style: styles.titleText, numberOfLines: 1, ellipsizeMode: "tail", accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: displayText }) }));
|
|
3398
3411
|
};
|
|
3399
3412
|
|
|
3400
3413
|
/**
|
|
@@ -3592,15 +3605,16 @@ var useContentTileStyles = function (hasArtwork) {
|
|
|
3592
3605
|
imageContainer: {
|
|
3593
3606
|
width: '100%',
|
|
3594
3607
|
marginBottom: 0,
|
|
3608
|
+
overflow: 'hidden',
|
|
3595
3609
|
},
|
|
3596
3610
|
image: {
|
|
3597
3611
|
position: 'absolute',
|
|
3598
|
-
top:
|
|
3599
|
-
left:
|
|
3600
|
-
bottom:
|
|
3601
|
-
right:
|
|
3602
|
-
width: '
|
|
3603
|
-
height: '
|
|
3612
|
+
top: -1,
|
|
3613
|
+
left: -1,
|
|
3614
|
+
bottom: -1,
|
|
3615
|
+
right: -1,
|
|
3616
|
+
width: '102%',
|
|
3617
|
+
height: '102%',
|
|
3604
3618
|
resizeMode: 'cover',
|
|
3605
3619
|
},
|
|
3606
3620
|
content: {
|
|
@@ -3630,27 +3644,58 @@ var ContentTileMedia = function (_a) {
|
|
|
3630
3644
|
|
|
3631
3645
|
var ContentTileSummary = function () {
|
|
3632
3646
|
var tileContext = useTileContext();
|
|
3647
|
+
var sizeInfo = useTileSize(tileContext);
|
|
3633
3648
|
if (!isContextValid(tileContext))
|
|
3634
3649
|
return null;
|
|
3635
|
-
var
|
|
3650
|
+
var _a = tileContext.configuration, body = _a.body, title = _a.title, artworkUrl = _a.artworkUrl;
|
|
3636
3651
|
if (!body)
|
|
3637
3652
|
return null;
|
|
3638
|
-
var sizeInfo = useTileSize(tileContext);
|
|
3639
3653
|
if (!sizeInfo)
|
|
3640
3654
|
return null;
|
|
3641
|
-
var
|
|
3642
|
-
var
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3655
|
+
var isHalfSize = sizeInfo.isHalfSize;
|
|
3656
|
+
var numberOfLines = React.useMemo(function () {
|
|
3657
|
+
if (!body)
|
|
3658
|
+
return undefined;
|
|
3659
|
+
if (isHalfSize) {
|
|
3660
|
+
if (!title && body)
|
|
3661
|
+
return 4;
|
|
3662
|
+
if (title && body)
|
|
3663
|
+
return 2;
|
|
3664
|
+
}
|
|
3665
|
+
if (artworkUrl)
|
|
3666
|
+
return 3;
|
|
3667
|
+
if (!title)
|
|
3668
|
+
return 8;
|
|
3669
|
+
return 6;
|
|
3670
|
+
}, [title, body, artworkUrl, isHalfSize]);
|
|
3671
|
+
return (jsxRuntimeExports.jsx(Text, { variant: "body", role: "article", accessibilityLabel: body, numberOfLines: numberOfLines, testID: "content-tile-summary", children: body }));
|
|
3646
3672
|
};
|
|
3647
3673
|
|
|
3648
3674
|
var ContentTileTitle = function () {
|
|
3649
3675
|
var tileContext = useTileContext();
|
|
3650
3676
|
var styles = useContentTileStyles();
|
|
3677
|
+
var sizeInfo = useTileSize(tileContext);
|
|
3651
3678
|
if (!isContextValid(tileContext))
|
|
3652
3679
|
return null;
|
|
3653
|
-
var _a = tileContext.configuration, title = _a.title, ctaLink = _a.ctaLink;
|
|
3680
|
+
var _a = tileContext.configuration, title = _a.title, ctaLink = _a.ctaLink, body = _a.body, artworkUrl = _a.artworkUrl;
|
|
3681
|
+
if (!sizeInfo)
|
|
3682
|
+
return null;
|
|
3683
|
+
var isHalfSize = sizeInfo.isHalfSize;
|
|
3684
|
+
var numberOfLines = React.useMemo(function () {
|
|
3685
|
+
if (!title)
|
|
3686
|
+
return undefined;
|
|
3687
|
+
if (isHalfSize) {
|
|
3688
|
+
if (title && !body)
|
|
3689
|
+
return 3;
|
|
3690
|
+
if (title && body)
|
|
3691
|
+
return 1;
|
|
3692
|
+
}
|
|
3693
|
+
if (artworkUrl)
|
|
3694
|
+
return 1;
|
|
3695
|
+
if (!body)
|
|
3696
|
+
return 7;
|
|
3697
|
+
return 2;
|
|
3698
|
+
}, [title, body, artworkUrl, isHalfSize]);
|
|
3654
3699
|
if (!title)
|
|
3655
3700
|
return null;
|
|
3656
3701
|
var handleTitleWidth = function () {
|
|
@@ -3658,7 +3703,7 @@ var ContentTileTitle = function () {
|
|
|
3658
3703
|
return styles.titleWithLink;
|
|
3659
3704
|
}
|
|
3660
3705
|
};
|
|
3661
|
-
return (jsxRuntimeExports.jsx(Text, { variant: "title", role: "heading", accessibilityLabel: title, numberOfLines:
|
|
3706
|
+
return (jsxRuntimeExports.jsx(Text, { variant: "title", role: "heading", accessibilityLabel: title, numberOfLines: numberOfLines, style: handleTitleWidth(), testID: "content-tile-title", children: title }));
|
|
3662
3707
|
};
|
|
3663
3708
|
|
|
3664
3709
|
/**
|
|
@@ -3820,14 +3865,14 @@ var useSectionHeaderStyles = function () {
|
|
|
3820
3865
|
marginBottom: useResponsiveValue(theme.sizes.lg, theme.sizes.xxs, isDesktop, isTablet),
|
|
3821
3866
|
},
|
|
3822
3867
|
sectionTitle: {
|
|
3823
|
-
fontSize: useResponsiveValue(theme.sizes.
|
|
3868
|
+
fontSize: useResponsiveValue(theme.sizes.xxl, theme.sizes.xl, isDesktop, isTablet),
|
|
3824
3869
|
marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet),
|
|
3825
3870
|
fontWeight: '700',
|
|
3826
3871
|
color: theme.text,
|
|
3827
3872
|
fontFamily: theme.fontFamily,
|
|
3828
3873
|
},
|
|
3829
3874
|
sectionDescription: {
|
|
3830
|
-
fontSize: useResponsiveValue(theme.sizes.
|
|
3875
|
+
fontSize: useResponsiveValue(theme.sizes.xl, theme.sizes.md, isDesktop, isTablet),
|
|
3831
3876
|
color: theme.alphaDerivedText[80],
|
|
3832
3877
|
fontFamily: theme.fontFamily,
|
|
3833
3878
|
},
|
|
@@ -4933,10 +4978,12 @@ var RewardTileSummary = function () {
|
|
|
4933
4978
|
var tileContext = useTileContext();
|
|
4934
4979
|
if (!isContextValid(tileContext))
|
|
4935
4980
|
return null;
|
|
4936
|
-
var
|
|
4981
|
+
var _a = tileContext.configuration, summary = _a.summary, _b = _a.showPrice, showPrice = _b === void 0 ? true : _b, price = _a.price;
|
|
4982
|
+
var shouldShowPrice = showPrice && price !== undefined && price !== null && price !== 0;
|
|
4983
|
+
var numberOfLines = shouldShowPrice ? 1 : 3;
|
|
4937
4984
|
if (!summary)
|
|
4938
4985
|
return null;
|
|
4939
|
-
return (jsxRuntimeExports.jsx(Text, { variant: "body", role: "article", accessibilityLabel: summary, testID: "reward-tile-summary", children: summary }));
|
|
4986
|
+
return (jsxRuntimeExports.jsx(Text, { variant: "body", role: "article", accessibilityLabel: summary, testID: "reward-tile-summary", numberOfLines: numberOfLines, ellipsizeMode: "tail", children: summary }));
|
|
4940
4987
|
};
|
|
4941
4988
|
|
|
4942
4989
|
/**
|