@wlloyalty/wll-react-sdk 1.0.106 → 1.0.108
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 +50 -35
- package/dist/native.js.map +1 -1
- package/dist/types/components/atoms/Skeleton/Skeleton.stories.d.ts +8 -0
- package/dist/types/utils/styling.d.ts +20 -0
- package/dist/web.js +133 -99
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Skeleton from './index';
|
|
3
|
+
declare const meta: Meta<typeof Skeleton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Skeleton>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const FewerTiles: Story;
|
|
8
|
+
export declare const CustomStyle: Story;
|
|
@@ -24,3 +24,23 @@ export declare const commonStyles: {
|
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
export declare const defaultTheme: BaseThemeObject;
|
|
27
|
+
/**
|
|
28
|
+
* Creates appropriate directional margin styles for both web and native platforms.
|
|
29
|
+
* Handles RTL layouts correctly across platforms by using the I18nManager.
|
|
30
|
+
*
|
|
31
|
+
* @param value - The margin value to apply
|
|
32
|
+
* @returns An object with the appropriate margin style property
|
|
33
|
+
*/
|
|
34
|
+
export declare const getDirectionalMargin: (value: number) => {
|
|
35
|
+
marginLeft: number;
|
|
36
|
+
marginRight?: undefined;
|
|
37
|
+
marginEnd?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
marginRight: number;
|
|
40
|
+
marginLeft?: undefined;
|
|
41
|
+
marginEnd?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
marginEnd: number;
|
|
44
|
+
marginLeft?: undefined;
|
|
45
|
+
marginRight?: undefined;
|
|
46
|
+
};
|
package/dist/web.js
CHANGED
|
@@ -7986,45 +7986,6 @@ var EventEmitter$1 = /** @class */function () {
|
|
|
7986
7986
|
*/
|
|
7987
7987
|
var sdkEventEmitter = new EventEmitter$1();
|
|
7988
7988
|
|
|
7989
|
-
var sizes = {
|
|
7990
|
-
borderRadiusSm: 15,
|
|
7991
|
-
borderRadiusLg: 20,
|
|
7992
|
-
borderRadiusButton: 9,
|
|
7993
|
-
borderRadiusRounded: 9999,
|
|
7994
|
-
xxxs: 4,
|
|
7995
|
-
xxs: 8,
|
|
7996
|
-
xs: 10,
|
|
7997
|
-
sm: 12,
|
|
7998
|
-
md: 14,
|
|
7999
|
-
lg: 16,
|
|
8000
|
-
xl: 18,
|
|
8001
|
-
xxl: 24,
|
|
8002
|
-
xxxl: 32,
|
|
8003
|
-
xxxxl: 40,
|
|
8004
|
-
xxxxxl: 60
|
|
8005
|
-
};
|
|
8006
|
-
var commonStyles = StyleSheet$1.create({
|
|
8007
|
-
emptyContainer: {
|
|
8008
|
-
flex: 1,
|
|
8009
|
-
justifyContent: 'center',
|
|
8010
|
-
alignItems: 'center'
|
|
8011
|
-
}
|
|
8012
|
-
});
|
|
8013
|
-
var defaultTheme = {
|
|
8014
|
-
fontFamily: '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif',
|
|
8015
|
-
background: '#F0F0F0',
|
|
8016
|
-
text: '#000000',
|
|
8017
|
-
primary: '#392ed7',
|
|
8018
|
-
accent: '#ff6a3d',
|
|
8019
|
-
surface: '#f8f7fc',
|
|
8020
|
-
surfaceText: '#000000',
|
|
8021
|
-
pageButtonBackground: '#392ed7',
|
|
8022
|
-
pageButtonText: '#ffffff',
|
|
8023
|
-
errorPrimary: '#000000',
|
|
8024
|
-
positive: '#008000',
|
|
8025
|
-
negative: '#ff0000'
|
|
8026
|
-
};
|
|
8027
|
-
|
|
8028
7989
|
/**
|
|
8029
7990
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
8030
7991
|
*
|
|
@@ -8229,6 +8190,69 @@ var _a$1 = Dimensions.get("window"),
|
|
|
8229
8190
|
_a$1.height;
|
|
8230
8191
|
var SCREEN_WIDTH = width;
|
|
8231
8192
|
|
|
8193
|
+
var sizes = {
|
|
8194
|
+
borderRadiusSm: 15,
|
|
8195
|
+
borderRadiusLg: 20,
|
|
8196
|
+
borderRadiusButton: 9,
|
|
8197
|
+
borderRadiusRounded: 9999,
|
|
8198
|
+
xxxs: 4,
|
|
8199
|
+
xxs: 8,
|
|
8200
|
+
xs: 10,
|
|
8201
|
+
sm: 12,
|
|
8202
|
+
md: 14,
|
|
8203
|
+
lg: 16,
|
|
8204
|
+
xl: 18,
|
|
8205
|
+
xxl: 24,
|
|
8206
|
+
xxxl: 32,
|
|
8207
|
+
xxxxl: 40,
|
|
8208
|
+
xxxxxl: 60
|
|
8209
|
+
};
|
|
8210
|
+
var commonStyles = StyleSheet$1.create({
|
|
8211
|
+
emptyContainer: {
|
|
8212
|
+
flex: 1,
|
|
8213
|
+
justifyContent: 'center',
|
|
8214
|
+
alignItems: 'center'
|
|
8215
|
+
}
|
|
8216
|
+
});
|
|
8217
|
+
var defaultTheme = {
|
|
8218
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif',
|
|
8219
|
+
background: '#F0F0F0',
|
|
8220
|
+
text: '#000000',
|
|
8221
|
+
primary: '#392ed7',
|
|
8222
|
+
accent: '#ff6a3d',
|
|
8223
|
+
surface: '#f8f7fc',
|
|
8224
|
+
surfaceText: '#000000',
|
|
8225
|
+
pageButtonBackground: '#392ed7',
|
|
8226
|
+
pageButtonText: '#ffffff',
|
|
8227
|
+
errorPrimary: '#000000',
|
|
8228
|
+
positive: '#008000',
|
|
8229
|
+
negative: '#ff0000'
|
|
8230
|
+
};
|
|
8231
|
+
/**
|
|
8232
|
+
* Creates appropriate directional margin styles for both web and native platforms.
|
|
8233
|
+
* Handles RTL layouts correctly across platforms by using the I18nManager.
|
|
8234
|
+
*
|
|
8235
|
+
* @param value - The margin value to apply
|
|
8236
|
+
* @returns An object with the appropriate margin style property
|
|
8237
|
+
*/
|
|
8238
|
+
var getDirectionalMargin = function (value) {
|
|
8239
|
+
if (IS_WEB) {
|
|
8240
|
+
// Check document direction for web
|
|
8241
|
+
// We need to use this because React Native Web does not support I18nManager
|
|
8242
|
+
// and marginStart/marginEnd resolves to margin-left/margin-right and not margin-inline-start/end
|
|
8243
|
+
var isRTL = typeof document !== 'undefined' && document.documentElement.dir === 'rtl';
|
|
8244
|
+
return isRTL ? {
|
|
8245
|
+
marginLeft: value
|
|
8246
|
+
} : {
|
|
8247
|
+
marginRight: value
|
|
8248
|
+
};
|
|
8249
|
+
}
|
|
8250
|
+
// For native platforms, use marginEnd which automatically handles RTL
|
|
8251
|
+
return {
|
|
8252
|
+
marginEnd: value
|
|
8253
|
+
};
|
|
8254
|
+
};
|
|
8255
|
+
|
|
8232
8256
|
var COLOR_CONSTANTS = {
|
|
8233
8257
|
MINIMUM_CONTRAST_RATIO: 2,
|
|
8234
8258
|
DEFAULT_LIGHTNESS_ADJUSTMENT: 0.2,
|
|
@@ -19014,22 +19038,22 @@ var Text = function (_a) {
|
|
|
19014
19038
|
var accessibilityRole;
|
|
19015
19039
|
switch (variant) {
|
|
19016
19040
|
case 'title':
|
|
19017
|
-
accessibilityRole = 'header';
|
|
19041
|
+
accessibilityRole = IS_MOBILE ? 'heading' : 'header';
|
|
19018
19042
|
break;
|
|
19019
19043
|
case 'caption':
|
|
19020
|
-
accessibilityRole = 'text';
|
|
19044
|
+
accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
|
|
19021
19045
|
break;
|
|
19022
19046
|
case 'eyebrow':
|
|
19023
|
-
accessibilityRole = 'text';
|
|
19047
|
+
accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
|
|
19024
19048
|
break;
|
|
19025
19049
|
case 'description':
|
|
19026
|
-
accessibilityRole = 'paragraph';
|
|
19050
|
+
accessibilityRole = IS_MOBILE ? 'article' : 'paragraph';
|
|
19027
19051
|
break;
|
|
19028
19052
|
case 'label':
|
|
19029
|
-
accessibilityRole = 'text';
|
|
19053
|
+
accessibilityRole = IS_MOBILE ? 'option' : 'text';
|
|
19030
19054
|
break;
|
|
19031
19055
|
default:
|
|
19032
|
-
accessibilityRole = 'text';
|
|
19056
|
+
accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
|
|
19033
19057
|
}
|
|
19034
19058
|
var combinedStyles = [styles.base, variantStyle, styles.webOverrides, style];
|
|
19035
19059
|
return /*#__PURE__*/React__namespace.createElement(Text$3, __assign({
|
|
@@ -19656,11 +19680,51 @@ var styles$5 = StyleSheet$1.create({
|
|
|
19656
19680
|
|
|
19657
19681
|
var GRID_GAP = 16;
|
|
19658
19682
|
|
|
19683
|
+
/**
|
|
19684
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
19685
|
+
*
|
|
19686
|
+
* This source code is licensed under the MIT license found in the
|
|
19687
|
+
* LICENSE file in the root directory of this source tree.
|
|
19688
|
+
*
|
|
19689
|
+
* @format
|
|
19690
|
+
*
|
|
19691
|
+
*/
|
|
19692
|
+
|
|
19693
|
+
function useWindowDimensions() {
|
|
19694
|
+
var _useState = React.useState(() => Dimensions.get('window')),
|
|
19695
|
+
dims = _useState[0],
|
|
19696
|
+
setDims = _useState[1];
|
|
19697
|
+
React.useEffect(() => {
|
|
19698
|
+
function handleChange(_ref) {
|
|
19699
|
+
var window = _ref.window;
|
|
19700
|
+
if (window != null) {
|
|
19701
|
+
setDims(window);
|
|
19702
|
+
}
|
|
19703
|
+
}
|
|
19704
|
+
Dimensions.addEventListener('change', handleChange);
|
|
19705
|
+
// We might have missed an update between calling `get` in render and
|
|
19706
|
+
// `addEventListener` in this handler, so we set it here. If there was
|
|
19707
|
+
// no change, React will filter out this update as a no-op.
|
|
19708
|
+
setDims(Dimensions.get('window'));
|
|
19709
|
+
return () => {
|
|
19710
|
+
Dimensions.removeEventListener('change', handleChange);
|
|
19711
|
+
};
|
|
19712
|
+
}, []);
|
|
19713
|
+
return dims;
|
|
19714
|
+
}
|
|
19715
|
+
|
|
19659
19716
|
/* istanbul ignore file */
|
|
19660
19717
|
var SkeletonTile = function (_a) {
|
|
19661
19718
|
var style = _a.style;
|
|
19662
19719
|
var theme = useWllSdk().theme;
|
|
19663
19720
|
var animatedValue = React__namespace.useRef(new Animated$1.Value(0)).current;
|
|
19721
|
+
var width = useWindowDimensions().width;
|
|
19722
|
+
var tileWidth = 1000 / 4;
|
|
19723
|
+
var tileHeight = tileWidth;
|
|
19724
|
+
if (IS_MOBILE) {
|
|
19725
|
+
tileWidth = width / 2 - theme.sizes.lg * 2;
|
|
19726
|
+
tileHeight = tileWidth;
|
|
19727
|
+
}
|
|
19664
19728
|
React__namespace.useEffect(function () {
|
|
19665
19729
|
var pulseAnimation = Animated$1.loop(Animated$1.sequence([Animated$1.timing(animatedValue, {
|
|
19666
19730
|
toValue: 1,
|
|
@@ -19684,15 +19748,16 @@ var SkeletonTile = function (_a) {
|
|
|
19684
19748
|
style: [styles$4.container, {
|
|
19685
19749
|
opacity: opacity,
|
|
19686
19750
|
backgroundColor: theme.alphaDerivedText[20],
|
|
19687
|
-
borderRadius: theme.sizes.borderRadiusLg
|
|
19751
|
+
borderRadius: theme.sizes.borderRadiusLg,
|
|
19752
|
+
width: tileWidth,
|
|
19753
|
+
height: tileHeight
|
|
19688
19754
|
}, style]
|
|
19689
19755
|
});
|
|
19690
19756
|
};
|
|
19691
19757
|
var styles$4 = StyleSheet$1.create({
|
|
19692
19758
|
container: {
|
|
19693
19759
|
aspectRatio: 1,
|
|
19694
|
-
overflow: 'hidden'
|
|
19695
|
-
width: 1000 / 4
|
|
19760
|
+
overflow: 'hidden'
|
|
19696
19761
|
}
|
|
19697
19762
|
});
|
|
19698
19763
|
|
|
@@ -20202,14 +20267,14 @@ var useBannerTileStyles = function () {
|
|
|
20202
20267
|
slideContent: {
|
|
20203
20268
|
flex: 1
|
|
20204
20269
|
},
|
|
20205
|
-
mediaContainer: {
|
|
20270
|
+
mediaContainer: __assign(__assign({
|
|
20206
20271
|
aspectRatio: 1,
|
|
20207
20272
|
position: 'relative',
|
|
20208
|
-
overflow: 'hidden'
|
|
20209
|
-
|
|
20273
|
+
overflow: 'hidden'
|
|
20274
|
+
}, getDirectionalMargin(useResponsiveValue(theme.sizes.xxl, theme.sizes.xxs, isDesktop, isTablet))), {
|
|
20210
20275
|
maxHeight: useResponsiveValue(253, 120, isDesktop, isTablet),
|
|
20211
20276
|
minHeight: 120
|
|
20212
|
-
},
|
|
20277
|
+
}),
|
|
20213
20278
|
media: {
|
|
20214
20279
|
position: 'absolute',
|
|
20215
20280
|
width: '100%',
|
|
@@ -20396,11 +20461,10 @@ var useContentTileStyles = function (hasArtwork) {
|
|
|
20396
20461
|
flex: 1
|
|
20397
20462
|
},
|
|
20398
20463
|
header: getHeaderStyle(hasArtwork),
|
|
20399
|
-
tileTitle: {
|
|
20464
|
+
tileTitle: __assign({
|
|
20400
20465
|
maxWidth: '90%',
|
|
20401
|
-
flex: 1
|
|
20402
|
-
|
|
20403
|
-
}
|
|
20466
|
+
flex: 1
|
|
20467
|
+
}, getDirectionalMargin(8))
|
|
20404
20468
|
});
|
|
20405
20469
|
};
|
|
20406
20470
|
|
|
@@ -20533,39 +20597,6 @@ exports.SectionType = void 0;
|
|
|
20533
20597
|
SectionType["Banner"] = "BANNER";
|
|
20534
20598
|
})(exports.SectionType || (exports.SectionType = {}));
|
|
20535
20599
|
|
|
20536
|
-
/**
|
|
20537
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
20538
|
-
*
|
|
20539
|
-
* This source code is licensed under the MIT license found in the
|
|
20540
|
-
* LICENSE file in the root directory of this source tree.
|
|
20541
|
-
*
|
|
20542
|
-
* @format
|
|
20543
|
-
*
|
|
20544
|
-
*/
|
|
20545
|
-
|
|
20546
|
-
function useWindowDimensions() {
|
|
20547
|
-
var _useState = React.useState(() => Dimensions.get('window')),
|
|
20548
|
-
dims = _useState[0],
|
|
20549
|
-
setDims = _useState[1];
|
|
20550
|
-
React.useEffect(() => {
|
|
20551
|
-
function handleChange(_ref) {
|
|
20552
|
-
var window = _ref.window;
|
|
20553
|
-
if (window != null) {
|
|
20554
|
-
setDims(window);
|
|
20555
|
-
}
|
|
20556
|
-
}
|
|
20557
|
-
Dimensions.addEventListener('change', handleChange);
|
|
20558
|
-
// We might have missed an update between calling `get` in render and
|
|
20559
|
-
// `addEventListener` in this handler, so we set it here. If there was
|
|
20560
|
-
// no change, React will filter out this update as a no-op.
|
|
20561
|
-
setDims(Dimensions.get('window'));
|
|
20562
|
-
return () => {
|
|
20563
|
-
Dimensions.removeEventListener('change', handleChange);
|
|
20564
|
-
};
|
|
20565
|
-
}, []);
|
|
20566
|
-
return dims;
|
|
20567
|
-
}
|
|
20568
|
-
|
|
20569
20600
|
var useSectionHeaderStyles = function () {
|
|
20570
20601
|
var _a = useResponsive$1(),
|
|
20571
20602
|
isDesktop = _a.isDesktop,
|
|
@@ -20979,9 +21010,7 @@ var Grid = function (_a) {
|
|
|
20979
21010
|
key: "container-".concat(index),
|
|
20980
21011
|
style: [
|
|
20981
21012
|
// @ts-ignore Web uses CSS calc strings for responsive layouts, while ViewStyle expects numbers
|
|
20982
|
-
getTileWidth(columnsPerRow), !isLastInRow &&
|
|
20983
|
-
marginEnd: GRID_GAP
|
|
20984
|
-
}]
|
|
21013
|
+
getTileWidth(columnsPerRow), !isLastInRow && getDirectionalMargin(GRID_GAP)]
|
|
20985
21014
|
}, /*#__PURE__*/React.createElement(TileContainer, {
|
|
20986
21015
|
tiles: currentTiles
|
|
20987
21016
|
})));
|
|
@@ -21193,7 +21222,7 @@ var Section = function (_a) {
|
|
|
21193
21222
|
if (isLoading) {
|
|
21194
21223
|
return /*#__PURE__*/React.createElement(Skeleton, {
|
|
21195
21224
|
"aria-label": "Loading section content",
|
|
21196
|
-
numberOfSquares: 4
|
|
21225
|
+
numberOfSquares: IS_WEB ? 4 : 2
|
|
21197
21226
|
});
|
|
21198
21227
|
}
|
|
21199
21228
|
if (error || !sectionData) {
|
|
@@ -21457,12 +21486,18 @@ var Group = function (_a) {
|
|
|
21457
21486
|
groupData = _b.groupData,
|
|
21458
21487
|
isLoading = _b.isLoading,
|
|
21459
21488
|
error = _b.error;
|
|
21489
|
+
var theme = useWllSdk().theme;
|
|
21460
21490
|
if (isLoading) {
|
|
21461
21491
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
21462
|
-
style:
|
|
21492
|
+
style: {
|
|
21493
|
+
flex: 1,
|
|
21494
|
+
padding: theme.sizes.lg
|
|
21495
|
+
},
|
|
21463
21496
|
accessible: true,
|
|
21464
21497
|
accessibilityLabel: "Loading group data"
|
|
21465
|
-
}, /*#__PURE__*/React.createElement(Skeleton,
|
|
21498
|
+
}, /*#__PURE__*/React.createElement(Skeleton, {
|
|
21499
|
+
numberOfSquares: IS_WEB ? 4 : 2
|
|
21500
|
+
}));
|
|
21466
21501
|
}
|
|
21467
21502
|
if (error || !groupData) {
|
|
21468
21503
|
return /*#__PURE__*/React.createElement(GroupEmptyState, {
|
|
@@ -22036,11 +22071,10 @@ var useRewardTileStyles = function () {
|
|
|
22036
22071
|
width: '100%',
|
|
22037
22072
|
marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet)
|
|
22038
22073
|
},
|
|
22039
|
-
tileTitle: {
|
|
22074
|
+
tileTitle: __assign({
|
|
22040
22075
|
maxWidth: '90%',
|
|
22041
|
-
flex: 1
|
|
22042
|
-
|
|
22043
|
-
}
|
|
22076
|
+
flex: 1
|
|
22077
|
+
}, getDirectionalMargin(8))
|
|
22044
22078
|
});
|
|
22045
22079
|
};
|
|
22046
22080
|
|