@hero-design/rn 8.20.0 → 8.21.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 (44) hide show
  1. package/.turbo/turbo-build.log +9 -9
  2. package/es/index.js +190 -60
  3. package/lib/index.js +190 -60
  4. package/package.json +5 -5
  5. package/src/components/Button/Button.tsx +1 -1
  6. package/src/components/Button/StyledButton.tsx +0 -3
  7. package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +0 -10
  8. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +0 -16
  9. package/src/components/Calendar/index.tsx +7 -2
  10. package/src/components/Carousel/StyledCarousel.tsx +11 -3
  11. package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +791 -6
  12. package/src/components/Carousel/__tests__/index.spec.tsx +41 -31
  13. package/src/components/Carousel/index.tsx +39 -7
  14. package/src/components/DatePicker/DatePickerAndroid.tsx +1 -1
  15. package/src/components/DatePicker/DatePickerCalendar.tsx +110 -0
  16. package/src/components/DatePicker/DatePickerIOS.tsx +1 -1
  17. package/src/components/DatePicker/__tests__/DatePicker.spec.tsx +27 -8
  18. package/src/components/DatePicker/__tests__/DatePickerCalendar.spec.tsx +61 -0
  19. package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +670 -0
  20. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +220 -0
  21. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +0 -1
  22. package/src/components/DatePicker/index.tsx +5 -1
  23. package/src/components/DatePicker/types.ts +7 -1
  24. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
  25. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +0 -1
  26. package/src/components/TimePicker/types.ts +1 -1
  27. package/src/components/Toast/Toast.tsx +3 -1
  28. package/src/components/Toast/types.ts +4 -0
  29. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +2 -3
  30. package/src/theme/components/button.ts +0 -5
  31. package/src/theme/components/carousel.ts +3 -0
  32. package/types/components/Calendar/index.d.ts +6 -2
  33. package/types/components/Carousel/StyledCarousel.d.ts +7 -1
  34. package/types/components/Carousel/index.d.ts +7 -1
  35. package/types/components/DatePicker/DatePickerAndroid.d.ts +1 -1
  36. package/types/components/DatePicker/DatePickerCalendar.d.ts +3 -0
  37. package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
  38. package/types/components/DatePicker/index.d.ts +1 -1
  39. package/types/components/DatePicker/types.d.ts +7 -1
  40. package/types/components/TimePicker/types.d.ts +1 -1
  41. package/types/components/Toast/Toast.d.ts +1 -1
  42. package/types/components/Toast/types.d.ts +4 -0
  43. package/types/theme/components/button.d.ts +0 -3
  44. package/types/theme/components/carousel.d.ts +2 -0
package/lib/index.js CHANGED
@@ -1898,9 +1898,6 @@ var getButtonTheme = function getButtonTheme(theme) {
1898
1898
  utility: theme.fontSizes.large,
1899
1899
  textVariant: theme.fontSizes.large
1900
1900
  };
1901
- var lineHeight = {
1902
- "default": theme.lineHeights.large
1903
- };
1904
1901
  var borderWidth = {
1905
1902
  "default": theme.space.xxsmall
1906
1903
  };
@@ -1948,7 +1945,6 @@ var getButtonTheme = function getButtonTheme(theme) {
1948
1945
  sizes: sizes,
1949
1946
  radii: radii,
1950
1947
  colors: colors,
1951
- lineHeight: lineHeight,
1952
1948
  space: space
1953
1949
  };
1954
1950
  };
@@ -2015,7 +2011,9 @@ var getCarouselTheme = function getCarouselTheme(theme) {
2015
2011
  headingMarginBottom: theme.space.medium,
2016
2012
  footerPaddingHorizontal: theme.space.large,
2017
2013
  footerPaddingVertical: theme.space.medium,
2018
- footerMarginBottom: theme.space.large
2014
+ footerMarginBottom: theme.space.large,
2015
+ pageControlPaddingVertical: theme.space.small,
2016
+ pageControlWrapperHeight: scale(48)
2019
2017
  };
2020
2018
  var fontSizes = {
2021
2019
  heading: theme.fontSizes['xxxxxlarge']
@@ -6075,7 +6073,7 @@ var StyledText$3 = index$a(reactNative.Text)(function (_ref) {
6075
6073
  });
6076
6074
  });
6077
6075
 
6078
- var _excluded$r = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
6076
+ var _excluded$s = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
6079
6077
  var Text = function Text(_ref) {
6080
6078
  var children = _ref.children,
6081
6079
  _ref$fontSize = _ref.fontSize,
@@ -6088,7 +6086,7 @@ var Text = function Text(_ref) {
6088
6086
  typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
6089
6087
  _ref$allowFontScaling = _ref.allowFontScaling,
6090
6088
  allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
6091
- nativeProps = _objectWithoutProperties(_ref, _excluded$r);
6089
+ nativeProps = _objectWithoutProperties(_ref, _excluded$s);
6092
6090
  return /*#__PURE__*/React__default["default"].createElement(StyledText$3, _extends$1({}, nativeProps, {
6093
6091
  themeFontSize: fontSize,
6094
6092
  themeFontWeight: fontWeight,
@@ -6610,10 +6608,10 @@ var StyledHeroIcon = index$a(HeroIcon)(function (_ref) {
6610
6608
  };
6611
6609
  });
6612
6610
 
6613
- var _excluded$q = ["style"];
6611
+ var _excluded$r = ["style"];
6614
6612
  var AnimatedIcon = function AnimatedIcon(_ref) {
6615
6613
  var style = _ref.style,
6616
- otherProps = _objectWithoutProperties(_ref, _excluded$q);
6614
+ otherProps = _objectWithoutProperties(_ref, _excluded$r);
6617
6615
  var rotateAnimation = React.useRef(new reactNative.Animated.Value(0));
6618
6616
  React.useEffect(function () {
6619
6617
  var animation = reactNative.Animated.loop(reactNative.Animated.timing(rotateAnimation.current, {
@@ -6719,7 +6717,7 @@ var AccordionItem = function AccordionItem(_ref) {
6719
6717
  }, content));
6720
6718
  };
6721
6719
 
6722
- var _excluded$p = ["key"];
6720
+ var _excluded$q = ["key"];
6723
6721
  var Accordion = function Accordion(_ref) {
6724
6722
  var items = _ref.items,
6725
6723
  activeItemKey = _ref.activeItemKey,
@@ -6740,7 +6738,7 @@ var Accordion = function Accordion(_ref) {
6740
6738
  testID: testID
6741
6739
  }, items.map(function (_ref2, index) {
6742
6740
  var key = _ref2.key,
6743
- props = _objectWithoutProperties(_ref2, _excluded$p);
6741
+ props = _objectWithoutProperties(_ref2, _excluded$q);
6744
6742
  var open = _activeItemKey === key;
6745
6743
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
6746
6744
  key: key
@@ -7137,7 +7135,7 @@ var StyledStatus = index$a(reactNative.Animated.View)(function (_ref3) {
7137
7135
  };
7138
7136
  });
7139
7137
 
7140
- var _excluded$o = ["children", "visible", "intent", "style", "testID"];
7138
+ var _excluded$p = ["children", "visible", "intent", "style", "testID"];
7141
7139
  var Status = function Status(_ref) {
7142
7140
  var children = _ref.children,
7143
7141
  _ref$visible = _ref.visible,
@@ -7146,7 +7144,7 @@ var Status = function Status(_ref) {
7146
7144
  intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
7147
7145
  style = _ref.style,
7148
7146
  testID = _ref.testID,
7149
- nativeProps = _objectWithoutProperties(_ref, _excluded$o);
7147
+ nativeProps = _objectWithoutProperties(_ref, _excluded$p);
7150
7148
  var _React$useRef = React__default["default"].useRef(new reactNative.Animated.Value(visible ? 1 : 0)),
7151
7149
  opacity = _React$useRef.current;
7152
7150
  var isFirstRendering = React__default["default"].useRef(true);
@@ -7179,7 +7177,7 @@ var Status = function Status(_ref) {
7179
7177
  }));
7180
7178
  };
7181
7179
 
7182
- var _excluded$n = ["content", "visible", "max", "intent", "style", "testID"];
7180
+ var _excluded$o = ["content", "visible", "max", "intent", "style", "testID"];
7183
7181
  var DEFAULT_MAX_NUMBER = 99;
7184
7182
  var getPaddingState = function getPaddingState(content) {
7185
7183
  return content.length > 1 ? 'wideContent' : 'narrowContent';
@@ -7194,7 +7192,7 @@ var Badge = function Badge(_ref) {
7194
7192
  intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
7195
7193
  style = _ref.style,
7196
7194
  testID = _ref.testID,
7197
- nativeProps = _objectWithoutProperties(_ref, _excluded$n);
7195
+ nativeProps = _objectWithoutProperties(_ref, _excluded$o);
7198
7196
  var _React$useRef = React__default["default"].useRef(new reactNative.Animated.Value(visible ? 1 : 0)),
7199
7197
  opacity = _React$useRef.current;
7200
7198
  var isFirstRendering = React__default["default"].useRef(true);
@@ -7298,7 +7296,7 @@ function omit(keys, obj) {
7298
7296
  return result;
7299
7297
  }
7300
7298
 
7301
- var _excluded$m = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
7299
+ var _excluded$n = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
7302
7300
  var getInactiveIcon = function getInactiveIcon(icon) {
7303
7301
  var inactiveIcon = "".concat(icon, "-outlined");
7304
7302
  return isHeroIcon(inactiveIcon) ? inactiveIcon : icon;
@@ -7309,7 +7307,7 @@ var BottomNavigation = function BottomNavigation(_ref) {
7309
7307
  renderActiveTabOnly = _ref$renderActiveTabO === void 0 ? false : _ref$renderActiveTabO,
7310
7308
  selectedTabKey = _ref.selectedTabKey,
7311
7309
  tabs = _ref.tabs,
7312
- nativeProps = _objectWithoutProperties(_ref, _excluded$m);
7310
+ nativeProps = _objectWithoutProperties(_ref, _excluded$n);
7313
7311
  var insets = reactNativeSafeAreaContext.useSafeAreaInsets();
7314
7312
  /**
7315
7313
  * List of loaded tabs, tabs will be loaded when navigated to.
@@ -7396,13 +7394,13 @@ var StyledDivider = index$a(reactNative.View)(function (_ref) {
7396
7394
  }, horizontalMargin), verticalMargin);
7397
7395
  });
7398
7396
 
7399
- var _excluded$l = ["marginHorizontal", "marginVertical", "style", "testID"];
7397
+ var _excluded$m = ["marginHorizontal", "marginVertical", "style", "testID"];
7400
7398
  var Divider = function Divider(_ref) {
7401
7399
  var marginHorizontal = _ref.marginHorizontal,
7402
7400
  marginVertical = _ref.marginVertical,
7403
7401
  style = _ref.style,
7404
7402
  testID = _ref.testID,
7405
- nativeProps = _objectWithoutProperties(_ref, _excluded$l);
7403
+ nativeProps = _objectWithoutProperties(_ref, _excluded$m);
7406
7404
  return /*#__PURE__*/React__default["default"].createElement(StyledDivider, _extends$1({}, nativeProps, {
7407
7405
  themeMarginHorizontal: marginHorizontal,
7408
7406
  themeMarginVertical: marginVertical,
@@ -7532,7 +7530,7 @@ var StyledLoadingDot = index$a(reactNative.View)(function (_ref2) {
7532
7530
  }, themeStyling());
7533
7531
  });
7534
7532
 
7535
- var _excluded$k = ["count", "size", "testID", "themeVariant"];
7533
+ var _excluded$l = ["count", "size", "testID", "themeVariant"];
7536
7534
  var AnimatedLoadingIndicatorWrapper = reactNative.Animated.createAnimatedComponent(StyledLoadingIndicatorWrapper);
7537
7535
  var AnimatedLoadingDot = reactNative.Animated.createAnimatedComponent(StyledLoadingDot);
7538
7536
  var renderDotComponent = function renderDotComponent(_ref) {
@@ -7564,7 +7562,7 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
7564
7562
  size = _ref2$size === void 0 ? 12 : _ref2$size,
7565
7563
  testID = _ref2.testID,
7566
7564
  themeVariant = _ref2.themeVariant,
7567
- nativeProps = _objectWithoutProperties(_ref2, _excluded$k);
7565
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$l);
7568
7566
  var progressAnimation = React.useRef(new reactNative.Animated.Value(0));
7569
7567
  React.useEffect(function () {
7570
7568
  var animation = reactNative.Animated.loop(reactNative.Animated.timing(progressAnimation.current, {
@@ -7649,8 +7647,7 @@ var genOutlineTextStyles = function genOutlineTextStyles(theme, intent, disabled
7649
7647
  };
7650
7648
  };
7651
7649
  return _objectSpread2({
7652
- fontSize: theme.__hd__.button.fontSize["default"],
7653
- lineHeight: theme.__hd__.button.lineHeight["default"]
7650
+ fontSize: theme.__hd__.button.fontSize["default"]
7654
7651
  }, textColorStyling());
7655
7652
  };
7656
7653
  var genTextVariantTextStyles = function genTextVariantTextStyles(theme, intent, disabled) {
@@ -7665,8 +7662,7 @@ var genTextVariantTextStyles = function genTextVariantTextStyles(theme, intent,
7665
7662
  };
7666
7663
  };
7667
7664
  return _objectSpread2({
7668
- fontSize: theme.__hd__.button.fontSize.textVariant,
7669
- lineHeight: theme.__hd__.button.lineHeight["default"]
7665
+ fontSize: theme.__hd__.button.fontSize.textVariant
7670
7666
  }, textColorStyling());
7671
7667
  };
7672
7668
  var StyledButtonContainer = index$a(reactNative.TouchableHighlight)(function (_ref) {
@@ -7714,7 +7710,6 @@ var StyledButtonText = index$a(Typography.Text)(function (_ref2) {
7714
7710
  case 'filled-danger':
7715
7711
  return {
7716
7712
  fontSize: theme.__hd__.button.fontSize["default"],
7717
- lineHeight: theme.__hd__.button.lineHeight["default"],
7718
7713
  color: theme.__hd__.button.colors.invertedText
7719
7714
  };
7720
7715
  case 'outlined-primary':
@@ -7874,9 +7869,9 @@ var Button = function Button(_ref) {
7874
7869
  testID: "".concat(testID, "-left-icon"),
7875
7870
  themeVariant: themeVariant
7876
7871
  })), /*#__PURE__*/React__default["default"].createElement(StyledButtonText, {
7877
- disabled: disabled,
7878
7872
  ellipsizeMode: "tail",
7879
7873
  numberOfLines: 1,
7874
+ disabled: disabled,
7880
7875
  themeVariant: themeVariant
7881
7876
  }, text), rightIcon !== undefined && /*#__PURE__*/React__default["default"].createElement(StyledButtonIconWrapper, {
7882
7877
  themePosition: "right"
@@ -7970,13 +7965,13 @@ CompoundButton.Icon = IconButton;
7970
7965
  CompoundButton.Utility = UtilityButton;
7971
7966
 
7972
7967
  // eslint-disable-next-line @typescript-eslint/no-empty-function
7973
- var noop = function noop() {};
7968
+ var noop$1 = function noop() {};
7974
7969
 
7975
7970
  var Header = function Header(_ref) {
7976
7971
  var content = _ref.content,
7977
7972
  showDivider = _ref.showDivider,
7978
7973
  _ref$onRequestClose = _ref.onRequestClose,
7979
- onRequestClose = _ref$onRequestClose === void 0 ? noop : _ref$onRequestClose,
7974
+ onRequestClose = _ref$onRequestClose === void 0 ? noop$1 : _ref$onRequestClose,
7980
7975
  showCloseButton = _ref.showCloseButton;
7981
7976
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledHeaderWrapper, null, typeof content === 'string' ? /*#__PURE__*/React__default["default"].createElement(StyledHeader, null, /*#__PURE__*/React__default["default"].createElement(Typography.Text, {
7982
7977
  fontSize: "large",
@@ -7994,11 +7989,11 @@ var Header = function Header(_ref) {
7994
7989
  })) : null), showDivider ? /*#__PURE__*/React__default["default"].createElement(Divider, null) : null);
7995
7990
  };
7996
7991
 
7997
- var _excluded$j = ["scrollEventThrottle"];
7992
+ var _excluded$k = ["scrollEventThrottle"];
7998
7993
  var BottomSheetScrollView = function BottomSheetScrollView(_ref) {
7999
7994
  var _ref$scrollEventThrot = _ref.scrollEventThrottle,
8000
7995
  scrollEventThrottle = _ref$scrollEventThrot === void 0 ? 100 : _ref$scrollEventThrot,
8001
- props = _objectWithoutProperties(_ref, _excluded$j);
7996
+ props = _objectWithoutProperties(_ref, _excluded$k);
8002
7997
  var _useContext = React.useContext(BottomSheetContext),
8003
7998
  setInternalShowDivider = _useContext.setInternalShowDivider;
8004
7999
  var onScrollBeginDrag = React.useCallback(function (e) {
@@ -8313,7 +8308,7 @@ var borderWidths = {
8313
8308
  var config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, colors), space), radii), borderWidths);
8314
8309
  var flexPropsKey = ['alignContent', 'alignItems', 'alignSelf', 'display', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent'];
8315
8310
 
8316
- var _excluded$i = ["theme"];
8311
+ var _excluded$j = ["theme"];
8317
8312
  var getThemeValue = function getThemeValue(theme, key, props) {
8318
8313
  var propConfig = config[key];
8319
8314
  var propValue = props[key];
@@ -8340,18 +8335,18 @@ var mapStylePropToThemeValue = function mapStylePropToThemeValue(theme, props) {
8340
8335
  var configKeys = Object.keys(config);
8341
8336
  var StyledBox = index$a(reactNative.View)(function (_ref5) {
8342
8337
  var theme = _ref5.theme,
8343
- otherProps = _objectWithoutProperties(_ref5, _excluded$i);
8338
+ otherProps = _objectWithoutProperties(_ref5, _excluded$j);
8344
8339
  var styleProps = pick(configKeys, otherProps);
8345
8340
  var flexProps = pick(_toConsumableArray(flexPropsKey), otherProps);
8346
8341
  return _objectSpread2(_objectSpread2({}, mapStylePropToThemeValue(theme, styleProps)), flexProps);
8347
8342
  });
8348
8343
 
8349
- var _excluded$h = ["children", "style", "testID"];
8344
+ var _excluded$i = ["children", "style", "testID"];
8350
8345
  var Box = function Box(_ref) {
8351
8346
  var children = _ref.children,
8352
8347
  style = _ref.style,
8353
8348
  testID = _ref.testID,
8354
- otherProps = _objectWithoutProperties(_ref, _excluded$h);
8349
+ otherProps = _objectWithoutProperties(_ref, _excluded$i);
8355
8350
  return /*#__PURE__*/React__default["default"].createElement(StyledBox, _extends$1({}, otherProps, {
8356
8351
  style: style,
8357
8352
  testID: testID
@@ -10821,15 +10816,16 @@ var Calendar = function Calendar(_ref) {
10821
10816
  visibleDate = _ref.visibleDate,
10822
10817
  onChange = _ref.onChange,
10823
10818
  _ref$onPreviousPress = _ref.onPreviousPress,
10824
- onPreviousPress = _ref$onPreviousPress === void 0 ? noop : _ref$onPreviousPress,
10819
+ onPreviousPress = _ref$onPreviousPress === void 0 ? noop$1 : _ref$onPreviousPress,
10825
10820
  _ref$onNextPress = _ref.onNextPress,
10826
- onNextPress = _ref$onNextPress === void 0 ? noop : _ref$onNextPress,
10821
+ onNextPress = _ref$onNextPress === void 0 ? noop$1 : _ref$onNextPress,
10827
10822
  _ref$onTitlePress = _ref.onTitlePress,
10828
- onTitlePress = _ref$onTitlePress === void 0 ? noop : _ref$onTitlePress,
10823
+ onTitlePress = _ref$onTitlePress === void 0 ? noop$1 : _ref$onTitlePress,
10829
10824
  minDate = _ref.minDate,
10830
10825
  maxDate = _ref.maxDate,
10831
10826
  _ref$markedDates = _ref.markedDates,
10832
- markedDates = _ref$markedDates === void 0 ? [] : _ref$markedDates;
10827
+ markedDates = _ref$markedDates === void 0 ? [] : _ref$markedDates,
10828
+ testID = _ref.testID;
10833
10829
  var currentMonth = visibleDate.getMonth();
10834
10830
  var currentYear = visibleDate.getFullYear();
10835
10831
  var now = new Date();
@@ -10860,7 +10856,9 @@ var Calendar = function Calendar(_ref) {
10860
10856
  var disableNextButton = maxDate === undefined ? false : !daysOfNextMonth.some(function (date) {
10861
10857
  return date !== undefined;
10862
10858
  }) || maxDate <= lastDateOfMonth;
10863
- return /*#__PURE__*/React__default["default"].createElement(StyledContainer$5, null, /*#__PURE__*/React__default["default"].createElement(StyledCalendarHeader, null, /*#__PURE__*/React__default["default"].createElement(ContentNavigator, {
10859
+ return /*#__PURE__*/React__default["default"].createElement(StyledContainer$5, {
10860
+ testID: testID
10861
+ }, /*#__PURE__*/React__default["default"].createElement(StyledCalendarHeader, null, /*#__PURE__*/React__default["default"].createElement(ContentNavigator, {
10864
10862
  value: formatTime('MMMM yyyy', visibleDate),
10865
10863
  onPreviousPress: onPreviousPress,
10866
10864
  onNextPress: onNextPress,
@@ -10916,7 +10914,7 @@ var Calendar = function Calendar(_ref) {
10916
10914
  })));
10917
10915
  };
10918
10916
 
10919
- var _excluded$g = ["rounded", "size", "testID", "style"];
10917
+ var _excluded$h = ["rounded", "size", "testID", "style"];
10920
10918
  var Image = function Image(_ref) {
10921
10919
  var _ref$rounded = _ref.rounded,
10922
10920
  rounded = _ref$rounded === void 0 ? false : _ref$rounded,
@@ -10924,7 +10922,7 @@ var Image = function Image(_ref) {
10924
10922
  size = _ref$size === void 0 ? '6xlarge' : _ref$size,
10925
10923
  testID = _ref.testID,
10926
10924
  style = _ref.style,
10927
- imageNativeProps = _objectWithoutProperties(_ref, _excluded$g);
10925
+ imageNativeProps = _objectWithoutProperties(_ref, _excluded$h);
10928
10926
  var theme = useTheme();
10929
10927
  var imageSize = theme.__hd__.image.sizes[size];
10930
10928
  return /*#__PURE__*/React__default["default"].createElement(reactNative.Image, _extends$1({
@@ -11054,8 +11052,19 @@ var StyledCarouselFooterWrapper = index$a(reactNative.View)(function (_ref5) {
11054
11052
  marginBottom: theme.__hd__.carousel.space.footerMarginBottom
11055
11053
  };
11056
11054
  });
11057
- var StyledPageControl$1 = index$a(PageControl)({
11058
- marginStart: 'auto'
11055
+ var StyledPageControl$1 = index$a(PageControl)(function (_ref6) {
11056
+ var theme = _ref6.theme;
11057
+ return {
11058
+ paddingVertical: theme.__hd__.carousel.space.pageControlPaddingVertical
11059
+ };
11060
+ });
11061
+ var StyledPageControlWrapper = index$a(reactNative.View)(function (_ref7) {
11062
+ var theme = _ref7.theme;
11063
+ return {
11064
+ alignItems: 'center',
11065
+ justifyContent: 'center',
11066
+ height: theme.__hd__.carousel.space.pageControlWrapperHeight
11067
+ };
11059
11068
  });
11060
11069
 
11061
11070
  function isCarouselImageProps(image) {
@@ -11117,12 +11126,12 @@ var Indicator = index$a(reactNative.View)(function (_ref2) {
11117
11126
  };
11118
11127
  });
11119
11128
 
11120
- var _excluded$f = ["intent", "children"];
11129
+ var _excluded$g = ["intent", "children"];
11121
11130
  var DataCard = function DataCard(_ref) {
11122
11131
  var _ref$intent = _ref.intent,
11123
11132
  intent = _ref$intent === void 0 ? 'info' : _ref$intent,
11124
11133
  children = _ref.children,
11125
- nativeProps = _objectWithoutProperties(_ref, _excluded$f);
11134
+ nativeProps = _objectWithoutProperties(_ref, _excluded$g);
11126
11135
  return /*#__PURE__*/React__default["default"].createElement(StyledDataCard, nativeProps, /*#__PURE__*/React__default["default"].createElement(Indicator, {
11127
11136
  themeIntent: intent,
11128
11137
  testID: "data-card-indicator"
@@ -11140,11 +11149,11 @@ var StyledCard$1 = index$a(reactNative.View)(function (_ref) {
11140
11149
  });
11141
11150
  });
11142
11151
 
11143
- var _excluded$e = ["intent", "children"];
11152
+ var _excluded$f = ["intent", "children"];
11144
11153
  var Card = function Card(_ref) {
11145
11154
  var intent = _ref.intent,
11146
11155
  children = _ref.children,
11147
- nativeProps = _objectWithoutProperties(_ref, _excluded$e);
11156
+ nativeProps = _objectWithoutProperties(_ref, _excluded$f);
11148
11157
  return /*#__PURE__*/React__default["default"].createElement(StyledCard$1, _extends$1({}, nativeProps, {
11149
11158
  themeIntent: intent
11150
11159
  }), children);
@@ -11332,7 +11341,7 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
11332
11341
  }));
11333
11342
  });
11334
11343
 
11335
- var _excluded$d = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "shouldShowPagination"];
11344
+ var _excluded$e = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "shouldShowPagination", "pageControlPosition"];
11336
11345
  function useStateFromProp(initialValue) {
11337
11346
  var _useState = React.useState(initialValue),
11338
11347
  _useState2 = _slicedToArray(_useState, 2),
@@ -11343,6 +11352,9 @@ function useStateFromProp(initialValue) {
11343
11352
  }, [initialValue]);
11344
11353
  return [value, setValue];
11345
11354
  }
11355
+ var noop = function noop(_) {
11356
+ return true;
11357
+ };
11346
11358
  var Carousel = function Carousel(_ref) {
11347
11359
  var items = _ref.items,
11348
11360
  onItemIndexChange = _ref.onItemIndexChange,
@@ -11351,10 +11363,12 @@ var Carousel = function Carousel(_ref) {
11351
11363
  selectedItemIndex = _ref$selectedItemInde === void 0 ? 0 : _ref$selectedItemInde,
11352
11364
  style = _ref.style,
11353
11365
  _ref$shouldShowPagina = _ref.shouldShowPagination,
11354
- shouldShowPagination = _ref$shouldShowPagina === void 0 ? function () {
11355
- return true;
11356
- } : _ref$shouldShowPagina,
11357
- nativeProps = _objectWithoutProperties(_ref, _excluded$d);
11366
+ shouldShowPagination = _ref$shouldShowPagina === void 0 ? noop : _ref$shouldShowPagina,
11367
+ _ref$pageControlPosit = _ref.pageControlPosition,
11368
+ pageControlPosition = _ref$pageControlPosit === void 0 ? 'bottom' : _ref$pageControlPosit,
11369
+ nativeProps = _objectWithoutProperties(_ref, _excluded$e);
11370
+ useDeprecation("shouldShowPagination prop has been deprecated", shouldShowPagination !== noop);
11371
+ useDeprecation("The use of 'pageControlPosition == bottom' has been deprecated", pageControlPosition !== 'bottom');
11358
11372
  var carouselRef = React.useRef(null);
11359
11373
  var _useStateFromProp = useStateFromProp(selectedItemIndex),
11360
11374
  _useStateFromProp2 = _slicedToArray(_useStateFromProp, 2),
@@ -11396,7 +11410,10 @@ var Carousel = function Carousel(_ref) {
11396
11410
  style: style
11397
11411
  }, nativeProps), /*#__PURE__*/React__default["default"].createElement(StyledBackDrop, {
11398
11412
  themeSlideBackground: items[currentSlideIndex].background
11399
- }), /*#__PURE__*/React__default["default"].createElement(StyledCarouselView, null, /*#__PURE__*/React__default["default"].createElement(reactNative.FlatList, {
11413
+ }), /*#__PURE__*/React__default["default"].createElement(StyledPageControlWrapper, null, pageControlPosition === 'top' && shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React__default["default"].createElement(StyledPageControl$1, {
11414
+ numberOfPages: items.length,
11415
+ currentPage: currentSlideIndex
11416
+ })), /*#__PURE__*/React__default["default"].createElement(StyledCarouselView, null, /*#__PURE__*/React__default["default"].createElement(reactNative.FlatList, {
11400
11417
  horizontal: true,
11401
11418
  showsHorizontalScrollIndicator: false,
11402
11419
  pagingEnabled: true,
@@ -11430,7 +11447,7 @@ var Carousel = function Carousel(_ref) {
11430
11447
  width: width
11431
11448
  });
11432
11449
  }
11433
- }), /*#__PURE__*/React__default["default"].createElement(StyledCarouselFooterWrapper, null, renderActions && renderActions(currentSlideIndex), shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React__default["default"].createElement(StyledPageControl$1, {
11450
+ }), /*#__PURE__*/React__default["default"].createElement(StyledCarouselFooterWrapper, null, renderActions && renderActions(currentSlideIndex), pageControlPosition === 'bottom' && shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React__default["default"].createElement(StyledPageControl$1, {
11434
11451
  numberOfPages: items.length,
11435
11452
  currentPage: currentSlideIndex
11436
11453
  }))));
@@ -11666,7 +11683,7 @@ var StyledErrorAndMaxLengthContainer = index$a(reactNative.View)(function () {
11666
11683
  };
11667
11684
  });
11668
11685
 
11669
- var _excluded$c = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "helpText", "value", "defaultValue", "renderInputValue", "allowFontScaling"];
11686
+ var _excluded$d = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "helpText", "value", "defaultValue", "renderInputValue", "allowFontScaling"];
11670
11687
  var getVariant$1 = function getVariant(_ref) {
11671
11688
  var disabled = _ref.disabled,
11672
11689
  error = _ref.error,
@@ -11714,7 +11731,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
11714
11731
  renderInputValue = _ref2.renderInputValue,
11715
11732
  _ref2$allowFontScalin = _ref2.allowFontScaling,
11716
11733
  allowFontScaling = _ref2$allowFontScalin === void 0 ? false : _ref2$allowFontScalin,
11717
- nativeProps = _objectWithoutProperties(_ref2, _excluded$c);
11734
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$d);
11718
11735
  var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
11719
11736
  var isEmptyValue = displayText.length === 0;
11720
11737
  var actualSuffix = loading ? 'loading' : suffix;
@@ -11947,6 +11964,110 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
11947
11964
  }) : null);
11948
11965
  };
11949
11966
 
11967
+ var InternalCalendar = function InternalCalendar(_ref) {
11968
+ var minDate = _ref.minDate,
11969
+ maxDate = _ref.maxDate,
11970
+ value = _ref.value,
11971
+ _onChange = _ref.onChange;
11972
+ var _useState = React.useState(value || new Date()),
11973
+ _useState2 = _slicedToArray(_useState, 2),
11974
+ visibleDate = _useState2[0],
11975
+ setVisibleDate = _useState2[1];
11976
+ var _useState3 = React.useState(value || new Date()),
11977
+ _useState4 = _slicedToArray(_useState3, 2),
11978
+ selectingDate = _useState4[0],
11979
+ setSelectingDate = _useState4[1];
11980
+ return /*#__PURE__*/React__default["default"].createElement(Calendar, {
11981
+ testID: "calendar",
11982
+ value: selectingDate,
11983
+ visibleDate: visibleDate,
11984
+ onChange: function onChange(date) {
11985
+ setSelectingDate(date);
11986
+ if (_onChange) {
11987
+ _onChange(date);
11988
+ }
11989
+ },
11990
+ onPreviousPress: function onPreviousPress() {
11991
+ return setVisibleDate(new Date(visibleDate.getFullYear(), visibleDate.getMonth() - 1, 1));
11992
+ },
11993
+ onNextPress: function onNextPress() {
11994
+ return setVisibleDate(new Date(visibleDate.getFullYear(), visibleDate.getMonth() + 1, 1));
11995
+ },
11996
+ minDate: minDate,
11997
+ maxDate: maxDate
11998
+ });
11999
+ };
12000
+ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
12001
+ var value = _ref2.value,
12002
+ _ref2$minDate = _ref2.minDate,
12003
+ minDate = _ref2$minDate === void 0 ? new Date('1900-01-01T00:00:00.000Z') : _ref2$minDate,
12004
+ _ref2$maxDate = _ref2.maxDate,
12005
+ maxDate = _ref2$maxDate === void 0 ? new Date('2100-01-01T00:00:00.000Z') : _ref2$maxDate,
12006
+ label = _ref2.label,
12007
+ placeholder = _ref2.placeholder,
12008
+ onChange = _ref2.onChange,
12009
+ confirmLabel = _ref2.confirmLabel,
12010
+ _ref2$displayFormat = _ref2.displayFormat,
12011
+ displayFormat = _ref2$displayFormat === void 0 ? 'dd/MM/yyyy' : _ref2$displayFormat,
12012
+ _ref2$disabled = _ref2.disabled,
12013
+ disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
12014
+ required = _ref2.required,
12015
+ error = _ref2.error,
12016
+ helpText = _ref2.helpText,
12017
+ style = _ref2.style,
12018
+ testID = _ref2.testID;
12019
+ var _useState5 = React.useState(false),
12020
+ _useState6 = _slicedToArray(_useState5, 2),
12021
+ open = _useState6[0],
12022
+ setOpen = _useState6[1];
12023
+ var _useState7 = React.useState(value || new Date()),
12024
+ _useState8 = _slicedToArray(_useState7, 2),
12025
+ selectingDate = _useState8[0],
12026
+ setSelectingDate = _useState8[1];
12027
+ var displayValue = value ? formatTime(displayFormat, value) : '';
12028
+ return /*#__PURE__*/React__default["default"].createElement(reactNative.TouchableOpacity, {
12029
+ onPress: function onPress() {
12030
+ return setOpen(true);
12031
+ },
12032
+ disabled: disabled
12033
+ }, /*#__PURE__*/React__default["default"].createElement(reactNative.View, {
12034
+ pointerEvents: "none",
12035
+ testID: "datePickerCalendar"
12036
+ }, /*#__PURE__*/React__default["default"].createElement(TextInput, {
12037
+ label: label,
12038
+ value: displayValue,
12039
+ suffix: "calendar-dates-outlined",
12040
+ placeholder: placeholder || displayFormat,
12041
+ disabled: disabled,
12042
+ error: error,
12043
+ required: required,
12044
+ helpText: helpText,
12045
+ testID: testID,
12046
+ style: style
12047
+ })), /*#__PURE__*/React__default["default"].createElement(BottomSheet$1, {
12048
+ open: open,
12049
+ onRequestClose: function onRequestClose() {
12050
+ return setOpen(false);
12051
+ },
12052
+ header: label,
12053
+ footer: /*#__PURE__*/React__default["default"].createElement(CompoundButton, {
12054
+ variant: "text",
12055
+ text: confirmLabel,
12056
+ onPress: function onPress() {
12057
+ if (selectingDate) {
12058
+ onChange(selectingDate);
12059
+ }
12060
+ setOpen(false);
12061
+ }
12062
+ })
12063
+ }, /*#__PURE__*/React__default["default"].createElement(InternalCalendar, {
12064
+ minDate: minDate,
12065
+ maxDate: maxDate,
12066
+ value: value,
12067
+ onChange: setSelectingDate
12068
+ })));
12069
+ };
12070
+
11950
12071
  var StyledPickerWrapper$1 = index$a(reactNative.View)(function (_ref) {
11951
12072
  var theme = _ref.theme;
11952
12073
  return {
@@ -12035,7 +12156,14 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
12035
12156
  }))));
12036
12157
  };
12037
12158
 
12038
- var DatePicker = function DatePicker(props) {
12159
+ var _excluded$c = ["variant"];
12160
+ var DatePicker = function DatePicker(_ref) {
12161
+ var _ref$variant = _ref.variant,
12162
+ variant = _ref$variant === void 0 ? 'default' : _ref$variant,
12163
+ props = _objectWithoutProperties(_ref, _excluded$c);
12164
+ if (variant === 'calendar') {
12165
+ return /*#__PURE__*/React__default["default"].createElement(DatePickerCalendar, props);
12166
+ }
12039
12167
  if (reactNative.Platform.OS === 'ios') {
12040
12168
  return /*#__PURE__*/React__default["default"].createElement(DatePickerIOS, props);
12041
12169
  }
@@ -15596,7 +15724,9 @@ var Toast$1 = function Toast(_ref2) {
15596
15724
  autoDismiss = _ref2$autoDismiss === void 0 ? true : _ref2$autoDismiss,
15597
15725
  onAction = _ref2.onAction,
15598
15726
  actionLabel = _ref2.actionLabel,
15599
- onDismiss = _ref2.onDismiss;
15727
+ onDismiss = _ref2.onDismiss,
15728
+ _ref2$distance = _ref2.distance,
15729
+ distance = _ref2$distance === void 0 ? 0 : _ref2$distance;
15600
15730
  var animatedValue = React.useRef(new reactNative.Animated.Value(0)).current;
15601
15731
  var toastConfig = useToastConfig();
15602
15732
  React.useEffect(function () {
@@ -15624,7 +15754,7 @@ var Toast$1 = function Toast(_ref2) {
15624
15754
  });
15625
15755
  var interpolateY = animatedValue.interpolate({
15626
15756
  inputRange: [0, 1],
15627
- outputRange: [toastConfig.position === 'top' ? -20 : 20, 0]
15757
+ outputRange: toastConfig.position === 'top' ? [-20, distance] : [20, -distance]
15628
15758
  });
15629
15759
  return /*#__PURE__*/React__default["default"].createElement(Container, {
15630
15760
  themeVariant: variant,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.20.0",
3
+ "version": "8.21.0",
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.20.0",
24
+ "@hero-design/colors": "8.21.0",
25
25
  "date-fns": "^2.16.1",
26
26
  "events": "^3.2.0",
27
27
  "hero-editor": "^1.9.21"
@@ -45,7 +45,7 @@
45
45
  "@babel/preset-typescript": "^7.17.12",
46
46
  "@babel/runtime": "^7.18.9",
47
47
  "@emotion/jest": "^11.9.3",
48
- "@hero-design/eslint-plugin": "8.20.0",
48
+ "@hero-design/eslint-plugin": "8.21.0",
49
49
  "@react-native-community/datetimepicker": "^3.5.2",
50
50
  "@react-native-community/slider": "4.1.12",
51
51
  "@rollup/plugin-babel": "^5.3.1",
@@ -61,9 +61,9 @@
61
61
  "@types/react-native": "^0.67.7",
62
62
  "@types/react-native-vector-icons": "^6.4.10",
63
63
  "babel-plugin-inline-import": "^3.0.0",
64
- "eslint-config-hd": "8.20.0",
64
+ "eslint-config-hd": "8.21.0",
65
65
  "jest": "^27.3.1",
66
- "prettier-config-hd": "8.20.0",
66
+ "prettier-config-hd": "8.21.0",
67
67
  "react": "18.0.0",
68
68
  "react-native": "0.69.7",
69
69
  "react-native-gesture-handler": "~2.1.0",
@@ -178,9 +178,9 @@ const Button = ({
178
178
  </StyledButtonIconWrapper>
179
179
  )}
180
180
  <StyledButtonText
181
- disabled={disabled}
182
181
  ellipsizeMode="tail"
183
182
  numberOfLines={1}
183
+ disabled={disabled}
184
184
  themeVariant={themeVariant}
185
185
  >
186
186
  {text}
@@ -93,7 +93,6 @@ const genOutlineTextStyles = (
93
93
 
94
94
  return {
95
95
  fontSize: theme.__hd__.button.fontSize.default,
96
- lineHeight: theme.__hd__.button.lineHeight.default,
97
96
  ...textColorStyling(),
98
97
  };
99
98
  };
@@ -115,7 +114,6 @@ const genTextVariantTextStyles = (
115
114
 
116
115
  return {
117
116
  fontSize: theme.__hd__.button.fontSize.textVariant,
118
- lineHeight: theme.__hd__.button.lineHeight.default,
119
117
  ...textColorStyling(),
120
118
  };
121
119
  };
@@ -166,7 +164,6 @@ const StyledButtonText = styled(Typography.Text)<{
166
164
  case 'filled-danger':
167
165
  return {
168
166
  fontSize: theme.__hd__.button.fontSize.default,
169
- lineHeight: theme.__hd__.button.lineHeight.default,
170
167
  color: theme.__hd__.button.colors.invertedText,
171
168
  };
172
169
  case 'outlined-primary':