@telus-uds/components-base 1.93.0 → 1.95.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.
Files changed (101) hide show
  1. package/CHANGELOG.md +32 -3
  2. package/lib/Autocomplete/Autocomplete.js +2 -1
  3. package/lib/Button/ButtonGroup.js +17 -1
  4. package/lib/Card/Card.js +12 -0
  5. package/lib/Card/CardBase.js +37 -2
  6. package/lib/Carousel/Carousel.js +55 -13
  7. package/lib/Carousel/CarouselItem/CarouselItem.js +86 -12
  8. package/lib/DownloadApp/DownloadApp.js +168 -0
  9. package/lib/DownloadApp/dictionary.js +17 -0
  10. package/lib/DownloadApp/index.js +10 -0
  11. package/lib/Fieldset/FieldsetContainer.js +7 -2
  12. package/lib/Fieldset/FieldsetContainer.native.js +4 -1
  13. package/lib/FileUpload/FileUpload.js +336 -0
  14. package/lib/FileUpload/NotificationContent.js +60 -0
  15. package/lib/FileUpload/dictionary.js +47 -0
  16. package/lib/FileUpload/index.js +10 -0
  17. package/lib/Icon/IconText.js +19 -2
  18. package/lib/Link/LinkBase.js +2 -2
  19. package/lib/Link/TextButton.js +7 -17
  20. package/lib/Modal/Modal.js +1 -1
  21. package/lib/Modal/ModalContent.js +12 -6
  22. package/lib/MultiSelectFilter/ModalOverlay.js +49 -30
  23. package/lib/MultiSelectFilter/MultiSelectFilter.js +170 -131
  24. package/lib/Notification/Notification.js +11 -2
  25. package/lib/Status/Status.js +9 -4
  26. package/lib/TabBar/TabBar.js +133 -0
  27. package/lib/TabBar/TabBarItem.js +184 -0
  28. package/lib/TabBar/index.js +10 -0
  29. package/lib/TextInput/TextInputBase.js +2 -1
  30. package/lib/Tooltip/getTooltipPosition.js +8 -9
  31. package/lib/index.js +24 -0
  32. package/lib/utils/convertFromMegaByteToByte.js +16 -0
  33. package/lib/utils/formatImageSource.js +34 -0
  34. package/lib/utils/index.js +17 -1
  35. package/lib-module/Autocomplete/Autocomplete.js +2 -1
  36. package/lib-module/Button/ButtonGroup.js +17 -1
  37. package/lib-module/Card/Card.js +13 -1
  38. package/lib-module/Card/CardBase.js +38 -3
  39. package/lib-module/Carousel/Carousel.js +55 -13
  40. package/lib-module/Carousel/CarouselItem/CarouselItem.js +86 -12
  41. package/lib-module/DownloadApp/DownloadApp.js +160 -0
  42. package/lib-module/DownloadApp/dictionary.js +10 -0
  43. package/lib-module/DownloadApp/index.js +2 -0
  44. package/lib-module/Fieldset/FieldsetContainer.js +7 -2
  45. package/lib-module/Fieldset/FieldsetContainer.native.js +4 -1
  46. package/lib-module/FileUpload/FileUpload.js +329 -0
  47. package/lib-module/FileUpload/NotificationContent.js +55 -0
  48. package/lib-module/FileUpload/dictionary.js +40 -0
  49. package/lib-module/FileUpload/index.js +2 -0
  50. package/lib-module/Icon/IconText.js +19 -2
  51. package/lib-module/Link/LinkBase.js +2 -2
  52. package/lib-module/Link/TextButton.js +7 -17
  53. package/lib-module/Modal/Modal.js +1 -1
  54. package/lib-module/Modal/ModalContent.js +12 -6
  55. package/lib-module/MultiSelectFilter/ModalOverlay.js +49 -30
  56. package/lib-module/MultiSelectFilter/MultiSelectFilter.js +171 -132
  57. package/lib-module/Notification/Notification.js +11 -2
  58. package/lib-module/Status/Status.js +9 -4
  59. package/lib-module/TabBar/TabBar.js +125 -0
  60. package/lib-module/TabBar/TabBarItem.js +177 -0
  61. package/lib-module/TabBar/index.js +2 -0
  62. package/lib-module/TextInput/TextInputBase.js +2 -1
  63. package/lib-module/Tooltip/getTooltipPosition.js +8 -9
  64. package/lib-module/index.js +3 -0
  65. package/lib-module/utils/convertFromMegaByteToByte.js +10 -0
  66. package/lib-module/utils/formatImageSource.js +27 -0
  67. package/lib-module/utils/index.js +3 -1
  68. package/package.json +4 -3
  69. package/src/Autocomplete/Autocomplete.jsx +2 -1
  70. package/src/Button/ButtonGroup.jsx +9 -1
  71. package/src/Card/Card.jsx +18 -2
  72. package/src/Card/CardBase.jsx +47 -12
  73. package/src/Carousel/Carousel.jsx +59 -13
  74. package/src/Carousel/CarouselItem/CarouselItem.jsx +94 -9
  75. package/src/DownloadApp/DownloadApp.jsx +165 -0
  76. package/src/DownloadApp/dictionary.js +10 -0
  77. package/src/DownloadApp/index.js +3 -0
  78. package/src/Fieldset/FieldsetContainer.jsx +4 -3
  79. package/src/Fieldset/FieldsetContainer.native.jsx +9 -6
  80. package/src/FileUpload/FileUpload.jsx +396 -0
  81. package/src/FileUpload/NotificationContent.jsx +44 -0
  82. package/src/FileUpload/dictionary.js +40 -0
  83. package/src/FileUpload/index.js +3 -0
  84. package/src/Icon/IconText.jsx +21 -4
  85. package/src/Link/LinkBase.jsx +2 -2
  86. package/src/Link/TextButton.jsx +10 -17
  87. package/src/Modal/Modal.jsx +1 -1
  88. package/src/Modal/ModalContent.jsx +8 -3
  89. package/src/MultiSelectFilter/ModalOverlay.jsx +44 -18
  90. package/src/MultiSelectFilter/MultiSelectFilter.jsx +188 -126
  91. package/src/Notification/Notification.jsx +12 -4
  92. package/src/Status/Status.jsx +15 -4
  93. package/src/TabBar/TabBar.jsx +123 -0
  94. package/src/TabBar/TabBarItem.jsx +149 -0
  95. package/src/TabBar/index.js +3 -0
  96. package/src/TextInput/TextInputBase.jsx +1 -1
  97. package/src/Tooltip/getTooltipPosition.js +11 -12
  98. package/src/index.js +3 -0
  99. package/src/utils/convertFromMegaByteToByte.js +11 -0
  100. package/src/utils/formatImageSource.js +29 -0
  101. package/src/utils/index.js +2 -0
@@ -2,8 +2,10 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import View from "react-native-web/dist/exports/View";
4
4
  import Platform from "react-native-web/dist/exports/Platform";
5
+ import ImageBackground from "react-native-web/dist/exports/ImageBackground";
6
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
7
  import { applyShadowToken } from '../ThemeProvider';
6
- import { getTokensPropType } from '../utils';
8
+ import { getTokensPropType, responsiveProps, useResponsiveProp, formatImageSource } from '../utils';
7
9
  import { a11yProps, viewProps, selectSystemProps } from '../utils/props';
8
10
  import { jsx as _jsx } from "react/jsx-runtime";
9
11
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
@@ -54,22 +56,55 @@ const CardBase = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
54
56
  children,
55
57
  tokens,
56
58
  dataSet,
59
+ backgroundImage,
57
60
  ...rest
58
61
  } = _ref2;
59
62
  const cardStyle = selectStyles(typeof tokens === 'function' ? tokens() : tokens);
60
63
  const props = selectProps(rest);
64
+ const {
65
+ src = '',
66
+ alt = '',
67
+ resizeMode = ''
68
+ } = backgroundImage || {};
69
+ const backgroundImageResizeMode = useResponsiveProp(resizeMode, 'cover');
70
+ const imageSourceViewport = formatImageSource(useResponsiveProp(src));
61
71
  return /*#__PURE__*/_jsx(View, {
62
72
  style: cardStyle,
63
73
  dataSet: dataSet,
64
74
  ref: ref,
65
75
  ...props,
66
- children: children
76
+ children: src ? /*#__PURE__*/_jsx(ImageBackground, {
77
+ alt: alt,
78
+ source: imageSourceViewport,
79
+ imageStyle: {
80
+ borderRadius: (cardStyle === null || cardStyle === void 0 ? void 0 : cardStyle.borderRadius) - (cardStyle === null || cardStyle === void 0 ? void 0 : cardStyle.borderWidth)
81
+ },
82
+ resizeMode: backgroundImageResizeMode,
83
+ style: styles.imageBackground,
84
+ children: children
85
+ }) : children
67
86
  });
68
87
  });
69
88
  CardBase.displayName = 'CardBase';
89
+ const styles = StyleSheet.create({
90
+ imageBackground: {
91
+ width: '100%',
92
+ height: '100%'
93
+ }
94
+ });
70
95
  CardBase.propTypes = {
71
96
  ...selectedSystemPropTypes,
72
97
  children: PropTypes.node,
73
- tokens: getTokensPropType('Card')
98
+ tokens: getTokensPropType('Card'),
99
+ /**
100
+ * Apply background image to the card.
101
+ */
102
+ backgroundImage: PropTypes.shape({
103
+ // The image src is either a URI string or a number (when a local image src is bundled in IOS or Android app)
104
+ // src is an object when used responsively to provide different image sources for different screen sizes
105
+ src: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).isRequired,
106
+ alt: PropTypes.string,
107
+ resizeMode: responsiveProps.getTypeOptionallyByViewport(PropTypes.oneOf(['cover', 'contain', 'stretch', 'repeat', 'center']))
108
+ })
74
109
  };
75
110
  export default CardBase;
@@ -48,9 +48,9 @@ const selectContainerStyles = width => ({
48
48
  overflow: 'hidden',
49
49
  width
50
50
  });
51
- const selectSwipeAreaStyles = (count, width) => ({
51
+ const selectSwipeAreaStyles = (count, width, enablePeeking) => ({
52
52
  width: width * count,
53
- justifyContent: 'space-between',
53
+ justifyContent: enablePeeking ? 'flex-start' : 'space-between',
54
54
  flexDirection: 'row'
55
55
  });
56
56
  const getDynamicPositionProperty = areStylesAppliedOnPreviousButton => areStylesAppliedOnPreviousButton ? 'left' : 'right';
@@ -59,7 +59,8 @@ const selectControlButtonPositionStyles = _ref => {
59
59
  positionVariant,
60
60
  buttonWidth,
61
61
  positionProperty = getDynamicPositionProperty(),
62
- spaceBetweenSlideAndButton
62
+ spaceBetweenSlideAndButton,
63
+ enablePeeking
63
64
  } = _ref;
64
65
  const styles = {};
65
66
  if (positionVariant === 'edge') {
@@ -67,11 +68,15 @@ const selectControlButtonPositionStyles = _ref => {
67
68
  } else if (positionVariant === 'inside') {
68
69
  styles[positionProperty] = 0;
69
70
  } else if (positionVariant === 'outside') {
70
- styles[positionProperty] = -1 * (spaceBetweenSlideAndButton + buttonWidth);
71
+ if (enablePeeking) {
72
+ styles[positionProperty] = 0;
73
+ } else {
74
+ styles[positionProperty] = -1 * (spaceBetweenSlideAndButton + buttonWidth);
75
+ }
71
76
  }
72
77
  return styles;
73
78
  };
74
- const selectPreviousNextNavigationButtonStyles = (previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, areStylesAppliedOnPreviousButton) => {
79
+ const selectPreviousNextNavigationButtonStyles = (previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, areStylesAppliedOnPreviousButton, enablePeeking) => {
75
80
  const styles = {
76
81
  zIndex: 1,
77
82
  position: 'absolute'
@@ -89,10 +94,31 @@ const selectPreviousNextNavigationButtonStyles = (previousNextNavigationButtonWi
89
94
  positionVariant: previousNextNavigationPosition,
90
95
  buttonWidth: previousNextNavigationButtonWidth,
91
96
  positionProperty: getDynamicPositionProperty(areStylesAppliedOnPreviousButton),
92
- spaceBetweenSlideAndButton: spaceBetweenSlideAndPreviousNextNavigation
97
+ spaceBetweenSlideAndButton: spaceBetweenSlideAndPreviousNextNavigation,
98
+ enablePeeking
93
99
  })
94
100
  };
95
101
  };
102
+ const getPeekingProps = viewport => {
103
+ if (viewport === 'xs' || viewport === 'sm') {
104
+ return {
105
+ peekingFirstSpace: 48,
106
+ peekingGap: 16,
107
+ peekingLastSpace: 48,
108
+ peekingMarginLeft: 24,
109
+ peekingMarginRight: 24,
110
+ peekingMiddleSpace: 28
111
+ };
112
+ }
113
+ return {
114
+ peekingFirstSpace: 48,
115
+ peekingGap: 16,
116
+ peekingLastSpace: 48,
117
+ peekingMarginLeft: 16,
118
+ peekingMarginRight: 16,
119
+ peekingMiddleSpace: 24
120
+ };
121
+ };
96
122
  const selectIconStyles = _ref2 => {
97
123
  let {
98
124
  iconBackgroundColor
@@ -190,6 +216,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
190
216
  slideDuration = 0,
191
217
  transitionDuration = 0,
192
218
  autoPlay = false,
219
+ enablePeeking = false,
193
220
  ...rest
194
221
  } = _ref3;
195
222
  let childrenArray = unpackFragment(children);
@@ -286,6 +313,13 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
286
313
  useNativeDriver: false,
287
314
  duration: transitionDuration * 1000
288
315
  }).start(handleAnimationEndToIndex);
316
+ } else if (enablePeeking) {
317
+ Animated.timing(pan, {
318
+ ...springConfig,
319
+ toValue,
320
+ useNativeDriver: false,
321
+ duration: transitionDuration ? transitionDuration * 1000 : 1000
322
+ }).start(handleAnimationEndToIndex);
289
323
  } else {
290
324
  Animated.spring(pan, {
291
325
  ...springConfig,
@@ -293,7 +327,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
293
327
  useNativeDriver: false
294
328
  }).start(handleAnimationEndToIndex);
295
329
  }
296
- }, [pan, springConfig, handleAnimationEnd, transitionDuration, isAutoPlayEnabled]);
330
+ }, [pan, springConfig, handleAnimationEnd, transitionDuration, isAutoPlayEnabled, enablePeeking]);
297
331
  const stopAutoplay = React.useCallback(() => {
298
332
  if (autoPlayRef !== null && autoPlayRef !== void 0 && autoPlayRef.current) {
299
333
  clearTimeout(autoPlayRef === null || autoPlayRef === void 0 ? void 0 : autoPlayRef.current);
@@ -595,7 +629,8 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
595
629
  positionVariant: previousNextNavigationPosition,
596
630
  buttonWidth: previousNextNavigationButtonWidth,
597
631
  positionProperty: getDynamicPositionProperty(),
598
- spaceBetweenSlideAndButton: spaceBetweenSlideAndPreviousNextNavigation
632
+ spaceBetweenSlideAndButton: spaceBetweenSlideAndPreviousNextNavigation,
633
+ enablePeeking
599
634
  })],
600
635
  children: /*#__PURE__*/_jsx(IconButton, {
601
636
  icon: isCarouselPlaying ? pauseIcon : playIcon,
@@ -604,7 +639,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
604
639
  onPress: onAnimationControlButtonPress
605
640
  })
606
641
  }) : null, showPreviousNextNavigation && childrenArray.length > 1 ? /*#__PURE__*/_jsx(View, {
607
- style: selectPreviousNextNavigationButtonStyles(previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, true),
642
+ style: selectPreviousNextNavigationButtonStyles(previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, true, enablePeeking),
608
643
  testID: "previous-button-container",
609
644
  children: /*#__PURE__*/_jsx(IconButton, {
610
645
  onLayout: onPreviousNextNavigationButtonLayout,
@@ -627,7 +662,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
627
662
  }), /*#__PURE__*/_jsx(View, {
628
663
  style: selectContainerStyles(containerLayout.width),
629
664
  children: /*#__PURE__*/_jsx(Animated.View, {
630
- style: StyleSheet.flatten([selectSwipeAreaStyles(childrenArray.length, containerLayout.width), {
665
+ style: StyleSheet.flatten([selectSwipeAreaStyles(childrenArray.length, containerLayout.width, enablePeeking), {
631
666
  transform: [{
632
667
  translateX: pan.x
633
668
  }, {
@@ -643,7 +678,9 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
643
678
  const hidden = !isAnimating && index !== activeIndex;
644
679
  const clonedElement = /*#__PURE__*/React.cloneElement(element, {
645
680
  elementIndex: index,
646
- hidden
681
+ hidden: enablePeeking ? false : hidden,
682
+ enablePeeking,
683
+ peekingProps: getPeekingProps(viewport)
647
684
  });
648
685
  return /*#__PURE__*/_jsx(React.Fragment, {
649
686
  children: clonedElement
@@ -651,7 +688,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
651
688
  })
652
689
  })
653
690
  }), showPreviousNextNavigation && childrenArray.length > 1 ? /*#__PURE__*/_jsx(View, {
654
- style: selectPreviousNextNavigationButtonStyles(previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, false),
691
+ style: selectPreviousNextNavigationButtonStyles(previousNextNavigationButtonWidth, previousNextNavigationPosition, spaceBetweenSlideAndPreviousNextNavigation, isFirstSlide, isLastSlide, false, enablePeeking),
655
692
  testID: "next-button-container",
656
693
  children: /*#__PURE__*/_jsx(IconButton, {
657
694
  onLayout: onPreviousNextNavigationButtonLayout,
@@ -845,7 +882,12 @@ Carousel.propTypes = {
845
882
  * - Default value is `0`
846
883
  * - `autoPlay` and `slideDuration` are required to be set for this to work
847
884
  */
848
- transitionDuration: PropTypes.number
885
+ transitionDuration: PropTypes.number,
886
+ /**
887
+ * If set to `true`, the Carousel will show the previous and next slides
888
+ * - Default value is `false`
889
+ */
890
+ enablePeeking: PropTypes.bool
849
891
  };
850
892
  Carousel.Item = CarouselItem;
851
893
  Carousel.displayName = 'Carousel';
@@ -6,37 +6,96 @@ import { layoutTags, getA11yPropsFromHtmlTag, selectSystemProps, a11yProps, view
6
6
  import { useCarousel } from '../CarouselContext';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
9
+ const selectContainerStyle = _ref => {
10
+ let {
11
+ width,
12
+ activeIndex,
13
+ elementIndex,
14
+ totalItems,
15
+ enablePeeking,
16
+ peekingMarginLeft,
17
+ peekingMarginRight,
18
+ peekingFirstSpace,
19
+ peekingLastSpace,
20
+ peekingMiddleSpace,
21
+ peekingGap,
22
+ hidden
23
+ } = _ref;
24
+ const isFirst = elementIndex === 0;
25
+ const isLast = elementIndex === totalItems - 1;
26
+ const isMiddle = !isFirst && !isLast;
27
+ const isActive = activeIndex === elementIndex;
28
+ let adjustedWidth = width;
29
+ let marginLeft = 0;
30
+ let marginRight = 0;
31
+ if (enablePeeking) {
32
+ if (isActive) {
33
+ adjustedWidth = width - (peekingMarginLeft + peekingGap + peekingFirstSpace);
34
+ } else if (isMiddle) {
35
+ adjustedWidth = width - peekingGap;
36
+ }
37
+ if (isFirst) {
38
+ if (isActive) {
39
+ marginLeft = peekingMarginLeft;
40
+ } else if (activeIndex === totalItems - 1) {
41
+ marginLeft = peekingLastSpace;
42
+ } else {
43
+ marginLeft = peekingMiddleSpace;
44
+ }
45
+ }
46
+ if (isLast && isActive) {
47
+ marginRight = peekingMarginRight;
48
+ } else {
49
+ marginRight = peekingGap;
50
+ }
51
+ }
52
+ const style = {
53
+ width: adjustedWidth,
54
+ marginLeft,
55
+ marginRight
56
+ };
57
+ if (hidden && Platform.OS === 'web') {
58
+ style.visibility = 'hidden';
59
+ }
60
+ return style;
61
+ };
9
62
 
10
63
  /**
11
64
  * `Carousel.Item` is used to wrap the content of an individual slide and is suppsoed to be the
12
65
  * only top-level component passed to the `Carousel`
13
66
  */
14
- const CarouselItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {
67
+ const CarouselItem = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
15
68
  let {
16
69
  children,
17
70
  elementIndex,
18
71
  tag = 'li',
19
72
  hidden,
73
+ enablePeeking,
74
+ peekingProps,
20
75
  ...rest
21
- } = _ref;
76
+ } = _ref2;
22
77
  const {
23
78
  width,
24
- activeIndex
79
+ activeIndex,
80
+ totalItems,
81
+ height
25
82
  } = useCarousel();
26
83
  const selectedProps = selectProps({
27
84
  ...rest,
28
85
  ...getA11yPropsFromHtmlTag(tag, rest.accessibilityRole)
29
86
  });
30
87
  const focusabilityProps = activeIndex === elementIndex ? {} : a11yProps.nonFocusableProps;
31
- const style = {
32
- width
33
- };
34
- if (hidden && Platform.OS === 'web') {
35
- // On web, visibility: hidden makes all children non-focusable. It doesn't exist on native.
36
- style.visibility = 'hidden';
37
- }
38
88
  return /*#__PURE__*/_jsx(View, {
39
- style: style,
89
+ style: selectContainerStyle({
90
+ width,
91
+ activeIndex,
92
+ elementIndex,
93
+ totalItems,
94
+ hidden,
95
+ height,
96
+ enablePeeking,
97
+ ...peekingProps
98
+ }),
40
99
  ...selectedProps,
41
100
  ...focusabilityProps,
42
101
  ref: ref,
@@ -70,7 +129,22 @@ CarouselItem.propTypes = {
70
129
  /**
71
130
  * Function to set carousel content background color when slide is being display
72
131
  */
73
- setContentBackgroundColor: PropTypes.func
132
+ setContentBackgroundColor: PropTypes.func,
133
+ /**
134
+ * Boolean to enable peeking effect on the first and last slide
135
+ */
136
+ enablePeeking: PropTypes.bool,
137
+ /**
138
+ * Object to configure the peeking effect
139
+ */
140
+ peekingProps: PropTypes.shape({
141
+ peekingMarginLeft: PropTypes.number,
142
+ peekingMarginRight: PropTypes.number,
143
+ peekingFirstSpace: PropTypes.number,
144
+ peekingLastSpace: PropTypes.number,
145
+ peekingMiddleSpace: PropTypes.number,
146
+ peekingGap: PropTypes.number
147
+ })
74
148
  };
75
149
  CarouselItem.displayName = 'Carousel.Item';
76
150
  export default CarouselItem;
@@ -0,0 +1,160 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Pressable from "react-native-web/dist/exports/Pressable";
4
+ import Platform from "react-native-web/dist/exports/Platform";
5
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
6
+ import { a11yProps, linkProps, hrefAttrsProp, viewProps, getTokensPropType, resolvePressableTokens, variantProp, copyPropTypes, selectSystemProps, useCopy } from '../utils';
7
+ import { useThemeTokensCallback } from '../ThemeProvider';
8
+ import defaultDictionary from './dictionary';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, linkProps, viewProps]);
11
+ const selectOuterStyles = _ref => {
12
+ let {
13
+ borderColor,
14
+ borderWidth,
15
+ borderGap,
16
+ borderRadius,
17
+ padding
18
+ } = _ref;
19
+ return {
20
+ outline: 'none',
21
+ borderColor,
22
+ borderWidth,
23
+ borderGap,
24
+ borderRadius,
25
+ padding
26
+ };
27
+ };
28
+ const DownloadApp = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
29
+ let {
30
+ copy = 'en',
31
+ dictionary = defaultDictionary,
32
+ type = 'ios',
33
+ href,
34
+ onPress,
35
+ tokens = {},
36
+ variant = {},
37
+ ...props
38
+ } = _ref2;
39
+ const getCopy = useCopy({
40
+ dictionary,
41
+ copy
42
+ });
43
+ const {
44
+ hrefAttrs,
45
+ rest
46
+ } = hrefAttrsProp.bundle(props);
47
+ const selectedProps = selectProps({
48
+ accessibilityRole: href ? 'link' : 'button',
49
+ href,
50
+ onPress: linkProps.handleHref({
51
+ href,
52
+ onPress
53
+ }),
54
+ hrefAttrs,
55
+ ...rest
56
+ });
57
+ const getDownloadAppTokens = useThemeTokensCallback('DownloadApp', tokens, variant);
58
+ const resolveDownloadAppTokens = pressableState => {
59
+ const themeTokens = resolvePressableTokens(getDownloadAppTokens, pressableState, {});
60
+ return selectOuterStyles(themeTokens);
61
+ };
62
+ const {
63
+ androidENIcon,
64
+ androidFRIcon,
65
+ iosENIcon,
66
+ iosFRIcon
67
+ } = getDownloadAppTokens();
68
+ const imageResources = {
69
+ en: {
70
+ android: androidENIcon,
71
+ ios: iosENIcon
72
+ },
73
+ fr: {
74
+ android: androidFRIcon,
75
+ ios: iosFRIcon
76
+ }
77
+ };
78
+ const IconComponent = imageResources[copy][type];
79
+ return /*#__PURE__*/_jsx(Pressable, {
80
+ ref: ref,
81
+ style: pressState => [resolveDownloadAppTokens(pressState), staticStyles.row],
82
+ ...selectedProps,
83
+ children: /*#__PURE__*/_jsx(IconComponent, {
84
+ style: staticImageSizes[type][copy],
85
+ alt: type === 'ios' ? getCopy('altTextIos') : getCopy('altTextAndroid')
86
+ })
87
+ });
88
+ });
89
+ DownloadApp.displayName = 'DownloadApp';
90
+ const dictionaryContentShape = PropTypes.shape({
91
+ altTextAndroid: PropTypes.string.isRequired,
92
+ altTextIos: PropTypes.string.isRequired
93
+ });
94
+ DownloadApp.propTypes = {
95
+ ...selectedSystemPropTypes,
96
+ copy: copyPropTypes,
97
+ /**
98
+ * Override the default dictionary, by passing the complete dictionary object for `en` and `fr`
99
+ */
100
+ dictionary: PropTypes.shape({
101
+ en: dictionaryContentShape,
102
+ fr: dictionaryContentShape
103
+ }),
104
+ /**
105
+ * Select the type of image to show.
106
+ */
107
+ type: PropTypes.oneOf(['android', 'ios']),
108
+ /**
109
+ * It's a simple link that opens the Download Button instead of the onPress function.
110
+ */
111
+ href: PropTypes.string,
112
+ /**
113
+ * Function called when the button is pressed. Required unless the button has a href.
114
+ */
115
+ onPress: PropTypes.func,
116
+ /**
117
+ * DownloadApp tokens.
118
+ */
119
+ tokens: getTokensPropType('DownloadApp'),
120
+ /**
121
+ * DownloadApp variant.
122
+ */
123
+ variant: variantProp.propType
124
+ };
125
+ const staticStyles = StyleSheet.create({
126
+ row: {
127
+ ...Platform.select({
128
+ web: {
129
+ display: 'inline-flex',
130
+ width: 'fit-content'
131
+ },
132
+ default: {
133
+ alignSelf: 'flex-start'
134
+ }
135
+ })
136
+ }
137
+ });
138
+ const staticImageSizes = {
139
+ android: {
140
+ en: {
141
+ width: 162,
142
+ height: 48
143
+ },
144
+ fr: {
145
+ width: 162,
146
+ height: 48
147
+ }
148
+ },
149
+ ios: {
150
+ en: {
151
+ width: 144,
152
+ height: 48
153
+ },
154
+ fr: {
155
+ width: 152,
156
+ height: 48
157
+ }
158
+ }
159
+ };
160
+ export default DownloadApp;
@@ -0,0 +1,10 @@
1
+ export default {
2
+ en: {
3
+ altTextAndroid: 'Get it on Google Play',
4
+ altTextIos: 'Download on the App Store'
5
+ },
6
+ fr: {
7
+ altTextAndroid: 'Disponible sur Google Play',
8
+ altTextIos: 'Télécharger dans l’App Store'
9
+ }
10
+ };
@@ -0,0 +1,2 @@
1
+ import DownloadApp from './DownloadApp';
2
+ export default DownloadApp;
@@ -16,6 +16,7 @@ const FieldsetContainer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
16
16
  name: fieldsetName,
17
17
  showBorderStyle = false,
18
18
  borderStyle,
19
+ style,
19
20
  ...rest
20
21
  } = _ref;
21
22
  // If needs border for error design or reset the component style
@@ -23,7 +24,10 @@ const FieldsetContainer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
23
24
  return /*#__PURE__*/_jsx("fieldset", {
24
25
  ref: ref,
25
26
  disabled: inactive,
26
- style: styleContainer,
27
+ style: {
28
+ ...styleContainer,
29
+ ...style
30
+ },
27
31
  role: accessibilityRole,
28
32
  name: fieldsetName,
29
33
  ...selectProps(rest),
@@ -38,6 +42,7 @@ FieldsetContainer.propTypes = {
38
42
  inactive: PropTypes.bool,
39
43
  name: PropTypes.string,
40
44
  showBorderStyle: PropTypes.bool,
41
- borderStyle: PropTypes.object
45
+ borderStyle: PropTypes.object,
46
+ style: PropTypes.object
42
47
  };
43
48
  export default FieldsetContainer;
@@ -11,12 +11,14 @@ const FieldsetContainer = /*#__PURE__*/React.forwardRef((_ref, ref) => {
11
11
  let {
12
12
  children,
13
13
  accessibilityRole,
14
+ style,
14
15
  ...rest
15
16
  } = _ref;
16
17
  return /*#__PURE__*/_jsx(View, {
17
18
  ref: ref,
18
19
  accessibilityRole: accessibilityRole,
19
20
  ...selectProps(rest),
21
+ style: style,
20
22
  children: children
21
23
  });
22
24
  });
@@ -24,6 +26,7 @@ FieldsetContainer.displayName = 'FieldsetContainer';
24
26
  FieldsetContainer.propTypes = {
25
27
  ...selectedSystemPropTypes,
26
28
  children: PropTypes.node,
27
- accessibilityRole: PropTypes.string
29
+ accessibilityRole: PropTypes.string,
30
+ style: PropTypes.object
28
31
  };
29
32
  export default FieldsetContainer;