@hero-design/rn 8.10.0 → 8.11.1

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 (37) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/es/index.js +293 -82
  3. package/lib/index.js +293 -82
  4. package/package.json +5 -5
  5. package/src/components/Card/index.tsx +1 -1
  6. package/src/components/Carousel/CardCarousel.tsx +218 -0
  7. package/src/components/Carousel/StyledCardCarousel.tsx +40 -0
  8. package/src/components/Carousel/__tests__/CardCarousel.spec.tsx +105 -0
  9. package/src/components/Carousel/__tests__/StyledCardCarousel.spec.tsx +38 -0
  10. package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +289 -0
  11. package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +109 -0
  12. package/src/components/Carousel/contants.ts +10 -0
  13. package/src/components/Carousel/index.tsx +4 -1
  14. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +0 -1
  15. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +0 -1
  16. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -2
  17. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +1 -6
  18. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +1 -6
  19. package/src/components/TextInput/StyledTextInput.tsx +1 -2
  20. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +5 -6
  21. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +6 -20
  22. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +0 -2
  23. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +0 -2
  24. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +24 -4
  25. package/src/theme/components/cardCarousel.ts +28 -0
  26. package/src/theme/components/textInput.ts +2 -6
  27. package/src/theme/getTheme.ts +3 -0
  28. package/src/types.ts +2 -0
  29. package/types/components/Card/index.d.ts +1 -1
  30. package/types/components/Carousel/CardCarousel.d.ts +40 -0
  31. package/types/components/Carousel/StyledCardCarousel.d.ts +31 -0
  32. package/types/components/Carousel/contants.d.ts +2 -0
  33. package/types/components/Carousel/index.d.ts +5 -3
  34. package/types/theme/components/cardCarousel.d.ts +25 -0
  35. package/types/theme/components/textInput.d.ts +1 -4
  36. package/types/theme/getTheme.d.ts +2 -0
  37. package/types/types.d.ts +2 -1
package/lib/index.js CHANGED
@@ -1855,6 +1855,36 @@ var getCarouselTheme = function getCarouselTheme(theme) {
1855
1855
  };
1856
1856
  };
1857
1857
 
1858
+ var getCardCarouselTheme = function getCardCarouselTheme(theme) {
1859
+ var space = {
1860
+ pageControlMarginTop: theme.space.medium,
1861
+ carouselItemSpacing: theme.space.small,
1862
+ contentContainerPaddingHorizontal: theme.space.large
1863
+ };
1864
+ var colors = {
1865
+ shadow: theme.colors.primaryOutline,
1866
+ carouselItemBackground: theme.colors.defaultSurface
1867
+ };
1868
+ var shadows = {
1869
+ offset: {
1870
+ width: 0,
1871
+ height: 2
1872
+ },
1873
+ opacity: 0.12,
1874
+ radius: theme.radii.medium,
1875
+ elevation: 4
1876
+ };
1877
+ var radii = {
1878
+ card: theme.radii.medium
1879
+ };
1880
+ return {
1881
+ shadows: shadows,
1882
+ colors: colors,
1883
+ space: space,
1884
+ radii: radii
1885
+ };
1886
+ };
1887
+
1858
1888
  var getCheckboxTheme = function getCheckboxTheme(theme) {
1859
1889
  var colors = {
1860
1890
  "default": theme.colors.primaryOutline,
@@ -2580,7 +2610,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
2580
2610
  errorMarginLeft: theme.space.xsmall,
2581
2611
  maxLengthLabelMarginLeft: theme.space.xsmall,
2582
2612
  errorAndHelpTextContainerPaddingLeft: theme.space.medium,
2583
- containerMarginTop: theme.space.small
2613
+ containerMarginTop: theme.space.small,
2614
+ labelInsideTextInputMarginTop: -theme.space.xxsmall
2584
2615
  };
2585
2616
  var fontSizes = {
2586
2617
  text: theme.fontSizes.medium,
@@ -2589,10 +2620,6 @@ var getTextInputTheme = function getTextInputTheme(theme) {
2589
2620
  maxLength: theme.fontSizes.small,
2590
2621
  asteriskLabel: theme.fontSizes.medium
2591
2622
  };
2592
- var lineHeights = {
2593
- text: theme.lineHeights.xsmall,
2594
- labelInsideTextInput: theme.lineHeights.xsmall
2595
- };
2596
2623
  var borderWidths = {
2597
2624
  container: {
2598
2625
  normal: theme.borderWidths.base,
@@ -2611,7 +2638,6 @@ var getTextInputTheme = function getTextInputTheme(theme) {
2611
2638
  fontSizes: fontSizes,
2612
2639
  borderWidths: borderWidths,
2613
2640
  radii: radii,
2614
- lineHeights: lineHeights,
2615
2641
  sizes: sizes
2616
2642
  };
2617
2643
  };
@@ -2758,6 +2784,7 @@ var getTheme$1 = function getTheme() {
2758
2784
  calendar: getCalendarTheme(globalTheme),
2759
2785
  card: getCardTheme(globalTheme),
2760
2786
  carousel: getCarouselTheme(globalTheme),
2787
+ cardCarousel: getCardCarouselTheme(globalTheme),
2761
2788
  checkbox: getCheckboxTheme(globalTheme),
2762
2789
  contentNavigator: getContentNavigatorTheme(globalTheme),
2763
2790
  datePicker: getDatePickerTheme(globalTheme),
@@ -5653,7 +5680,7 @@ var index$a = components.reduce(function (acc, comp) {
5653
5680
  });
5654
5681
  }, styled);
5655
5682
 
5656
- var StyledWrapper$b = index$a(reactNative.Animated.View)(function () {
5683
+ var StyledWrapper$c = index$a(reactNative.Animated.View)(function () {
5657
5684
  return {
5658
5685
  margin: 0,
5659
5686
  padding: 0,
@@ -5727,7 +5754,7 @@ var Collapse = function Collapse(_ref) {
5727
5754
  var height = _ref2.height;
5728
5755
  setContentHeight(height);
5729
5756
  }, []);
5730
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$b, {
5757
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$c, {
5731
5758
  style: {
5732
5759
  height: collapseAnim
5733
5760
  },
@@ -5740,10 +5767,10 @@ var Collapse = function Collapse(_ref) {
5740
5767
  }, children)));
5741
5768
  };
5742
5769
 
5743
- var StyledWrapper$a = index$a(reactNative.View)(function () {
5770
+ var StyledWrapper$b = index$a(reactNative.View)(function () {
5744
5771
  return {};
5745
5772
  });
5746
- var StyledItemWrapper = index$a(reactNative.View)(function (_ref) {
5773
+ var StyledItemWrapper$1 = index$a(reactNative.View)(function (_ref) {
5747
5774
  var theme = _ref.theme,
5748
5775
  themeVariant = _ref.themeVariant;
5749
5776
  return {
@@ -6401,7 +6428,7 @@ var AccordionItem = function AccordionItem(_ref) {
6401
6428
  variant = _ref$variant === void 0 ? 'default' : _ref$variant,
6402
6429
  style = _ref.style,
6403
6430
  testID = _ref.testID;
6404
- return /*#__PURE__*/React__default["default"].createElement(StyledItemWrapper, {
6431
+ return /*#__PURE__*/React__default["default"].createElement(StyledItemWrapper$1, {
6405
6432
  themeVariant: variant,
6406
6433
  style: style,
6407
6434
  testID: testID
@@ -6435,7 +6462,7 @@ var Accordion = function Accordion(_ref) {
6435
6462
  _usePropsOrInternalSt2 = _slicedToArray(_usePropsOrInternalSt, 2),
6436
6463
  _activeItemKey = _usePropsOrInternalSt2[0],
6437
6464
  _onItemPress = _usePropsOrInternalSt2[1];
6438
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$a, {
6465
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$b, {
6439
6466
  style: style,
6440
6467
  testID: testID
6441
6468
  }, items.map(function (_ref2, index) {
@@ -6622,7 +6649,7 @@ var Attachment = function Attachment(_ref) {
6622
6649
  })) : null);
6623
6650
  };
6624
6651
 
6625
- var StyledWrapper$9 = index$a(reactNative.TouchableOpacity)(function (_ref) {
6652
+ var StyledWrapper$a = index$a(reactNative.TouchableOpacity)(function (_ref) {
6626
6653
  var themeSize = _ref.themeSize,
6627
6654
  themeIntent = _ref.themeIntent,
6628
6655
  theme = _ref.theme;
@@ -6677,7 +6704,7 @@ var Avatar = function Avatar(_ref) {
6677
6704
  hasImageError = _useState2[0],
6678
6705
  setHasImageError = _useState2[1];
6679
6706
  if (title === undefined && source === undefined) return null;
6680
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$9, {
6707
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$a, {
6681
6708
  testID: testID,
6682
6709
  onPress: onPress,
6683
6710
  disabled: onPress === undefined,
@@ -6701,7 +6728,7 @@ var Avatar = function Avatar(_ref) {
6701
6728
  };
6702
6729
 
6703
6730
  var VISIBLE_RATIO = 0.7;
6704
- var StyledWrapper$8 = index$a(reactNative.View)(function (_ref) {
6731
+ var StyledWrapper$9 = index$a(reactNative.View)(function (_ref) {
6705
6732
  var theme = _ref.theme,
6706
6733
  themeSize = _ref.themeSize,
6707
6734
  themeAvatarCount = _ref.themeAvatarCount;
@@ -6763,7 +6790,7 @@ var AvatarStack = function AvatarStack(_ref) {
6763
6790
  });
6764
6791
  avatars.push(remainingAvatar);
6765
6792
  }
6766
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$8, {
6793
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$9, {
6767
6794
  themeSize: size,
6768
6795
  themeAvatarCount: avatars.length,
6769
6796
  style: style,
@@ -7098,7 +7125,7 @@ var Divider = function Divider(_ref) {
7098
7125
 
7099
7126
  var AnimatedPressable$1 = reactNative.Animated.createAnimatedComponent(reactNative.Pressable);
7100
7127
  var AnimatedSafeAreaView = reactNative.Animated.createAnimatedComponent(reactNative.SafeAreaView);
7101
- var StyledWrapper$7 = index$a(reactNative.View)(_objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
7128
+ var StyledWrapper$8 = index$a(reactNative.View)(_objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
7102
7129
  flexDirection: 'column-reverse'
7103
7130
  }));
7104
7131
  var StyledKeyboardAvoidingView = index$a(reactNative.KeyboardAvoidingView)(function () {
@@ -7757,7 +7784,7 @@ var BottomSheet = function BottomSheet(_ref) {
7757
7784
  transparent: true,
7758
7785
  testID: testID,
7759
7786
  onShow: onOpen
7760
- }, /*#__PURE__*/React__default["default"].createElement(StyledWrapper$7, {
7787
+ }, /*#__PURE__*/React__default["default"].createElement(StyledWrapper$8, {
7761
7788
  pointerEvents: "box-none"
7762
7789
  }, /*#__PURE__*/React__default["default"].createElement(StyledKeyboardAvoidingView, _extends$1({
7763
7790
  behavior: reactNative.Platform.OS === 'ios' ? 'padding' : 'height'
@@ -10588,7 +10615,7 @@ var Image = function Image(_ref) {
10588
10615
  }, imageNativeProps));
10589
10616
  };
10590
10617
 
10591
- var StyledPageControl$1 = index$a(reactNative.View)(function () {
10618
+ var StyledPageControl$2 = index$a(reactNative.View)(function () {
10592
10619
  return {
10593
10620
  flexDirection: 'row',
10594
10621
  alignItems: 'center'
@@ -10616,7 +10643,7 @@ var PageControl = function PageControl(_ref) {
10616
10643
  React__default["default"].useEffect(function () {
10617
10644
  animatedValue.setValue(currentPage);
10618
10645
  }, [currentPage]);
10619
- return /*#__PURE__*/React__default["default"].createElement(StyledPageControl$1, {
10646
+ return /*#__PURE__*/React__default["default"].createElement(StyledPageControl$2, {
10620
10647
  testID: testID,
10621
10648
  style: style
10622
10649
  }, new Array(numberOfPages).fill('').map(function (_, index) {
@@ -10705,7 +10732,7 @@ var StyledCarouselFooterWrapper = index$a(reactNative.View)(function (_ref5) {
10705
10732
  marginBottom: theme.__hd__.carousel.space.footerMarginBottom
10706
10733
  };
10707
10734
  });
10708
- var StyledPageControl = index$a(PageControl)({
10735
+ var StyledPageControl$1 = index$a(PageControl)({
10709
10736
  marginStart: 'auto'
10710
10737
  });
10711
10738
 
@@ -10740,7 +10767,243 @@ var CarouselItem = function CarouselItem(_ref) {
10740
10767
  }, body) : null));
10741
10768
  };
10742
10769
 
10743
- var _excluded$d = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "shouldShowPagination"];
10770
+ /*
10771
+ * Carousel item width.
10772
+ * the percentage of the Card Carousel width
10773
+ */
10774
+ var ITEM_WIDTH_RATE = 0.85;
10775
+ /*
10776
+ * view position when scroll to Index
10777
+ */
10778
+ var VIEW_POSITION_CENTER = 0.5;
10779
+
10780
+ var StyledDataCard = index$a(reactNative.View)(function (_ref) {
10781
+ var theme = _ref.theme;
10782
+ return {
10783
+ borderRadius: theme.__hd__.card.radii["default"],
10784
+ overflow: 'hidden',
10785
+ flexDirection: 'row'
10786
+ };
10787
+ });
10788
+ var Indicator = index$a(reactNative.View)(function (_ref2) {
10789
+ var theme = _ref2.theme,
10790
+ themeIntent = _ref2.themeIntent;
10791
+ return {
10792
+ backgroundColor: theme.__hd__.card.colors[themeIntent],
10793
+ width: theme.__hd__.card.sizes.indicatorWidth,
10794
+ height: '100%'
10795
+ };
10796
+ });
10797
+
10798
+ var _excluded$d = ["intent", "children"];
10799
+ var DataCard = function DataCard(_ref) {
10800
+ var _ref$intent = _ref.intent,
10801
+ intent = _ref$intent === void 0 ? 'info' : _ref$intent,
10802
+ children = _ref.children,
10803
+ nativeProps = _objectWithoutProperties(_ref, _excluded$d);
10804
+ return /*#__PURE__*/React__default["default"].createElement(StyledDataCard, nativeProps, /*#__PURE__*/React__default["default"].createElement(Indicator, {
10805
+ themeIntent: intent,
10806
+ testID: "data-card-indicator"
10807
+ }), children);
10808
+ };
10809
+
10810
+ var StyledCard$1 = index$a(reactNative.View)(function (_ref) {
10811
+ var theme = _ref.theme,
10812
+ themeIntent = _ref.themeIntent;
10813
+ return _objectSpread2(_objectSpread2({}, themeIntent !== undefined && {
10814
+ backgroundColor: theme.__hd__.card.colors[themeIntent]
10815
+ }), {}, {
10816
+ borderRadius: theme.__hd__.card.radii["default"],
10817
+ overflow: 'hidden'
10818
+ });
10819
+ });
10820
+
10821
+ var _excluded$c = ["intent", "children"];
10822
+ var Card = function Card(_ref) {
10823
+ var intent = _ref.intent,
10824
+ children = _ref.children,
10825
+ nativeProps = _objectWithoutProperties(_ref, _excluded$c);
10826
+ return /*#__PURE__*/React__default["default"].createElement(StyledCard$1, _extends$1({}, nativeProps, {
10827
+ themeIntent: intent
10828
+ }), children);
10829
+ };
10830
+ var Card$1 = Object.assign(Card, {
10831
+ Data: DataCard
10832
+ });
10833
+
10834
+ var StyledPageControl = index$a(PageControl)(function (_ref) {
10835
+ var theme = _ref.theme;
10836
+ return {
10837
+ alignSelf: 'center',
10838
+ marginTop: theme.__hd__.cardCarousel.space.pageControlMarginTop
10839
+ };
10840
+ });
10841
+ var StyledWrapper$7 = index$a(reactNative.View)({});
10842
+ var StyledCard = index$a(Card$1)(function (_ref2) {
10843
+ var theme = _ref2.theme;
10844
+ return {
10845
+ borderRadius: theme.__hd__.cardCarousel.radii.card,
10846
+ overflow: 'hidden',
10847
+ flex: 1
10848
+ };
10849
+ });
10850
+ var StyledShadow = index$a(reactNative.View)(function (_ref3) {
10851
+ var theme = _ref3.theme;
10852
+ return {
10853
+ borderRadius: theme.__hd__.cardCarousel.radii.card,
10854
+ shadowColor: theme.__hd__.cardCarousel.colors.shadow,
10855
+ shadowOffset: theme.__hd__.cardCarousel.shadows.offset,
10856
+ shadowRadius: theme.__hd__.cardCarousel.shadows.radius,
10857
+ shadowOpacity: theme.__hd__.cardCarousel.shadows.opacity,
10858
+ elevation: theme.__hd__.cardCarousel.shadows.elevation,
10859
+ flex: 1
10860
+ };
10861
+ });
10862
+ var StyledItemWrapper = index$a(reactNative.View)(function (_ref4) {
10863
+ var theme = _ref4.theme;
10864
+ return {
10865
+ padding: theme.__hd__.cardCarousel.space.carouselItemSpacing
10866
+ };
10867
+ });
10868
+
10869
+ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
10870
+ var onItemIndexChange = _ref.onItemIndexChange,
10871
+ items = _ref.items,
10872
+ _ref$hidePageControl = _ref.hidePageControl,
10873
+ hidePageControl = _ref$hidePageControl === void 0 ? false : _ref$hidePageControl,
10874
+ style = _ref.style,
10875
+ testID = _ref.testID,
10876
+ _ref$autoPlay = _ref.autoPlay,
10877
+ autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
10878
+ _ref$autoPlayInterval = _ref.autoPlayInterval,
10879
+ autoPlayInterval = _ref$autoPlayInterval === void 0 ? 3000 : _ref$autoPlayInterval;
10880
+ var _useState = React.useState(0),
10881
+ _useState2 = _slicedToArray(_useState, 2),
10882
+ currentIndex = _useState2[0],
10883
+ setCurrentIndex = _useState2[1];
10884
+ var theme = useTheme();
10885
+ var _useState3 = React.useState(0),
10886
+ _useState4 = _slicedToArray(_useState3, 2),
10887
+ flatListWidth = _useState4[0],
10888
+ setFlatListWidth = _useState4[1];
10889
+ var itemWidth = flatListWidth * ITEM_WIDTH_RATE;
10890
+ var carouselRef = React.useRef(null);
10891
+ var _snapToIndex = React.useCallback(function (index) {
10892
+ var _carouselRef$current;
10893
+ var validIndex = 0;
10894
+ if (index < 0) {
10895
+ validIndex = 0;
10896
+ } else if (index >= items.length) {
10897
+ validIndex = items.length - 1;
10898
+ } else {
10899
+ validIndex = index;
10900
+ }
10901
+ (_carouselRef$current = carouselRef.current) === null || _carouselRef$current === void 0 ? void 0 : _carouselRef$current.scrollToIndex({
10902
+ index: validIndex,
10903
+ animated: true,
10904
+ viewPosition: VIEW_POSITION_CENTER
10905
+ });
10906
+ }, [carouselRef, itemWidth]);
10907
+ /*
10908
+ * snap to the next index. If the curent index is the last one, snap to the first one.
10909
+ */
10910
+ var snapToNext = React.useCallback(function () {
10911
+ var _carouselRef$current2;
10912
+ var nextIndex = currentIndex + 1;
10913
+ if (nextIndex >= items.length) {
10914
+ nextIndex = 0;
10915
+ }
10916
+ (_carouselRef$current2 = carouselRef.current) === null || _carouselRef$current2 === void 0 ? void 0 : _carouselRef$current2.scrollToIndex({
10917
+ index: nextIndex,
10918
+ animated: true,
10919
+ viewPosition: VIEW_POSITION_CENTER
10920
+ });
10921
+ }, [carouselRef, currentIndex, itemWidth, items.length]);
10922
+ React__default["default"].useImperativeHandle(ref, function () {
10923
+ return {
10924
+ snapToIndex: function snapToIndex(index) {
10925
+ _snapToIndex(index);
10926
+ },
10927
+ // we don't expose this method, it's for testing https://medium.com/developer-rants/how-to-test-useref-without-mocking-useref-699165f4994e
10928
+ getFlatListRef: function getFlatListRef() {
10929
+ return carouselRef.current;
10930
+ }
10931
+ };
10932
+ }, [_snapToIndex]);
10933
+ React.useEffect(function () {
10934
+ var timer;
10935
+ if (autoPlay) {
10936
+ timer = setInterval(function () {
10937
+ snapToNext();
10938
+ }, autoPlayInterval);
10939
+ }
10940
+ return function () {
10941
+ clearInterval(timer);
10942
+ };
10943
+ }, [autoPlay, snapToNext, currentIndex, autoPlayInterval]);
10944
+ var visibleSlideChanged = React.useCallback(function (_ref2) {
10945
+ var viewableItems = _ref2.viewableItems;
10946
+ if (!viewableItems || viewableItems && !viewableItems.length) return;
10947
+ var index = viewableItems[0].index;
10948
+ setCurrentIndex(index);
10949
+ if (onItemIndexChange) {
10950
+ onItemIndexChange(index);
10951
+ }
10952
+ }, [onItemIndexChange]);
10953
+ var getItemLayout = React.useCallback(function (_, index) {
10954
+ return {
10955
+ length: itemWidth,
10956
+ offset: itemWidth * index,
10957
+ index: index
10958
+ };
10959
+ }, [itemWidth]);
10960
+ var onLayout = React.useCallback(function (e) {
10961
+ setFlatListWidth(e.nativeEvent.layout.width);
10962
+ }, [setFlatListWidth]);
10963
+ var renderItem = React.useCallback(function (_ref3) {
10964
+ var item = _ref3.item;
10965
+ return /*#__PURE__*/React__default["default"].createElement(StyledItemWrapper, {
10966
+ style: {
10967
+ width: itemWidth
10968
+ }
10969
+ }, /*#__PURE__*/React__default["default"].createElement(StyledShadow, null, /*#__PURE__*/React__default["default"].createElement(StyledCard, null, item)));
10970
+ }, [itemWidth]);
10971
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$7, {
10972
+ style: style,
10973
+ testID: testID
10974
+ }, /*#__PURE__*/React__default["default"].createElement(reactNative.FlatList, {
10975
+ contentContainerStyle: {
10976
+ paddingHorizontal: theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal
10977
+ },
10978
+ onLayout: onLayout,
10979
+ data: items,
10980
+ horizontal: true,
10981
+ showsHorizontalScrollIndicator: false,
10982
+ pagingEnabled: true,
10983
+ bounces: false,
10984
+ scrollEventThrottle: 32,
10985
+ snapToAlignment: "center",
10986
+ getItemLayout: getItemLayout,
10987
+ ref: carouselRef,
10988
+ renderItem: renderItem,
10989
+ keyExtractor: function keyExtractor(_, index) {
10990
+ return "".concat(index);
10991
+ },
10992
+ decelerationRate: "fast",
10993
+ renderToHardwareTextureAndroid: true,
10994
+ snapToInterval: itemWidth + theme.__hd__.cardCarousel.space.carouselItemSpacing,
10995
+ onViewableItemsChanged: visibleSlideChanged,
10996
+ viewabilityConfig: {
10997
+ itemVisiblePercentThreshold: 80
10998
+ }
10999
+ }), !hidePageControl && /*#__PURE__*/React__default["default"].createElement(StyledPageControl, {
11000
+ testID: "pageControl",
11001
+ currentPage: currentIndex,
11002
+ numberOfPages: items.length
11003
+ }));
11004
+ });
11005
+
11006
+ var _excluded$b = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "shouldShowPagination"];
10744
11007
  function useStateFromProp(initialValue) {
10745
11008
  var _useState = React.useState(initialValue),
10746
11009
  _useState2 = _slicedToArray(_useState, 2),
@@ -10762,7 +11025,7 @@ var Carousel = function Carousel(_ref) {
10762
11025
  shouldShowPagination = _ref$shouldShowPagina === void 0 ? function () {
10763
11026
  return true;
10764
11027
  } : _ref$shouldShowPagina,
10765
- nativeProps = _objectWithoutProperties(_ref, _excluded$d);
11028
+ nativeProps = _objectWithoutProperties(_ref, _excluded$b);
10766
11029
  var carouselRef = React.useRef(null);
10767
11030
  var _useStateFromProp = useStateFromProp(selectedItemIndex),
10768
11031
  _useStateFromProp2 = _slicedToArray(_useStateFromProp, 2),
@@ -10838,64 +11101,13 @@ var Carousel = function Carousel(_ref) {
10838
11101
  width: width
10839
11102
  });
10840
11103
  }
10841
- }), /*#__PURE__*/React__default["default"].createElement(StyledCarouselFooterWrapper, null, renderActions && renderActions(currentSlideIndex), shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React__default["default"].createElement(StyledPageControl, {
11104
+ }), /*#__PURE__*/React__default["default"].createElement(StyledCarouselFooterWrapper, null, renderActions && renderActions(currentSlideIndex), shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React__default["default"].createElement(StyledPageControl$1, {
10842
11105
  numberOfPages: items.length,
10843
11106
  currentPage: currentSlideIndex
10844
11107
  }))));
10845
11108
  };
10846
-
10847
- var StyledDataCard = index$a(reactNative.View)(function (_ref) {
10848
- var theme = _ref.theme;
10849
- return {
10850
- borderRadius: theme.__hd__.card.radii["default"],
10851
- overflow: 'hidden',
10852
- flexDirection: 'row'
10853
- };
10854
- });
10855
- var Indicator = index$a(reactNative.View)(function (_ref2) {
10856
- var theme = _ref2.theme,
10857
- themeIntent = _ref2.themeIntent;
10858
- return {
10859
- backgroundColor: theme.__hd__.card.colors[themeIntent],
10860
- width: theme.__hd__.card.sizes.indicatorWidth,
10861
- height: '100%'
10862
- };
10863
- });
10864
-
10865
- var _excluded$c = ["intent", "children"];
10866
- var DataCard = function DataCard(_ref) {
10867
- var _ref$intent = _ref.intent,
10868
- intent = _ref$intent === void 0 ? 'info' : _ref$intent,
10869
- children = _ref.children,
10870
- nativeProps = _objectWithoutProperties(_ref, _excluded$c);
10871
- return /*#__PURE__*/React__default["default"].createElement(StyledDataCard, nativeProps, /*#__PURE__*/React__default["default"].createElement(Indicator, {
10872
- themeIntent: intent,
10873
- testID: "data-card-indicator"
10874
- }), children);
10875
- };
10876
-
10877
- var StyledCard = index$a(reactNative.View)(function (_ref) {
10878
- var theme = _ref.theme,
10879
- themeIntent = _ref.themeIntent;
10880
- return _objectSpread2(_objectSpread2({}, themeIntent !== undefined && {
10881
- backgroundColor: theme.__hd__.card.colors[themeIntent]
10882
- }), {}, {
10883
- borderRadius: theme.__hd__.card.radii["default"],
10884
- overflow: 'hidden'
10885
- });
10886
- });
10887
-
10888
- var _excluded$b = ["intent", "children"];
10889
- var Card = function Card(_ref) {
10890
- var intent = _ref.intent,
10891
- children = _ref.children,
10892
- nativeProps = _objectWithoutProperties(_ref, _excluded$b);
10893
- return /*#__PURE__*/React__default["default"].createElement(StyledCard, _extends$1({}, nativeProps, {
10894
- themeIntent: intent
10895
- }), children);
10896
- };
10897
- var index$8 = Object.assign(Card, {
10898
- Data: DataCard
11109
+ var index$8 = Object.assign(Carousel, {
11110
+ Card: CardCarousel
10899
11111
  });
10900
11112
 
10901
11113
  var StyledWrapper$6 = index$a(reactNative.TouchableOpacity)(function (_ref) {
@@ -11020,9 +11232,9 @@ var StyledLabelInsideTextInput = index$a(Typography.Text)(function (_ref5) {
11020
11232
  textAlignVertical: 'center',
11021
11233
  alignContent: 'center',
11022
11234
  fontSize: theme.__hd__.textInput.fontSizes.labelInsideTextInput,
11023
- lineHeight: theme.__hd__.textInput.lineHeights.labelInsideTextInput,
11024
11235
  alignItems: 'center',
11025
- color: theme.__hd__.textInput.colors.labelsInsideTextInput[themeVariant]
11236
+ color: theme.__hd__.textInput.colors.labelsInsideTextInput[themeVariant],
11237
+ marginTop: theme.__hd__.textInput.space.labelInsideTextInputMarginTop
11026
11238
  };
11027
11239
  });
11028
11240
  var StyledAsteriskLabelInsideTextInput = index$a(Typography.Text)(function (_ref6) {
@@ -11075,7 +11287,6 @@ var StyledTextInput = index$a(reactNative.TextInput)(function (_ref11) {
11075
11287
  return {
11076
11288
  textAlignVertical: 'center',
11077
11289
  fontSize: theme.__hd__.textInput.fontSizes.text,
11078
- lineHeight: theme.__hd__.textInput.lineHeights.text,
11079
11290
  alignSelf: 'stretch',
11080
11291
  flexGrow: 2,
11081
11292
  marginHorizontal: theme.__hd__.textInput.space.inputHorizontalMargin,
@@ -31368,8 +31579,8 @@ exports.BottomSheet = BottomSheet$1;
31368
31579
  exports.Box = Box;
31369
31580
  exports.Button = CompoundButton;
31370
31581
  exports.Calendar = Calendar;
31371
- exports.Card = index$8;
31372
- exports.Carousel = Carousel;
31582
+ exports.Card = Card$1;
31583
+ exports.Carousel = index$8;
31373
31584
  exports.Checkbox = Checkbox;
31374
31585
  exports.Collapse = Collapse;
31375
31586
  exports.ContentNavigator = ContentNavigator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.10.0",
3
+ "version": "8.11.1",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@emotion/native": "^11.9.3",
23
23
  "@emotion/react": "^11.9.3",
24
- "@hero-design/colors": "8.10.0",
24
+ "@hero-design/colors": "8.11.1",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21"
@@ -44,7 +44,7 @@
44
44
  "@babel/preset-typescript": "^7.17.12",
45
45
  "@babel/runtime": "^7.18.9",
46
46
  "@emotion/jest": "^11.9.3",
47
- "@hero-design/eslint-plugin": "8.10.0",
47
+ "@hero-design/eslint-plugin": "8.11.1",
48
48
  "@react-native-community/datetimepicker": "^3.5.2",
49
49
  "@react-native-community/slider": "4.1.12",
50
50
  "@rollup/plugin-babel": "^5.3.1",
@@ -60,9 +60,9 @@
60
60
  "@types/react-native": "^0.67.7",
61
61
  "@types/react-native-vector-icons": "^6.4.10",
62
62
  "babel-plugin-inline-import": "^3.0.0",
63
- "eslint-config-hd": "8.10.0",
63
+ "eslint-config-hd": "8.11.1",
64
64
  "jest": "^27.3.1",
65
- "prettier-config-hd": "8.10.0",
65
+ "prettier-config-hd": "8.11.1",
66
66
  "react": "18.0.0",
67
67
  "react-native": "0.69.7",
68
68
  "react-native-gesture-handler": "~2.1.0",
@@ -4,7 +4,7 @@ import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
4
4
  import DataCard from './DataCard';
5
5
  import { StyledCard } from './StyledCard';
6
6
 
7
- interface CardProps extends ViewProps {
7
+ export interface CardProps extends ViewProps {
8
8
  /**
9
9
  * Card's content.
10
10
  */