@hero-design/rn 8.36.2 → 8.37.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 (41) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/es/index.js +54 -90
  3. package/lib/index.js +54 -90
  4. package/package.json +7 -7
  5. package/src/components/Carousel/StyledCardCarousel.tsx +1 -1
  6. package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +8 -8
  7. package/src/components/Checkbox/StyledCheckbox.tsx +7 -14
  8. package/src/components/Checkbox/__tests__/StyledCheckbox.spec.tsx +8 -12
  9. package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +4 -88
  10. package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +12 -324
  11. package/src/components/Checkbox/__tests__/index.spec.tsx +7 -12
  12. package/src/components/Checkbox/index.tsx +7 -1
  13. package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
  14. package/src/components/Drawer/index.tsx +3 -3
  15. package/src/components/FAB/ActionGroup/StyledActionGroup.tsx +4 -15
  16. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +18 -48
  17. package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +36 -29
  18. package/src/components/FAB/ActionGroup/index.tsx +18 -29
  19. package/src/components/FAB/StyledFAB.tsx +1 -1
  20. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +4 -4
  21. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
  22. package/src/components/List/StyledListItem.tsx +5 -5
  23. package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +6 -6
  24. package/src/components/TextInput/__tests__/StyledTextInput.spec.tsx +2 -2
  25. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +5 -14
  26. package/src/components/Toast/StyledToast.tsx +1 -1
  27. package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +7 -7
  28. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +20 -23
  29. package/src/theme/components/cardCarousel.ts +5 -5
  30. package/src/theme/components/fab.ts +5 -11
  31. package/src/theme/components/list.ts +7 -4
  32. package/src/theme/components/toast.ts +5 -5
  33. package/src/theme/global/shadows.ts +3 -3
  34. package/types/components/Checkbox/StyledCheckbox.d.ts +0 -1
  35. package/types/components/Checkbox/index.d.ts +1 -0
  36. package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +2 -7
  37. package/types/components/FAB/ActionGroup/index.d.ts +5 -0
  38. package/types/theme/components/cardCarousel.d.ts +1 -1
  39. package/types/theme/components/fab.d.ts +1 -7
  40. package/types/theme/components/list.d.ts +9 -6
  41. package/types/theme/components/toast.d.ts +1 -1
@@ -4,5 +4,5 @@ $ rollup -c
4
4
  src/index.ts → lib/index.js, es/index.js...
5
5
  (!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
6
6
  (!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
7
- created lib/index.js, es/index.js in 26.5s
7
+ created lib/index.js, es/index.js in 26.2s
8
8
  $ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
package/es/index.js CHANGED
@@ -1669,10 +1669,10 @@ var getShadows = function getShadows(systemPalette) {
1669
1669
  width: 0,
1670
1670
  height: 2
1671
1671
  },
1672
- shadowColor: systemPalette.secondaryOutline,
1673
- shadowOpacity: 1,
1672
+ shadowColor: systemPalette.primaryOutline,
1673
+ shadowOpacity: 0.12,
1674
1674
  shadowRadius: 4,
1675
- elevation: 10
1675
+ elevation: 3
1676
1676
  }
1677
1677
  };
1678
1678
  };
@@ -2095,17 +2095,14 @@ var getCardCarouselTheme = function getCardCarouselTheme(theme) {
2095
2095
  contentContainerPaddingHorizontal: theme.space.large
2096
2096
  };
2097
2097
  var colors = {
2098
- shadow: theme.colors.primaryOutline,
2099
2098
  carouselItemBackground: theme.colors.defaultSurface
2100
2099
  };
2101
2100
  var shadows = {
2102
- offset: {
2103
- width: 0,
2104
- height: 2
2105
- },
2106
- opacity: 0.12,
2107
- radius: theme.radii.medium,
2108
- elevation: 4
2101
+ color: theme.shadows["default"].shadowColor,
2102
+ offset: theme.shadows["default"].shadowOffset,
2103
+ opacity: theme.shadows["default"].shadowOpacity,
2104
+ radius: theme.shadows["default"].shadowRadius,
2105
+ elevation: theme.shadows["default"].elevation
2109
2106
  };
2110
2107
  var radii = {
2111
2108
  card: theme.radii.medium
@@ -2307,13 +2304,11 @@ var getFABTheme = function getFABTheme(theme) {
2307
2304
  buttonPressedBackground: theme.colors.pressedSurface,
2308
2305
  buttonActiveBackground: theme.colors.pressedSurface,
2309
2306
  icon: theme.colors.onPrimary,
2310
- headerText: theme.colors.onDefaultGlobalSurface,
2311
2307
  actionItemBackground: theme.colors.secondary,
2312
2308
  actionItemPressedBackground: theme.colors.pressedSurface,
2313
2309
  backdropBackground: theme.colors.overlayGlobalSurface,
2314
2310
  titleText: theme.colors.onPrimary,
2315
- actionItemText: theme.colors.onPrimary,
2316
- shadow: theme.colors.primaryOutline
2311
+ actionItemText: theme.colors.onPrimary
2317
2312
  };
2318
2313
  var sizes = {
2319
2314
  width: theme.sizes.xxxxxlarge,
@@ -2322,29 +2317,24 @@ var getFABTheme = function getFABTheme(theme) {
2322
2317
  iconContainerHeight: theme.sizes.large
2323
2318
  };
2324
2319
  var fonts = {
2325
- header: theme.fonts.neutral.semiBold,
2326
2320
  actionItemText: theme.fonts.neutral.regular,
2327
2321
  title: theme.fonts.neutral.semiBold
2328
2322
  };
2329
2323
  var fontSizes = {
2330
- header: theme.fontSizes.xxxlarge,
2331
2324
  actionItemText: theme.fontSizes.large,
2332
2325
  title: theme.fontSizes.large
2333
2326
  };
2334
2327
  var lineHeights = {
2335
- header: theme.lineHeights.xxxlarge,
2336
2328
  actionItemText: theme.lineHeights.medium,
2337
2329
  title: theme.lineHeights.large,
2338
2330
  icon: theme.lineHeights.large
2339
2331
  };
2340
2332
  var shadows = {
2341
- offset: {
2342
- width: 0,
2343
- height: 2
2344
- },
2345
- opacity: 0.12,
2346
- radius: theme.radii.medium,
2347
- elevation: 2
2333
+ offset: theme.shadows["default"].shadowOffset,
2334
+ opacity: theme.shadows["default"].shadowOpacity,
2335
+ radius: theme.shadows["default"].shadowRadius,
2336
+ elevation: theme.shadows["default"].elevation,
2337
+ color: theme.shadows["default"].shadowColor
2348
2338
  };
2349
2339
  var space = {
2350
2340
  actionItemPadding: theme.space.smallMedium,
@@ -2353,8 +2343,6 @@ var getFABTheme = function getFABTheme(theme) {
2353
2343
  actionItemTextPaddingLeft: theme.space.xsmall,
2354
2344
  buttonMarginTop: theme.space.large,
2355
2345
  buttonMarginRight: theme.space.large,
2356
- headerTextMarginRight: theme.space.large,
2357
- headerTextMarginBottom: theme.space.large,
2358
2346
  containerPadding: theme.space.large - theme.space.xsmall,
2359
2347
  titleMarginHorizontal: theme.space.small
2360
2348
  };
@@ -2429,20 +2417,23 @@ var getListTheme = function getListTheme(theme) {
2429
2417
  var radii = {
2430
2418
  item: theme.radii.medium,
2431
2419
  basicItem: theme.radii.base,
2432
- cardShadow: theme.radii.base,
2433
2420
  leadingStatus: theme.radii.rounded
2434
2421
  };
2435
2422
  var shadows = {
2436
- cardOffset: theme.shadows["default"].shadowOffset,
2437
- cardElevation: theme.shadows["default"].elevation
2423
+ card: {
2424
+ offset: theme.shadows["default"].shadowOffset,
2425
+ elevation: theme.shadows["default"].elevation,
2426
+ color: theme.shadows["default"].shadowColor,
2427
+ radius: theme.shadows["default"].shadowRadius,
2428
+ opacity: theme.shadows["default"].shadowOpacity
2429
+ }
2438
2430
  };
2439
2431
  var widths = {
2440
2432
  leadingStatus: 8
2441
2433
  };
2442
2434
  var opacity = {
2443
2435
  disabled: 0.38,
2444
- enabled: 1,
2445
- cardShadow: theme.shadows["default"].shadowOpacity
2436
+ enabled: 1
2446
2437
  };
2447
2438
  return {
2448
2439
  colors: colors,
@@ -3046,8 +3037,7 @@ var getToastTheme = function getToastTheme(theme) {
3046
3037
  info: theme.colors.info,
3047
3038
  notification: theme.colors.defaultGlobalSurface,
3048
3039
  snackbar: theme.colors.darkGlobalSurface,
3049
- divider: theme.colors.secondaryOutline,
3050
- shadow: theme.colors.primaryOutline
3040
+ divider: theme.colors.secondaryOutline
3051
3041
  };
3052
3042
  var sizes = {
3053
3043
  height: theme.sizes.xxxlarge
@@ -3067,13 +3057,11 @@ var getToastTheme = function getToastTheme(theme) {
3067
3057
  base: theme.borderWidths.base
3068
3058
  };
3069
3059
  var shadows = {
3070
- offset: {
3071
- width: 0,
3072
- height: 2
3073
- },
3074
- opacity: 0.12,
3075
- radius: 4,
3076
- elevation: 4
3060
+ offset: theme.shadows["default"].shadowOffset,
3061
+ opacity: theme.shadows["default"].shadowOpacity,
3062
+ radius: theme.shadows["default"].shadowRadius,
3063
+ elevation: theme.shadows["default"].elevation,
3064
+ color: theme.shadows["default"].shadowColor
3077
3065
  };
3078
3066
  return {
3079
3067
  colors: colors,
@@ -7850,7 +7838,7 @@ var Divider = function Divider(_ref) {
7850
7838
  }));
7851
7839
  };
7852
7840
 
7853
- var AnimatedPressable$1 = Animated.createAnimatedComponent(Pressable);
7841
+ var AnimatedPressable$2 = Animated.createAnimatedComponent(Pressable);
7854
7842
  var AnimatedSafeAreaView = Animated.createAnimatedComponent(SafeAreaView);
7855
7843
  var StyledWrapper$9 = index$c(View)(_objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
7856
7844
  flexDirection: 'column-reverse'
@@ -7876,7 +7864,7 @@ var StyledBottomSheet = index$c(AnimatedSafeAreaView)(function (_ref) {
7876
7864
  maxHeight: '94%'
7877
7865
  };
7878
7866
  });
7879
- var StyledBackdrop$2 = index$c(AnimatedPressable$1)(function (_ref2) {
7867
+ var StyledBackdrop$2 = index$c(AnimatedPressable$2)(function (_ref2) {
7880
7868
  var theme = _ref2.theme;
7881
7869
  return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
7882
7870
  backgroundColor: theme.__hd__.bottomSheet.colors.backdrop,
@@ -11705,7 +11693,7 @@ var StyledShadow = index$c(View)(function (_ref3) {
11705
11693
  var theme = _ref3.theme;
11706
11694
  return {
11707
11695
  borderRadius: theme.__hd__.cardCarousel.radii.card,
11708
- shadowColor: theme.__hd__.cardCarousel.colors.shadow,
11696
+ shadowColor: theme.__hd__.cardCarousel.shadows.color,
11709
11697
  shadowOffset: theme.__hd__.cardCarousel.shadows.offset,
11710
11698
  shadowRadius: theme.__hd__.cardCarousel.shadows.radius,
11711
11699
  shadowOpacity: theme.__hd__.cardCarousel.shadows.opacity,
@@ -12006,17 +11994,14 @@ var index$a = Object.assign(Carousel, {
12006
11994
 
12007
11995
  var StyledWrapper$7 = index$c(TouchableOpacity)(function (_ref) {
12008
11996
  var theme = _ref.theme,
12009
- themeWithBorder = _ref.themeWithBorder,
12010
11997
  themeState = _ref.themeState;
12011
- var borderStyle = {
11998
+ return {
11999
+ flexDirection: 'row',
12012
12000
  borderRadius: theme.__hd__.checkbox.radii.wrapper,
12013
12001
  borderWidth: theme.__hd__.checkbox.borderWidths.wrapper,
12014
12002
  padding: theme.__hd__.checkbox.space.wrapperPadding,
12015
12003
  borderColor: theme.__hd__.checkbox.colors.borders[themeState]
12016
12004
  };
12017
- return _objectSpread2({
12018
- flexDirection: 'row'
12019
- }, themeWithBorder && borderStyle);
12020
12005
  });
12021
12006
  var StyledDescription$1 = index$c(Typography.Body)(function (_ref2) {
12022
12007
  var theme = _ref2.theme;
@@ -12076,6 +12061,7 @@ var Checkbox = function Checkbox(_ref2) {
12076
12061
  testID = _ref2.testID,
12077
12062
  _ref2$readonly = _ref2.readonly,
12078
12063
  readonly = _ref2$readonly === void 0 ? false : _ref2$readonly;
12064
+ useDeprecation("Checkbox's withBorder prop will be removed in the next major release, all checkboxes will have border by default. Please remove it.", withBorder === true);
12079
12065
  var themeState = getThemeState({
12080
12066
  disabled: disabled,
12081
12067
  readonly: readonly
@@ -12083,7 +12069,6 @@ var Checkbox = function Checkbox(_ref2) {
12083
12069
  return /*#__PURE__*/React.createElement(StyledWrapper$7, {
12084
12070
  onPress: onPress,
12085
12071
  disabled: disabled || readonly,
12086
- themeWithBorder: withBorder,
12087
12072
  themeState: themeState,
12088
12073
  style: style,
12089
12074
  testID: testID
@@ -12770,7 +12755,7 @@ var DatePicker = function DatePicker(_ref) {
12770
12755
  return /*#__PURE__*/React.createElement(DatePickerAndroid, props);
12771
12756
  };
12772
12757
 
12773
- var AnimatedPressable = Animated.createAnimatedComponent(Pressable);
12758
+ var AnimatedPressable$1 = Animated.createAnimatedComponent(Pressable);
12774
12759
  var StyledContainer$3 = index$c(View)(function (_ref) {
12775
12760
  var theme = _ref.theme,
12776
12761
  enableShadow = _ref.enableShadow;
@@ -12798,7 +12783,7 @@ var StyledDragableContainer = index$c(View)(function (_ref2) {
12798
12783
  flexDirection: 'column-reverse'
12799
12784
  });
12800
12785
  });
12801
- var StyledBackdrop$1 = index$c(AnimatedPressable)(function (_ref3) {
12786
+ var StyledBackdrop$1 = index$c(AnimatedPressable$1)(function (_ref3) {
12802
12787
  var theme = _ref3.theme;
12803
12788
  return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
12804
12789
  backgroundColor: theme.__hd__.drawer.colors.backdrop
@@ -13006,7 +12991,7 @@ var Drawer = function Drawer(_ref) {
13006
12991
  onDismiss = _ref.onDismiss,
13007
12992
  testID = _ref.testID;
13008
12993
  var animatedValue = useRef(new Animated.Value(visible ? 1 : 0)).current;
13009
- var _useState = useState(0),
12994
+ var _useState = useState(Dimensions.get('window').height),
13010
12995
  _useState2 = _slicedToArray(_useState, 2),
13011
12996
  height = _useState2[0],
13012
12997
  setHeight = _useState2[1];
@@ -13345,7 +13330,7 @@ var StyledFAB$1 = index$c(TouchableHighlight)(function (_ref) {
13345
13330
  padding: theme.__hd__.fab.space.containerPadding,
13346
13331
  flexDirection: 'row',
13347
13332
  elevation: theme.__hd__.fab.shadows.elevation,
13348
- shadowColor: theme.__hd__.fab.colors.shadow,
13333
+ shadowColor: theme.__hd__.fab.shadows.color,
13349
13334
  shadowOffset: theme.__hd__.fab.shadows.offset,
13350
13335
  shadowRadius: theme.__hd__.fab.shadows.radius,
13351
13336
  shadowOpacity: theme.__hd__.fab.shadows.opacity
@@ -13624,7 +13609,8 @@ var StyledFAB = index$c(FAB)(function (_ref) {
13624
13609
  alignSelf: 'flex-end'
13625
13610
  };
13626
13611
  });
13627
- var StyledBackdrop = index$c(Animated.View)(function (_ref2) {
13612
+ var AnimatedPressable = Animated.createAnimatedComponent(Pressable);
13613
+ var StyledBackdrop = index$c(AnimatedPressable)(function (_ref2) {
13628
13614
  var theme = _ref2.theme;
13629
13615
  return {
13630
13616
  position: 'absolute',
@@ -13636,15 +13622,6 @@ var StyledBackdrop = index$c(Animated.View)(function (_ref2) {
13636
13622
  backgroundColor: theme.__hd__.fab.colors.backdropBackground
13637
13623
  };
13638
13624
  });
13639
- var StyledHeaderText = index$c(Typography.Title)(function (_ref3) {
13640
- var theme = _ref3.theme;
13641
- return {
13642
- color: theme.__hd__.fab.colors.headerText,
13643
- marginRight: theme.__hd__.fab.space.headerTextMarginRight,
13644
- marginBottom: theme.__hd__.fab.space.headerTextMarginBottom,
13645
- textAlign: 'right'
13646
- };
13647
- });
13648
13625
 
13649
13626
  var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13650
13627
  var headerTitle = _ref.headerTitle,
@@ -13654,15 +13631,12 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13654
13631
  items = _ref.items,
13655
13632
  testID = _ref.testID,
13656
13633
  fabTitle = _ref.fabTitle,
13634
+ onBackdropPress = _ref.onBackdropPress,
13657
13635
  _ref$fabIcon = _ref.fabIcon,
13658
13636
  fabIcon = _ref$fabIcon === void 0 ? 'add' : _ref$fabIcon;
13637
+ useDeprecation("FAB.ActionGroup's headerTitle prop will be removed in the next major release. Please remove it.", headerTitle !== undefined);
13659
13638
  var fabRef = useRef(null);
13660
13639
  var tranlateXAnimation = useRef(new Animated.Value(active ? 1 : 0));
13661
- var titleTranslateYValue = React.useRef(new Animated.Value(0));
13662
- var titleTranslateY = titleTranslateYValue.current.interpolate({
13663
- inputRange: [0, 1],
13664
- outputRange: [50, 0]
13665
- });
13666
13640
  React.useImperativeHandle(ref, function () {
13667
13641
  return {
13668
13642
  showFAB: function showFAB() {
@@ -13680,13 +13654,10 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13680
13654
  };
13681
13655
  }, [fabRef]);
13682
13656
  React.useEffect(function () {
13683
- Animated.parallel([Animated.spring(tranlateXAnimation.current, {
13684
- toValue: active ? 1 : 0,
13685
- useNativeDriver: Platform.OS !== 'web'
13686
- }), Animated.spring(titleTranslateYValue.current, {
13657
+ Animated.spring(tranlateXAnimation.current, {
13687
13658
  toValue: active ? 1 : 0,
13688
13659
  useNativeDriver: Platform.OS !== 'web'
13689
- })]).start();
13660
+ }).start();
13690
13661
  }, [active]);
13691
13662
  var interpolatedActionGroupOpacityAnimation = tranlateXAnimation.current.interpolate({
13692
13663
  inputRange: [0, 1],
@@ -13722,22 +13693,15 @@ var ActionGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
13722
13693
  testID: testID,
13723
13694
  style: [style]
13724
13695
  }, /*#__PURE__*/React.createElement(StyledBackdrop, {
13725
- testID: "back-drop"
13696
+ testID: "back-drop",
13697
+ onPress: onBackdropPress
13726
13698
  }), /*#__PURE__*/React.createElement(StyledActionGroupContainer, {
13727
13699
  testID: "action-group",
13700
+ pointerEvents: "box-none",
13728
13701
  style: {
13729
13702
  opacity: interpolatedActionGroupOpacityAnimation
13730
13703
  }
13731
- }, !!headerTitle && /*#__PURE__*/React.createElement(Animated.View, {
13732
- style: {
13733
- transform: [{
13734
- translateY: titleTranslateY
13735
- }]
13736
- }
13737
- }, /*#__PURE__*/React.createElement(StyledHeaderText, {
13738
- testID: "header-text",
13739
- level: "h4"
13740
- }, headerTitle)), /*#__PURE__*/React.createElement(Box, {
13704
+ }, /*#__PURE__*/React.createElement(Box, {
13741
13705
  style: [style, {
13742
13706
  paddingBottom: 0
13743
13707
  }]
@@ -13782,11 +13746,11 @@ var StyledListItemContainer$1 = index$c(TouchableHighlight)(function (_ref) {
13782
13746
  case 'card':
13783
13747
  return _objectSpread2(_objectSpread2({}, sharedStyles), {}, {
13784
13748
  alignItems: 'center',
13785
- shadowColor: theme.colors.secondaryOutline,
13786
- shadowRadius: theme.__hd__.list.radii.cardShadow,
13787
- shadowOffset: theme.__hd__.list.shadows.cardOffset,
13788
- shadowOpacity: theme.__hd__.list.opacity.cardShadow,
13789
- elevation: theme.__hd__.list.shadows.cardElevation
13749
+ shadowColor: theme.__hd__.list.shadows.card.color,
13750
+ shadowRadius: theme.__hd__.list.shadows.card.radius,
13751
+ shadowOffset: theme.__hd__.list.shadows.card.offset,
13752
+ shadowOpacity: theme.__hd__.list.shadows.card.opacity,
13753
+ elevation: theme.__hd__.list.shadows.card.elevation
13790
13754
  });
13791
13755
  default:
13792
13756
  return sharedStyles;
@@ -16886,7 +16850,7 @@ var Container = index$c(Animated.View)(function (_ref2) {
16886
16850
  backgroundColor: theme.__hd__.toast.colors[themeIntent],
16887
16851
  minHeight: theme.__hd__.toast.sizes.height,
16888
16852
  flexDirection: 'row',
16889
- shadowColor: theme.__hd__.toast.colors.shadow,
16853
+ shadowColor: theme.__hd__.toast.shadows.color,
16890
16854
  shadowOffset: theme.__hd__.toast.shadows.offset,
16891
16855
  shadowRadius: theme.__hd__.toast.shadows.radius,
16892
16856
  shadowOpacity: theme.__hd__.toast.shadows.opacity,