@hero-design/rn 8.85.0 → 8.87.1-alpha.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 (45) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/es/index.js +122 -33
  3. package/lib/index.js +122 -33
  4. package/package.json +1 -1
  5. package/src/components/Button/Button.tsx +22 -6
  6. package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +8 -2
  7. package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +3 -0
  8. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +139 -1
  9. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +408 -3
  10. package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +3 -0
  11. package/src/components/Button/LoadingIndicator/index.tsx +4 -1
  12. package/src/components/Button/StyledButton.tsx +95 -5
  13. package/src/components/Button/__tests__/Button.spec.tsx +12 -0
  14. package/src/components/Button/__tests__/StyledButton.spec.tsx +10 -0
  15. package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +1240 -90
  16. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +630 -40
  17. package/src/components/Carousel/CardCarousel.tsx +7 -2
  18. package/src/components/Carousel/StyledCardCarousel.tsx +6 -2
  19. package/src/components/Carousel/__tests__/CardCarousel.spec.tsx +28 -1
  20. package/src/components/Carousel/__tests__/StyledCardCarousel.spec.tsx +7 -2
  21. package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +1799 -1
  22. package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +86 -1
  23. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +10 -1
  24. package/src/theme/components/button.ts +5 -0
  25. package/src/theme/components/cardCarousel.ts +5 -1
  26. package/stats/8.86.0/rn-stats.html +4842 -0
  27. package/stats/8.87.0/rn-stats.html +4844 -0
  28. package/stats/8.87.1/rn-stats.html +4842 -0
  29. package/types/components/Button/Button.d.ts +1 -1
  30. package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +1 -1
  31. package/types/components/Button/LoadingIndicator/index.d.ts +1 -1
  32. package/types/components/Button/StyledButton.d.ts +3 -3
  33. package/types/components/Carousel/CardCarousel.d.ts +4 -0
  34. package/types/components/Carousel/StyledCardCarousel.d.ts +2 -0
  35. package/types/components/CompoundSearch/CompoundSearchHandler.d.ts +31 -0
  36. package/types/components/CompoundSearch/CompoundSearchTextInput.d.ts +60 -0
  37. package/types/components/CompoundSearch/StyledCompoundSearch.d.ts +40 -0
  38. package/types/components/CompoundSearch/index.d.ts +8 -0
  39. package/types/components/CompoundSearch/utils.d.ts +8 -0
  40. package/types/components/FloatingIsland/SingleLine/StyledSingleLine.d.ts +15 -0
  41. package/types/components/FloatingIsland/SingleLine/index.d.ts +24 -0
  42. package/types/theme/components/button.d.ts +5 -0
  43. package/types/theme/components/cardCarousel.d.ts +5 -1
  44. package/types/theme/components/compoundSearch.d.ts +36 -0
  45. package/.turbo/turbo-build.log +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.87.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3619](https://github.com/Thinkei/hero-design/pull/3619) [`88bfafcf9fc3dcaea7fd5ce14c29c03f3b9e80d2`](https://github.com/Thinkei/hero-design/commit/88bfafcf9fc3dcaea7fd5ce14c29c03f3b9e80d2) Thanks [@sonnguyen-eh](https://github.com/sonnguyen-eh)! - Bump hero-editor to 1.15.4, create new events and expose new functions in RichTextEditor
8
+
9
+ ## 8.87.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#3620](https://github.com/Thinkei/hero-design/pull/3620) [`5a7779f2a1283c746bd918e5f3fd35fec8471369`](https://github.com/Thinkei/hero-design/commit/5a7779f2a1283c746bd918e5f3fd35fec8471369) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Carousel.Card] Support gap prop
14
+
15
+ ## 8.86.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#3609](https://github.com/Thinkei/hero-design/pull/3609) [`6cb53946a493e6550c0bdd2b0c2c0fb683e4e77b`](https://github.com/Thinkei/hero-design/commit/6cb53946a493e6550c0bdd2b0c2c0fb683e4e77b) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Button] Add white intent
20
+
3
21
  ## 8.85.0
4
22
 
5
23
  ### Minor Changes
package/es/index.js CHANGED
@@ -2511,6 +2511,7 @@ var getButtonTheme = function getButtonTheme(theme) {
2511
2511
  primary: theme.colors.primary,
2512
2512
  secondary: theme.colors.mutedOnDefaultGlobalSurface,
2513
2513
  danger: theme.colors.onErrorSurface,
2514
+ white: theme.colors.defaultGlobalSurface,
2514
2515
  defaultText: theme.colors.onDefaultGlobalSurface,
2515
2516
  disabledText: theme.colors.disabledOnDefaultGlobalSurface,
2516
2517
  disabledBorder: theme.colors.disabledOnDefaultGlobalSurface,
@@ -2522,17 +2523,21 @@ var getButtonTheme = function getButtonTheme(theme) {
2522
2523
  filledPrimary: theme.colors.pressedSurface,
2523
2524
  filledSecondary: theme.colors.pressedSurface,
2524
2525
  filledDanger: theme.colors.errorSurface,
2526
+ filledWhite: theme.colors.highlightedSurface,
2525
2527
  outlinedPrimary: theme.colors.highlightedSurface,
2526
2528
  outlinedSecondary: theme.colors.highlightedSurface,
2527
2529
  outlineDanger: theme.colors.errorSurface,
2530
+ outlineWhite: theme.colors.pressedSurface,
2528
2531
  textPrimary: theme.colors.highlightedSurface,
2529
2532
  textSecondary: theme.colors.neutralGlobalSurface,
2530
- textDanger: theme.colors.errorSurface
2533
+ textDanger: theme.colors.errorSurface,
2534
+ textWhite: theme.colors.pressedSurface
2531
2535
  },
2532
2536
  pressedText: {
2533
2537
  primary: theme.colors.pressedSurface,
2534
2538
  secondary: theme.colors.onDefaultGlobalSurface,
2535
- danger: theme.colors.mutedError
2539
+ danger: theme.colors.mutedError,
2540
+ white: theme.colors.pressedSurface
2536
2541
  }
2537
2542
  };
2538
2543
  var lineHeights = {
@@ -2639,8 +2644,12 @@ var getCarouselTheme = function getCarouselTheme(theme) {
2639
2644
  var getCardCarouselTheme = function getCardCarouselTheme(theme) {
2640
2645
  var space = {
2641
2646
  pageControlMarginTop: theme.space.medium,
2642
- carouselItemSpacing: theme.space.small,
2643
- contentContainerPaddingHorizontal: theme.space.large
2647
+ contentContainerPaddingHorizontal: theme.space.large,
2648
+ carouselItemSpacing: {
2649
+ xsmall: theme.space.xxsmall,
2650
+ small: theme.space.xsmall,
2651
+ medium: theme.space.small
2652
+ }
2644
2653
  };
2645
2654
  var colors = {
2646
2655
  carouselItemBackground: theme.colors.defaultSurface
@@ -9567,15 +9576,18 @@ var StyledLoadingDot = index$a(View)(function (_ref) {
9567
9576
  case 'filled-primary':
9568
9577
  case 'filled-secondary':
9569
9578
  case 'filled-danger':
9579
+ case 'outlined-white':
9580
+ case 'text-white':
9570
9581
  return {
9571
9582
  backgroundColor: theme.__hd__.button.colors.invertedText
9572
9583
  };
9584
+ case 'filled-white':
9573
9585
  case 'outlined-primary':
9574
9586
  return genLoadingIndicatorStyles(theme, 'primary');
9575
9587
  case 'text-primary':
9576
9588
  case 'outlined-secondary':
9577
- case 'text-secondary':
9578
9589
  return genLoadingIndicatorStyles(theme, 'secondary');
9590
+ case 'text-secondary':
9579
9591
  case 'outlined-danger':
9580
9592
  case 'text-danger':
9581
9593
  return genLoadingIndicatorStyles(theme, 'danger');
@@ -9749,15 +9761,20 @@ var StyledButtonContainer = index$a(TouchableHighlight)(function (_ref) {
9749
9761
  return genFilledContainerStyles(theme, 'secondary', disabled, loading, themeIsCompact);
9750
9762
  case 'filled-danger':
9751
9763
  return genFilledContainerStyles(theme, 'danger', disabled, loading, themeIsCompact);
9764
+ case 'filled-white':
9765
+ return genFilledContainerStyles(theme, 'white', disabled, loading, themeIsCompact);
9752
9766
  case 'outlined-primary':
9753
9767
  return genOutlineContainerStyles(theme, 'primary', disabled, loading, themeIsCompact);
9754
9768
  case 'outlined-secondary':
9755
9769
  return genOutlineContainerStyles(theme, 'secondary', disabled, loading, themeIsCompact);
9756
9770
  case 'outlined-danger':
9757
9771
  return genOutlineContainerStyles(theme, 'danger', disabled, loading, themeIsCompact);
9772
+ case 'outlined-white':
9773
+ return genOutlineContainerStyles(theme, 'white', disabled, loading, themeIsCompact);
9758
9774
  case 'text-primary':
9759
9775
  case 'text-secondary':
9760
9776
  case 'text-danger':
9777
+ case 'text-white':
9761
9778
  return {
9762
9779
  height: themeInlineText ? undefined : getButtonHeight(themeIsCompact),
9763
9780
  borderRadius: theme.__hd__.button.radii.text,
@@ -9766,14 +9783,51 @@ var StyledButtonContainer = index$a(TouchableHighlight)(function (_ref) {
9766
9783
  alignItems: 'center',
9767
9784
  padding: themeInlineText ? 0 : theme.__hd__.button.space["default"].textButtonPadding,
9768
9785
  borderWidth: 0,
9769
- backgroundColor: loading && !themeInlineText ? theme.__hd__.button.colors.textLoadingBackground : 'transparent'
9786
+ backgroundColor: loading && !themeInlineText && themeButtonVariant !== 'text-white' ? theme.__hd__.button.colors.textLoadingBackground : 'transparent'
9770
9787
  };
9771
9788
  }
9772
9789
  });
9773
- var StyledButtonText = index$a(Typography.Title)(function (_ref2) {
9774
- var disabled = _ref2.disabled,
9775
- themeButtonVariant = _ref2.themeButtonVariant,
9790
+ var genWhiteTextStyles = function genWhiteTextStyles(_ref2) {
9791
+ var variant = _ref2.variant,
9792
+ disabled = _ref2.disabled,
9776
9793
  theme = _ref2.theme;
9794
+ if (disabled) {
9795
+ switch (variant) {
9796
+ case 'filled-white':
9797
+ {
9798
+ return {
9799
+ color: theme.__hd__.button.colors.invertedText
9800
+ };
9801
+ }
9802
+ case 'outlined-white':
9803
+ case 'text-white':
9804
+ {
9805
+ return {
9806
+ color: theme.__hd__.button.colors.disabledText
9807
+ };
9808
+ }
9809
+ }
9810
+ }
9811
+ switch (variant) {
9812
+ case 'filled-white':
9813
+ {
9814
+ return {
9815
+ color: theme.__hd__.button.colors.primary
9816
+ };
9817
+ }
9818
+ case 'outlined-white':
9819
+ case 'text-white':
9820
+ {
9821
+ return {
9822
+ color: theme.__hd__.button.colors.invertedText
9823
+ };
9824
+ }
9825
+ }
9826
+ };
9827
+ var StyledButtonText = index$a(Typography.Title)(function (_ref3) {
9828
+ var disabled = _ref3.disabled,
9829
+ themeButtonVariant = _ref3.themeButtonVariant,
9830
+ theme = _ref3.theme;
9777
9831
  var themeStyling = function themeStyling() {
9778
9832
  switch (themeButtonVariant) {
9779
9833
  case 'filled-primary':
@@ -9794,6 +9848,14 @@ var StyledButtonText = index$a(Typography.Title)(function (_ref2) {
9794
9848
  return genTextStyles(theme, 'secondary', disabled);
9795
9849
  case 'text-danger':
9796
9850
  return genTextStyles(theme, 'danger', disabled);
9851
+ case 'filled-white':
9852
+ case 'outlined-white':
9853
+ case 'text-white':
9854
+ return genWhiteTextStyles({
9855
+ variant: themeButtonVariant,
9856
+ disabled: disabled,
9857
+ theme: theme
9858
+ });
9797
9859
  }
9798
9860
  };
9799
9861
  return _objectSpread2({
@@ -9802,11 +9864,11 @@ var StyledButtonText = index$a(Typography.Title)(function (_ref2) {
9802
9864
  }, themeStyling());
9803
9865
  });
9804
9866
  var StyledSmallButtonText = StyledButtonText.withComponent(Typography.Body);
9805
- var StyledButtonTitleOfVariantText = index$a(Typography.Body)(function (_ref3) {
9806
- var disabled = _ref3.disabled,
9807
- themeButtonVariant = _ref3.themeButtonVariant,
9808
- themeIsPressed = _ref3.themeIsPressed,
9809
- theme = _ref3.theme;
9867
+ var StyledButtonTitleOfVariantText = index$a(Typography.Body)(function (_ref4) {
9868
+ var disabled = _ref4.disabled,
9869
+ themeButtonVariant = _ref4.themeButtonVariant,
9870
+ themeIsPressed = _ref4.themeIsPressed,
9871
+ theme = _ref4.theme;
9810
9872
  var themeStyling = function themeStyling() {
9811
9873
  switch (themeButtonVariant) {
9812
9874
  case 'text-primary':
@@ -9815,6 +9877,12 @@ var StyledButtonTitleOfVariantText = index$a(Typography.Body)(function (_ref3) {
9815
9877
  return genTextStyles(theme, 'secondary', disabled, themeIsPressed);
9816
9878
  case 'text-danger':
9817
9879
  return genTextStyles(theme, 'danger', disabled, themeIsPressed);
9880
+ case 'text-white':
9881
+ return genWhiteTextStyles({
9882
+ variant: 'text-white',
9883
+ disabled: disabled,
9884
+ theme: theme
9885
+ });
9818
9886
  }
9819
9887
  };
9820
9888
  return _objectSpread2({
@@ -9824,10 +9892,10 @@ var StyledButtonTitleOfVariantText = index$a(Typography.Body)(function (_ref3) {
9824
9892
  textAlign: 'center'
9825
9893
  }, themeStyling());
9826
9894
  });
9827
- var StyledButtonIconWrapper = index$a(View)(function (_ref4) {
9828
- var themePosition = _ref4.themePosition,
9829
- theme = _ref4.theme,
9830
- themeIsCompact = _ref4.themeIsCompact;
9895
+ var StyledButtonIconWrapper = index$a(View)(function (_ref5) {
9896
+ var themePosition = _ref5.themePosition,
9897
+ theme = _ref5.theme,
9898
+ themeIsCompact = _ref5.themeIsCompact;
9831
9899
  switch (themePosition) {
9832
9900
  case 'left':
9833
9901
  return {
@@ -9839,12 +9907,12 @@ var StyledButtonIconWrapper = index$a(View)(function (_ref4) {
9839
9907
  };
9840
9908
  }
9841
9909
  });
9842
- var StyledButtonIcon = index$a(Icon)(function (_ref5) {
9843
- var disabled = _ref5.disabled,
9844
- themeButtonVariant = _ref5.themeButtonVariant,
9845
- themeIsPressed = _ref5.themeIsPressed,
9846
- theme = _ref5.theme,
9847
- themeIsCompact = _ref5.themeIsCompact;
9910
+ var StyledButtonIcon = index$a(Icon)(function (_ref6) {
9911
+ var disabled = _ref6.disabled,
9912
+ themeButtonVariant = _ref6.themeButtonVariant,
9913
+ themeIsPressed = _ref6.themeIsPressed,
9914
+ theme = _ref6.theme,
9915
+ themeIsCompact = _ref6.themeIsCompact;
9848
9916
  var themeStyling = function themeStyling() {
9849
9917
  switch (themeButtonVariant) {
9850
9918
  case 'filled-primary':
@@ -9865,6 +9933,14 @@ var StyledButtonIcon = index$a(Icon)(function (_ref5) {
9865
9933
  return genTextStyles(theme, 'secondary', disabled, themeIsPressed);
9866
9934
  case 'text-danger':
9867
9935
  return genTextStyles(theme, 'danger', disabled, themeIsPressed);
9936
+ case 'filled-white':
9937
+ case 'outlined-white':
9938
+ case 'text-white':
9939
+ return genWhiteTextStyles({
9940
+ variant: themeButtonVariant,
9941
+ disabled: disabled,
9942
+ theme: theme
9943
+ });
9868
9944
  }
9869
9945
  };
9870
9946
  return _objectSpread2({
@@ -9878,17 +9954,20 @@ var isIconName = function isIconName(icon) {
9878
9954
  var FILLED_VARIANTS = {
9879
9955
  primary: 'filled-primary',
9880
9956
  secondary: 'filled-secondary',
9881
- danger: 'filled-danger'
9957
+ danger: 'filled-danger',
9958
+ white: 'filled-white'
9882
9959
  };
9883
9960
  var OUTLINED_VARIANTS = {
9884
9961
  primary: 'outlined-primary',
9885
9962
  secondary: 'outlined-secondary',
9886
- danger: 'outlined-danger'
9963
+ danger: 'outlined-danger',
9964
+ white: 'outlined-white'
9887
9965
  };
9888
9966
  var TEXT_VARIANTS = {
9889
9967
  primary: 'text-primary',
9890
9968
  secondary: 'text-secondary',
9891
- danger: 'text-danger'
9969
+ danger: 'text-danger',
9970
+ white: 'text-white'
9892
9971
  };
9893
9972
  var getThemeVariant = function getThemeVariant(variant, intent) {
9894
9973
  switch (variant) {
@@ -9910,23 +9989,29 @@ var getUnderlayColor = function getUnderlayColor(theme, themeVariant) {
9910
9989
  return theme.__hd__.button.colors.pressedBackground.filledSecondary;
9911
9990
  case 'filled-danger':
9912
9991
  return theme.__hd__.button.colors.pressedBackground.filledDanger;
9992
+ case 'filled-white':
9993
+ return theme.__hd__.button.colors.pressedBackground.filledWhite;
9913
9994
  case 'outlined-primary':
9914
9995
  return theme.__hd__.button.colors.pressedBackground.outlinedPrimary;
9915
9996
  case 'outlined-secondary':
9916
9997
  return theme.__hd__.button.colors.pressedBackground.outlinedSecondary;
9917
9998
  case 'outlined-danger':
9918
9999
  return theme.__hd__.button.colors.pressedBackground.outlineDanger;
10000
+ case 'outlined-white':
10001
+ return theme.__hd__.button.colors.pressedBackground.outlineWhite;
9919
10002
  case 'text-primary':
9920
10003
  return theme.__hd__.button.colors.pressedBackground.textPrimary;
9921
10004
  case 'text-secondary':
9922
10005
  return theme.__hd__.button.colors.pressedBackground.textSecondary;
9923
10006
  case 'text-danger':
9924
10007
  return theme.__hd__.button.colors.pressedBackground.textDanger;
10008
+ case 'text-white':
10009
+ return theme.__hd__.button.colors.pressedBackground.textWhite;
9925
10010
  }
9926
10011
  };
9927
10012
  var deprecatedVariants = ['filled-secondary', 'filled-danger', 'outlined-secondary', 'outlined-danger'];
9928
10013
  function isTextVariant(themeVariant) {
9929
- return ['text-primary', 'text-secondary', 'text-danger'].includes(themeVariant);
10014
+ return ['text-primary', 'text-secondary', 'text-danger', 'text-white'].includes(themeVariant);
9930
10015
  }
9931
10016
  var Button = function Button(_ref) {
9932
10017
  var accessibilityHint = _ref.accessibilityHint,
@@ -9971,7 +10056,7 @@ var Button = function Button(_ref) {
9971
10056
  };
9972
10057
  var renderTitle = function renderTitle() {
9973
10058
  return isCompactVariant ? /*#__PURE__*/React__default.createElement(StyledSmallButtonText, {
9974
- variant: "small",
10059
+ variant: "small-bold",
9975
10060
  ellipsizeMode: "tail",
9976
10061
  numberOfLines: 1,
9977
10062
  disabled: disabled,
@@ -13076,9 +13161,10 @@ var StyledCard = index$a(Card$1)(function (_ref2) {
13076
13161
  };
13077
13162
  });
13078
13163
  var StyledItemWrapper = index$a(View)(function (_ref3) {
13079
- var theme = _ref3.theme;
13164
+ var theme = _ref3.theme,
13165
+ themeGap = _ref3.themeGap;
13080
13166
  return {
13081
- padding: theme.__hd__.cardCarousel.space.carouselItemSpacing
13167
+ padding: theme.__hd__.cardCarousel.space.carouselItemSpacing[themeGap]
13082
13168
  };
13083
13169
  });
13084
13170
 
@@ -13106,7 +13192,9 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
13106
13192
  autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
13107
13193
  _ref$autoPlayInterval = _ref.autoPlayInterval,
13108
13194
  autoPlayInterval = _ref$autoPlayInterval === void 0 ? 3000 : _ref$autoPlayInterval,
13109
- onLayout = _ref.onLayout;
13195
+ onLayout = _ref.onLayout,
13196
+ _ref$gap = _ref.gap,
13197
+ gap = _ref$gap === void 0 ? 'medium' : _ref$gap;
13110
13198
  var _useState = useState(0),
13111
13199
  _useState2 = _slicedToArray(_useState, 2),
13112
13200
  currentIndex = _useState2[0],
@@ -13190,11 +13278,12 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
13190
13278
  var renderItem = useCallback(function (_ref3) {
13191
13279
  var item = _ref3.item;
13192
13280
  return /*#__PURE__*/React__default.createElement(StyledItemWrapper, {
13281
+ themeGap: gap,
13193
13282
  style: {
13194
13283
  width: itemWidth
13195
13284
  }
13196
13285
  }, /*#__PURE__*/React__default.createElement(StyledCard, null, item));
13197
- }, [itemWidth]);
13286
+ }, [itemWidth, gap]);
13198
13287
  var contentContainerPaddingHorizontal = theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal;
13199
13288
  return /*#__PURE__*/React__default.createElement(StyledWrapper$9, {
13200
13289
  style: style,