@hero-design/rn 8.81.2 → 8.81.3-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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.81.3-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3532](https://github.com/Thinkei/hero-design/pull/3532) [`b2a99b76972adb906c364ef193e030e352981d92`](https://github.com/Thinkei/hero-design/commit/b2a99b76972adb906c364ef193e030e352981d92) Thanks [@ttkien](https://github.com/ttkien)! - [Toast] Update colors
8
+
3
9
  ## 8.81.2
4
10
 
5
11
  ### Patch Changes
package/es/index.js CHANGED
@@ -3597,12 +3597,22 @@ var getTimePickerTheme = function getTimePickerTheme(theme) {
3597
3597
 
3598
3598
  var getToastTheme = function getToastTheme(theme) {
3599
3599
  var colors = {
3600
- success: theme.colors.success,
3601
- warning: theme.colors.warning,
3602
- error: theme.colors.error,
3603
- info: theme.colors.info,
3604
- notification: theme.colors.defaultGlobalSurface,
3605
- snackbar: theme.colors.darkGlobalSurface,
3600
+ backgrounds: {
3601
+ success: theme.colors.successSurface,
3602
+ warning: theme.colors.warningSurface,
3603
+ error: theme.colors.errorSurface,
3604
+ info: theme.colors.infoSurface,
3605
+ notification: theme.colors.defaultGlobalSurface,
3606
+ snackbar: theme.colors.darkGlobalSurface
3607
+ },
3608
+ texts: {
3609
+ success: theme.colors.onSuccessSurface,
3610
+ warning: theme.colors.onWarningSurface,
3611
+ error: theme.colors.onErrorSurface,
3612
+ info: theme.colors.onInfoSurface,
3613
+ notification: theme.colors.onDefaultGlobalSurface,
3614
+ snackbar: theme.colors.onDarkGlobalSurface
3615
+ },
3606
3616
  divider: theme.colors.secondaryOutline
3607
3617
  };
3608
3618
  var sizes = {
@@ -7272,7 +7282,7 @@ var FONTSIZE_MAP = {
7272
7282
  'regular-bold': 'regular',
7273
7283
  'small-bold': 'small'
7274
7284
  };
7275
- var StyledBody$1 = index$a(Text$1)(function (_ref) {
7285
+ var StyledBody$2 = index$a(Text$1)(function (_ref) {
7276
7286
  var themeIntent = _ref.themeIntent,
7277
7287
  theme = _ref.theme,
7278
7288
  themeTypeface = _ref.themeTypeface,
@@ -7298,7 +7308,7 @@ var Body = function Body(_ref) {
7298
7308
  _ref$variant = _ref.variant,
7299
7309
  variant = _ref$variant === void 0 ? 'regular' : _ref$variant,
7300
7310
  nativeProps = _objectWithoutProperties(_ref, _excluded$H);
7301
- return /*#__PURE__*/React__default.createElement(StyledBody$1, _extends$1({}, nativeProps, {
7311
+ return /*#__PURE__*/React__default.createElement(StyledBody$2, _extends$1({}, nativeProps, {
7302
7312
  themeTypeface: typeface,
7303
7313
  themeIntent: intent,
7304
7314
  themeVariant: variant,
@@ -8040,7 +8050,7 @@ var IconContainer$1 = index$a(View)(function (_ref2) {
8040
8050
  paddingLeft: theme.__hd__.alert.space.iconLeftPadding
8041
8051
  };
8042
8052
  });
8043
- var StyledIcon$3 = index$a(Icon)(function (_ref3) {
8053
+ var StyledIcon$4 = index$a(Icon)(function (_ref3) {
8044
8054
  var theme = _ref3.theme,
8045
8055
  themeIntent = _ref3.themeIntent;
8046
8056
  return {
@@ -8054,7 +8064,7 @@ var TextContainer$1 = index$a(View)(function (_ref4) {
8054
8064
  flex: 1
8055
8065
  };
8056
8066
  });
8057
- var StyledBody = index$a(Typography.Body)(function (_ref5) {
8067
+ var StyledBody$1 = index$a(Typography.Body)(function (_ref5) {
8058
8068
  var theme = _ref5.theme,
8059
8069
  themeIntent = _ref5.themeIntent;
8060
8070
  return {
@@ -8099,7 +8109,7 @@ var AlertIcon = function AlertIcon(_ref) {
8099
8109
  intent = _ref.intent;
8100
8110
  return icon ? /*#__PURE__*/React__default.createElement(IconContainer$1, {
8101
8111
  testID: "alert-left-icon"
8102
- }, /*#__PURE__*/React__default.createElement(StyledIcon$3, {
8112
+ }, /*#__PURE__*/React__default.createElement(StyledIcon$4, {
8103
8113
  icon: icon,
8104
8114
  size: "small",
8105
8115
  themeIntent: intent
@@ -8128,19 +8138,19 @@ var Alert = function Alert(_ref2) {
8128
8138
  }, icon !== null ? /*#__PURE__*/React__default.createElement(AlertIcon, {
8129
8139
  icon: icon || getIntentIcon$1(intent),
8130
8140
  intent: intent
8131
- }) : null, /*#__PURE__*/React__default.createElement(TextContainer$1, null, typeof title === 'string' ? /*#__PURE__*/React__default.createElement(StyledBody, {
8141
+ }) : null, /*#__PURE__*/React__default.createElement(TextContainer$1, null, typeof title === 'string' ? /*#__PURE__*/React__default.createElement(StyledBody$1, {
8132
8142
  variant: "small-bold",
8133
8143
  themeIntent: intent
8134
- }, title) : title, typeof content === 'string' ? /*#__PURE__*/React__default.createElement(StyledBody, {
8144
+ }, title) : title, typeof content === 'string' ? /*#__PURE__*/React__default.createElement(StyledBody$1, {
8135
8145
  variant: "small",
8136
8146
  themeIntent: intent
8137
8147
  }, content) : content)), onClose ? /*#__PURE__*/React__default.createElement(CTAWrapper$1, {
8138
8148
  onPress: onClose,
8139
8149
  testID: "alert-close-icon"
8140
- }, typeof actionLabel === 'string' ? /*#__PURE__*/React__default.createElement(StyledBody, {
8150
+ }, typeof actionLabel === 'string' ? /*#__PURE__*/React__default.createElement(StyledBody$1, {
8141
8151
  variant: "small-bold",
8142
8152
  themeIntent: intent
8143
- }, actionLabel) : /*#__PURE__*/React__default.createElement(StyledIcon$3, {
8153
+ }, actionLabel) : /*#__PURE__*/React__default.createElement(StyledIcon$4, {
8144
8154
  icon: "cancel",
8145
8155
  size: "small",
8146
8156
  themeIntent: intent
@@ -8758,7 +8768,7 @@ var StyledStatus = index$a(Animated.View)(function (_ref3) {
8758
8768
  borderRadius: theme.radii.rounded
8759
8769
  };
8760
8770
  });
8761
- var StyledIcon$2 = index$a(Icon)(function (_ref4) {
8771
+ var StyledIcon$3 = index$a(Icon)(function (_ref4) {
8762
8772
  var themeSize = _ref4.themeSize,
8763
8773
  theme = _ref4.theme;
8764
8774
  return {
@@ -8866,7 +8876,7 @@ var Badge = function Badge(_ref) {
8866
8876
  }]
8867
8877
  }, style],
8868
8878
  testID: testID
8869
- }), isIconBadge ? /*#__PURE__*/React__default.createElement(StyledIcon$2, {
8879
+ }), isIconBadge ? /*#__PURE__*/React__default.createElement(StyledIcon$3, {
8870
8880
  icon: icon,
8871
8881
  themeSize: size,
8872
8882
  intent: "text-inverted"
@@ -15024,7 +15034,7 @@ var StyledActionItemText = index$a(Typography.Body)(function (_ref2) {
15024
15034
  color: theme.__hd__.fab.colors.actionItemText
15025
15035
  };
15026
15036
  });
15027
- var StyledIcon$1 = index$a(Icon)(function (_ref3) {
15037
+ var StyledIcon$2 = index$a(Icon)(function (_ref3) {
15028
15038
  var theme = _ref3.theme;
15029
15039
  return {
15030
15040
  color: theme.__hd__.fab.colors.actionItemText
@@ -15113,7 +15123,7 @@ var ActionItem = function ActionItem(_ref) {
15113
15123
  style: style,
15114
15124
  onPress: onPress,
15115
15125
  testID: testID
15116
- }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StyledIconContainer, null, /*#__PURE__*/React__default.createElement(StyledIcon$1, {
15126
+ }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(StyledIconContainer, null, /*#__PURE__*/React__default.createElement(StyledIcon$2, {
15117
15127
  size: "xsmall",
15118
15128
  icon: icon
15119
15129
  })), /*#__PURE__*/React__default.createElement(StyledActionItemText, null, title))));
@@ -15524,7 +15534,7 @@ var Container = index$a(Animated.View)(function (_ref2) {
15524
15534
  themeIntent = _ref2.themeIntent;
15525
15535
  return {
15526
15536
  borderRadius: themeVariant === 'round' ? theme.__hd__.toast.radii["default"] : 0,
15527
- backgroundColor: theme.__hd__.toast.colors[themeIntent],
15537
+ backgroundColor: theme.__hd__.toast.colors.backgrounds[themeIntent],
15528
15538
  minHeight: theme.__hd__.toast.sizes.height,
15529
15539
  flexDirection: 'row',
15530
15540
  shadowColor: theme.__hd__.toast.shadows.color,
@@ -15566,6 +15576,20 @@ var CTAWrapper = index$a(TouchableOpacity)(function (_ref6) {
15566
15576
  justifyContent: 'center'
15567
15577
  };
15568
15578
  });
15579
+ var StyledBody = index$a(Typography.Body)(function (_ref7) {
15580
+ var theme = _ref7.theme,
15581
+ themeIntent = _ref7.themeIntent;
15582
+ return {
15583
+ color: theme.__hd__.toast.colors.texts[themeIntent]
15584
+ };
15585
+ });
15586
+ var StyledIcon$1 = index$a(Icon)(function (_ref8) {
15587
+ var theme = _ref8.theme,
15588
+ themeIntent = _ref8.themeIntent;
15589
+ return {
15590
+ color: theme.__hd__.toast.colors.texts[themeIntent]
15591
+ };
15592
+ });
15569
15593
 
15570
15594
  var fallbackToastControlContext = {
15571
15595
  show: function show(_) {
@@ -15612,10 +15636,10 @@ var ToastIcon = function ToastIcon(_ref) {
15612
15636
  icon = _ref.icon;
15613
15637
  return icon ? /*#__PURE__*/React__default.createElement(IconContainer, {
15614
15638
  testID: "toast-left-icon"
15615
- }, /*#__PURE__*/React__default.createElement(Icon, {
15639
+ }, /*#__PURE__*/React__default.createElement(StyledIcon$1, {
15616
15640
  icon: icon,
15617
15641
  size: "small",
15618
- intent: themeIntent === 'snackbar' ? 'text-inverted' : 'text'
15642
+ themeIntent: themeIntent
15619
15643
  })) : null;
15620
15644
  };
15621
15645
  var Toast$1 = function Toast(_ref2) {
@@ -15679,18 +15703,18 @@ var Toast$1 = function Toast(_ref2) {
15679
15703
  }, icon !== null ? /*#__PURE__*/React__default.createElement(ToastIcon, {
15680
15704
  themeIntent: intent,
15681
15705
  icon: icon || getIntentIcon(intent)
15682
- }) : null, /*#__PURE__*/React__default.createElement(TextContainer, null, typeof content === 'string' ? /*#__PURE__*/React__default.createElement(Typography.Body, {
15706
+ }) : null, /*#__PURE__*/React__default.createElement(TextContainer, null, typeof content === 'string' ? /*#__PURE__*/React__default.createElement(StyledBody, {
15683
15707
  variant: "small",
15684
- intent: intent === 'snackbar' ? 'inverted' : 'body'
15708
+ themeIntent: intent
15685
15709
  }, content) : content)), actionLabel ? /*#__PURE__*/React__default.createElement(CTAWrapper, {
15686
15710
  testID: "toast-action-button",
15687
15711
  onPress: function onPress() {
15688
15712
  onAction === null || onAction === void 0 || onAction();
15689
15713
  onDismiss === null || onDismiss === void 0 || onDismiss();
15690
15714
  }
15691
- }, typeof actionLabel === 'string' ? /*#__PURE__*/React__default.createElement(Typography.Body, {
15715
+ }, typeof actionLabel === 'string' ? /*#__PURE__*/React__default.createElement(StyledBody, {
15692
15716
  variant: "small-bold",
15693
- intent: intent === 'snackbar' ? 'inverted' : 'body'
15717
+ themeIntent: intent
15694
15718
  }, actionLabel) : actionLabel) : null);
15695
15719
  };
15696
15720
 
package/lib/index.js CHANGED
@@ -3624,12 +3624,22 @@ var getTimePickerTheme = function getTimePickerTheme(theme) {
3624
3624
 
3625
3625
  var getToastTheme = function getToastTheme(theme) {
3626
3626
  var colors = {
3627
- success: theme.colors.success,
3628
- warning: theme.colors.warning,
3629
- error: theme.colors.error,
3630
- info: theme.colors.info,
3631
- notification: theme.colors.defaultGlobalSurface,
3632
- snackbar: theme.colors.darkGlobalSurface,
3627
+ backgrounds: {
3628
+ success: theme.colors.successSurface,
3629
+ warning: theme.colors.warningSurface,
3630
+ error: theme.colors.errorSurface,
3631
+ info: theme.colors.infoSurface,
3632
+ notification: theme.colors.defaultGlobalSurface,
3633
+ snackbar: theme.colors.darkGlobalSurface
3634
+ },
3635
+ texts: {
3636
+ success: theme.colors.onSuccessSurface,
3637
+ warning: theme.colors.onWarningSurface,
3638
+ error: theme.colors.onErrorSurface,
3639
+ info: theme.colors.onInfoSurface,
3640
+ notification: theme.colors.onDefaultGlobalSurface,
3641
+ snackbar: theme.colors.onDarkGlobalSurface
3642
+ },
3633
3643
  divider: theme.colors.secondaryOutline
3634
3644
  };
3635
3645
  var sizes = {
@@ -7299,7 +7309,7 @@ var FONTSIZE_MAP = {
7299
7309
  'regular-bold': 'regular',
7300
7310
  'small-bold': 'small'
7301
7311
  };
7302
- var StyledBody$1 = index$a(reactNative.Text)(function (_ref) {
7312
+ var StyledBody$2 = index$a(reactNative.Text)(function (_ref) {
7303
7313
  var themeIntent = _ref.themeIntent,
7304
7314
  theme = _ref.theme,
7305
7315
  themeTypeface = _ref.themeTypeface,
@@ -7325,7 +7335,7 @@ var Body = function Body(_ref) {
7325
7335
  _ref$variant = _ref.variant,
7326
7336
  variant = _ref$variant === void 0 ? 'regular' : _ref$variant,
7327
7337
  nativeProps = _objectWithoutProperties(_ref, _excluded$H);
7328
- return /*#__PURE__*/React__namespace.default.createElement(StyledBody$1, _extends$1({}, nativeProps, {
7338
+ return /*#__PURE__*/React__namespace.default.createElement(StyledBody$2, _extends$1({}, nativeProps, {
7329
7339
  themeTypeface: typeface,
7330
7340
  themeIntent: intent,
7331
7341
  themeVariant: variant,
@@ -8067,7 +8077,7 @@ var IconContainer$1 = index$a(reactNative.View)(function (_ref2) {
8067
8077
  paddingLeft: theme.__hd__.alert.space.iconLeftPadding
8068
8078
  };
8069
8079
  });
8070
- var StyledIcon$3 = index$a(Icon)(function (_ref3) {
8080
+ var StyledIcon$4 = index$a(Icon)(function (_ref3) {
8071
8081
  var theme = _ref3.theme,
8072
8082
  themeIntent = _ref3.themeIntent;
8073
8083
  return {
@@ -8081,7 +8091,7 @@ var TextContainer$1 = index$a(reactNative.View)(function (_ref4) {
8081
8091
  flex: 1
8082
8092
  };
8083
8093
  });
8084
- var StyledBody = index$a(Typography.Body)(function (_ref5) {
8094
+ var StyledBody$1 = index$a(Typography.Body)(function (_ref5) {
8085
8095
  var theme = _ref5.theme,
8086
8096
  themeIntent = _ref5.themeIntent;
8087
8097
  return {
@@ -8126,7 +8136,7 @@ var AlertIcon = function AlertIcon(_ref) {
8126
8136
  intent = _ref.intent;
8127
8137
  return icon ? /*#__PURE__*/React__namespace.default.createElement(IconContainer$1, {
8128
8138
  testID: "alert-left-icon"
8129
- }, /*#__PURE__*/React__namespace.default.createElement(StyledIcon$3, {
8139
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledIcon$4, {
8130
8140
  icon: icon,
8131
8141
  size: "small",
8132
8142
  themeIntent: intent
@@ -8155,19 +8165,19 @@ var Alert = function Alert(_ref2) {
8155
8165
  }, icon !== null ? /*#__PURE__*/React__namespace.default.createElement(AlertIcon, {
8156
8166
  icon: icon || getIntentIcon$1(intent),
8157
8167
  intent: intent
8158
- }) : null, /*#__PURE__*/React__namespace.default.createElement(TextContainer$1, null, typeof title === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledBody, {
8168
+ }) : null, /*#__PURE__*/React__namespace.default.createElement(TextContainer$1, null, typeof title === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledBody$1, {
8159
8169
  variant: "small-bold",
8160
8170
  themeIntent: intent
8161
- }, title) : title, typeof content === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledBody, {
8171
+ }, title) : title, typeof content === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledBody$1, {
8162
8172
  variant: "small",
8163
8173
  themeIntent: intent
8164
8174
  }, content) : content)), onClose ? /*#__PURE__*/React__namespace.default.createElement(CTAWrapper$1, {
8165
8175
  onPress: onClose,
8166
8176
  testID: "alert-close-icon"
8167
- }, typeof actionLabel === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledBody, {
8177
+ }, typeof actionLabel === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledBody$1, {
8168
8178
  variant: "small-bold",
8169
8179
  themeIntent: intent
8170
- }, actionLabel) : /*#__PURE__*/React__namespace.default.createElement(StyledIcon$3, {
8180
+ }, actionLabel) : /*#__PURE__*/React__namespace.default.createElement(StyledIcon$4, {
8171
8181
  icon: "cancel",
8172
8182
  size: "small",
8173
8183
  themeIntent: intent
@@ -8785,7 +8795,7 @@ var StyledStatus = index$a(reactNative.Animated.View)(function (_ref3) {
8785
8795
  borderRadius: theme.radii.rounded
8786
8796
  };
8787
8797
  });
8788
- var StyledIcon$2 = index$a(Icon)(function (_ref4) {
8798
+ var StyledIcon$3 = index$a(Icon)(function (_ref4) {
8789
8799
  var themeSize = _ref4.themeSize,
8790
8800
  theme = _ref4.theme;
8791
8801
  return {
@@ -8893,7 +8903,7 @@ var Badge = function Badge(_ref) {
8893
8903
  }]
8894
8904
  }, style],
8895
8905
  testID: testID
8896
- }), isIconBadge ? /*#__PURE__*/React__namespace.default.createElement(StyledIcon$2, {
8906
+ }), isIconBadge ? /*#__PURE__*/React__namespace.default.createElement(StyledIcon$3, {
8897
8907
  icon: icon,
8898
8908
  themeSize: size,
8899
8909
  intent: "text-inverted"
@@ -15051,7 +15061,7 @@ var StyledActionItemText = index$a(Typography.Body)(function (_ref2) {
15051
15061
  color: theme.__hd__.fab.colors.actionItemText
15052
15062
  };
15053
15063
  });
15054
- var StyledIcon$1 = index$a(Icon)(function (_ref3) {
15064
+ var StyledIcon$2 = index$a(Icon)(function (_ref3) {
15055
15065
  var theme = _ref3.theme;
15056
15066
  return {
15057
15067
  color: theme.__hd__.fab.colors.actionItemText
@@ -15140,7 +15150,7 @@ var ActionItem = function ActionItem(_ref) {
15140
15150
  style: style,
15141
15151
  onPress: onPress,
15142
15152
  testID: testID
15143
- }, /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledIcon$1, {
15153
+ }, /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledIcon$2, {
15144
15154
  size: "xsmall",
15145
15155
  icon: icon
15146
15156
  })), /*#__PURE__*/React__namespace.default.createElement(StyledActionItemText, null, title))));
@@ -15551,7 +15561,7 @@ var Container = index$a(reactNative.Animated.View)(function (_ref2) {
15551
15561
  themeIntent = _ref2.themeIntent;
15552
15562
  return {
15553
15563
  borderRadius: themeVariant === 'round' ? theme.__hd__.toast.radii["default"] : 0,
15554
- backgroundColor: theme.__hd__.toast.colors[themeIntent],
15564
+ backgroundColor: theme.__hd__.toast.colors.backgrounds[themeIntent],
15555
15565
  minHeight: theme.__hd__.toast.sizes.height,
15556
15566
  flexDirection: 'row',
15557
15567
  shadowColor: theme.__hd__.toast.shadows.color,
@@ -15593,6 +15603,20 @@ var CTAWrapper = index$a(reactNative.TouchableOpacity)(function (_ref6) {
15593
15603
  justifyContent: 'center'
15594
15604
  };
15595
15605
  });
15606
+ var StyledBody = index$a(Typography.Body)(function (_ref7) {
15607
+ var theme = _ref7.theme,
15608
+ themeIntent = _ref7.themeIntent;
15609
+ return {
15610
+ color: theme.__hd__.toast.colors.texts[themeIntent]
15611
+ };
15612
+ });
15613
+ var StyledIcon$1 = index$a(Icon)(function (_ref8) {
15614
+ var theme = _ref8.theme,
15615
+ themeIntent = _ref8.themeIntent;
15616
+ return {
15617
+ color: theme.__hd__.toast.colors.texts[themeIntent]
15618
+ };
15619
+ });
15596
15620
 
15597
15621
  var fallbackToastControlContext = {
15598
15622
  show: function show(_) {
@@ -15639,10 +15663,10 @@ var ToastIcon = function ToastIcon(_ref) {
15639
15663
  icon = _ref.icon;
15640
15664
  return icon ? /*#__PURE__*/React__namespace.default.createElement(IconContainer, {
15641
15665
  testID: "toast-left-icon"
15642
- }, /*#__PURE__*/React__namespace.default.createElement(Icon, {
15666
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledIcon$1, {
15643
15667
  icon: icon,
15644
15668
  size: "small",
15645
- intent: themeIntent === 'snackbar' ? 'text-inverted' : 'text'
15669
+ themeIntent: themeIntent
15646
15670
  })) : null;
15647
15671
  };
15648
15672
  var Toast$1 = function Toast(_ref2) {
@@ -15706,18 +15730,18 @@ var Toast$1 = function Toast(_ref2) {
15706
15730
  }, icon !== null ? /*#__PURE__*/React__namespace.default.createElement(ToastIcon, {
15707
15731
  themeIntent: intent,
15708
15732
  icon: icon || getIntentIcon(intent)
15709
- }) : null, /*#__PURE__*/React__namespace.default.createElement(TextContainer, null, typeof content === 'string' ? /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
15733
+ }) : null, /*#__PURE__*/React__namespace.default.createElement(TextContainer, null, typeof content === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledBody, {
15710
15734
  variant: "small",
15711
- intent: intent === 'snackbar' ? 'inverted' : 'body'
15735
+ themeIntent: intent
15712
15736
  }, content) : content)), actionLabel ? /*#__PURE__*/React__namespace.default.createElement(CTAWrapper, {
15713
15737
  testID: "toast-action-button",
15714
15738
  onPress: function onPress() {
15715
15739
  onAction === null || onAction === void 0 || onAction();
15716
15740
  onDismiss === null || onDismiss === void 0 || onDismiss();
15717
15741
  }
15718
- }, typeof actionLabel === 'string' ? /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
15742
+ }, typeof actionLabel === 'string' ? /*#__PURE__*/React__namespace.default.createElement(StyledBody, {
15719
15743
  variant: "small-bold",
15720
- intent: intent === 'snackbar' ? 'inverted' : 'body'
15744
+ themeIntent: intent
15721
15745
  }, actionLabel) : actionLabel) : null);
15722
15746
  };
15723
15747
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.81.2",
3
+ "version": "8.81.3-alpha.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -3,6 +3,9 @@ import { Animated, StyleSheet, TouchableOpacity, View } from 'react-native';
3
3
  import type { ComponentProps } from 'react';
4
4
  import type { ViewProps } from 'react-native';
5
5
  import { IntentType } from './types';
6
+ import { TextProps } from '../Typography/Text';
7
+ import Typography from '../Typography';
8
+ import Icon, { IconProps } from '../Icon';
6
9
 
7
10
  const ToastContainerWrapper = styled(View)<{ position: 'top' | 'bottom' }>(
8
11
  ({ theme, position }) => ({
@@ -19,7 +22,7 @@ const Container = styled(Animated.View)<{
19
22
  themeIntent: IntentType;
20
23
  }>(({ theme, themeVariant, themeIntent }) => ({
21
24
  borderRadius: themeVariant === 'round' ? theme.__hd__.toast.radii.default : 0,
22
- backgroundColor: theme.__hd__.toast.colors[themeIntent],
25
+ backgroundColor: theme.__hd__.toast.colors.backgrounds[themeIntent],
23
26
  minHeight: theme.__hd__.toast.sizes.height,
24
27
  flexDirection: 'row',
25
28
  shadowColor: theme.__hd__.toast.shadows.color,
@@ -56,6 +59,22 @@ const CTAWrapper = styled(TouchableOpacity)<
56
59
  justifyContent: 'center',
57
60
  }));
58
61
 
62
+ const StyledBody = styled(Typography.Body)<
63
+ TextProps & {
64
+ themeIntent: IntentType;
65
+ }
66
+ >(({ theme, themeIntent }) => ({
67
+ color: theme.__hd__.toast.colors.texts[themeIntent],
68
+ }));
69
+
70
+ const StyledIcon = styled(Icon)<
71
+ IconProps & {
72
+ themeIntent: IntentType;
73
+ }
74
+ >(({ theme, themeIntent }) => ({
75
+ color: theme.__hd__.toast.colors.texts[themeIntent],
76
+ }));
77
+
59
78
  export {
60
79
  ToastContainerWrapper,
61
80
  Container,
@@ -63,4 +82,6 @@ export {
63
82
  TextContainer,
64
83
  IconContainer,
65
84
  CTAWrapper,
85
+ StyledBody,
86
+ StyledIcon,
66
87
  };
@@ -1,13 +1,13 @@
1
1
  import React, { useEffect, useLayoutEffect, useRef } from 'react';
2
2
  import { Animated, LayoutAnimation } from 'react-native';
3
- import Icon from '../Icon';
4
- import Typography from '../Typography';
5
3
  import {
6
4
  Container,
7
5
  ContentContainer,
8
6
  IconContainer,
9
7
  CTAWrapper,
10
8
  TextContainer,
9
+ StyledBody,
10
+ StyledIcon,
11
11
  } from './StyledToast';
12
12
  import { useToastConfig } from './ToastContext';
13
13
  import type { IconName } from '../Icon';
@@ -37,11 +37,7 @@ const ToastIcon = ({
37
37
  }) =>
38
38
  icon ? (
39
39
  <IconContainer testID="toast-left-icon">
40
- <Icon
41
- icon={icon}
42
- size="small"
43
- intent={themeIntent === 'snackbar' ? 'text-inverted' : 'text'}
44
- />
40
+ <StyledIcon icon={icon} size="small" themeIntent={themeIntent} />
45
41
  </IconContainer>
46
42
  ) : null;
47
43
 
@@ -112,12 +108,9 @@ const Toast = ({
112
108
  ) : null}
113
109
  <TextContainer>
114
110
  {typeof content === 'string' ? (
115
- <Typography.Body
116
- variant="small"
117
- intent={intent === 'snackbar' ? 'inverted' : 'body'}
118
- >
111
+ <StyledBody variant="small" themeIntent={intent}>
119
112
  {content}
120
- </Typography.Body>
113
+ </StyledBody>
121
114
  ) : (
122
115
  content
123
116
  )}
@@ -132,12 +125,9 @@ const Toast = ({
132
125
  }}
133
126
  >
134
127
  {typeof actionLabel === 'string' ? (
135
- <Typography.Body
136
- variant="small-bold"
137
- intent={intent === 'snackbar' ? 'inverted' : 'body'}
138
- >
128
+ <StyledBody variant="small-bold" themeIntent={intent}>
139
129
  {actionLabel}
140
- </Typography.Body>
130
+ </StyledBody>
141
131
  ) : (
142
132
  actionLabel
143
133
  )}
@@ -12,7 +12,7 @@ exports[`Toast Icon render custom icon correctly 1`] = `
12
12
  collapsable={false}
13
13
  style={
14
14
  {
15
- "backgroundColor": "#b5c3fd",
15
+ "backgroundColor": "#ecf0ff",
16
16
  "borderRadius": 0,
17
17
  "elevation": 3,
18
18
  "flexDirection": "row",
@@ -71,7 +71,12 @@ exports[`Toast Icon render custom icon correctly 1`] = `
71
71
  "color": "#001f23",
72
72
  "fontSize": 20,
73
73
  },
74
- undefined,
74
+ [
75
+ {
76
+ "color": "#355bfb",
77
+ },
78
+ undefined,
79
+ ],
75
80
  ]
76
81
  }
77
82
  themeIntent="text"
@@ -100,7 +105,12 @@ exports[`Toast Icon render custom icon correctly 1`] = `
100
105
  "letterSpacing": 0.48,
101
106
  "lineHeight": 22,
102
107
  },
103
- undefined,
108
+ [
109
+ {
110
+ "color": "#355bfb",
111
+ },
112
+ undefined,
113
+ ],
104
114
  ]
105
115
  }
106
116
  themeIntent="body"
@@ -147,7 +157,7 @@ exports[`Toast renders correctly when intent is error 1`] = `
147
157
  collapsable={false}
148
158
  style={
149
159
  {
150
- "backgroundColor": "#f46363",
160
+ "backgroundColor": "#fcebe7",
151
161
  "borderRadius": 0,
152
162
  "elevation": 3,
153
163
  "flexDirection": "row",
@@ -206,7 +216,12 @@ exports[`Toast renders correctly when intent is error 1`] = `
206
216
  "color": "#001f23",
207
217
  "fontSize": 20,
208
218
  },
209
- undefined,
219
+ [
220
+ {
221
+ "color": "#cb300a",
222
+ },
223
+ undefined,
224
+ ],
210
225
  ]
211
226
  }
212
227
  themeIntent="text"
@@ -235,7 +250,12 @@ exports[`Toast renders correctly when intent is error 1`] = `
235
250
  "letterSpacing": 0.48,
236
251
  "lineHeight": 22,
237
252
  },
238
- undefined,
253
+ [
254
+ {
255
+ "color": "#cb300a",
256
+ },
257
+ undefined,
258
+ ],
239
259
  ]
240
260
  }
241
261
  themeIntent="body"
@@ -294,7 +314,12 @@ exports[`Toast renders correctly when intent is error 1`] = `
294
314
  "letterSpacing": 0.24,
295
315
  "lineHeight": 22,
296
316
  },
297
- undefined,
317
+ [
318
+ {
319
+ "color": "#cb300a",
320
+ },
321
+ undefined,
322
+ ],
298
323
  ]
299
324
  }
300
325
  themeIntent="body"
@@ -340,7 +365,7 @@ exports[`Toast renders correctly when intent is info 1`] = `
340
365
  collapsable={false}
341
366
  style={
342
367
  {
343
- "backgroundColor": "#b5c3fd",
368
+ "backgroundColor": "#ecf0ff",
344
369
  "borderRadius": 0,
345
370
  "elevation": 3,
346
371
  "flexDirection": "row",
@@ -399,7 +424,12 @@ exports[`Toast renders correctly when intent is info 1`] = `
399
424
  "color": "#001f23",
400
425
  "fontSize": 20,
401
426
  },
402
- undefined,
427
+ [
428
+ {
429
+ "color": "#355bfb",
430
+ },
431
+ undefined,
432
+ ],
403
433
  ]
404
434
  }
405
435
  themeIntent="text"
@@ -428,7 +458,12 @@ exports[`Toast renders correctly when intent is info 1`] = `
428
458
  "letterSpacing": 0.48,
429
459
  "lineHeight": 22,
430
460
  },
431
- undefined,
461
+ [
462
+ {
463
+ "color": "#355bfb",
464
+ },
465
+ undefined,
466
+ ],
432
467
  ]
433
468
  }
434
469
  themeIntent="body"
@@ -487,7 +522,12 @@ exports[`Toast renders correctly when intent is info 1`] = `
487
522
  "letterSpacing": 0.24,
488
523
  "lineHeight": 22,
489
524
  },
490
- undefined,
525
+ [
526
+ {
527
+ "color": "#355bfb",
528
+ },
529
+ undefined,
530
+ ],
491
531
  ]
492
532
  }
493
533
  themeIntent="body"
@@ -594,7 +634,12 @@ exports[`Toast renders correctly when intent is notification 1`] = `
594
634
  "letterSpacing": 0.48,
595
635
  "lineHeight": 22,
596
636
  },
597
- undefined,
637
+ [
638
+ {
639
+ "color": "#001f23",
640
+ },
641
+ undefined,
642
+ ],
598
643
  ]
599
644
  }
600
645
  themeIntent="body"
@@ -653,7 +698,12 @@ exports[`Toast renders correctly when intent is notification 1`] = `
653
698
  "letterSpacing": 0.24,
654
699
  "lineHeight": 22,
655
700
  },
656
- undefined,
701
+ [
702
+ {
703
+ "color": "#001f23",
704
+ },
705
+ undefined,
706
+ ],
657
707
  ]
658
708
  }
659
709
  themeIntent="body"
@@ -754,16 +804,21 @@ exports[`Toast renders correctly when intent is snackbar 1`] = `
754
804
  style={
755
805
  [
756
806
  {
757
- "color": "#ffffff",
807
+ "color": "#001f23",
758
808
  "fontFamily": "BeVietnamPro-Regular",
759
809
  "fontSize": 14,
760
810
  "letterSpacing": 0.48,
761
811
  "lineHeight": 22,
762
812
  },
763
- undefined,
813
+ [
814
+ {
815
+ "color": "#ffffff",
816
+ },
817
+ undefined,
818
+ ],
764
819
  ]
765
820
  }
766
- themeIntent="inverted"
821
+ themeIntent="body"
767
822
  themeTypeface="neutral"
768
823
  themeVariant="small"
769
824
  >
@@ -813,16 +868,21 @@ exports[`Toast renders correctly when intent is snackbar 1`] = `
813
868
  style={
814
869
  [
815
870
  {
816
- "color": "#ffffff",
871
+ "color": "#001f23",
817
872
  "fontFamily": "BeVietnamPro-SemiBold",
818
873
  "fontSize": 14,
819
874
  "letterSpacing": 0.24,
820
875
  "lineHeight": 22,
821
876
  },
822
- undefined,
877
+ [
878
+ {
879
+ "color": "#ffffff",
880
+ },
881
+ undefined,
882
+ ],
823
883
  ]
824
884
  }
825
- themeIntent="inverted"
885
+ themeIntent="body"
826
886
  themeTypeface="neutral"
827
887
  themeVariant="small-bold"
828
888
  >
@@ -865,7 +925,7 @@ exports[`Toast renders correctly when intent is success 1`] = `
865
925
  collapsable={false}
866
926
  style={
867
927
  {
868
- "backgroundColor": "#5ace7d",
928
+ "backgroundColor": "#f0fef4",
869
929
  "borderRadius": 0,
870
930
  "elevation": 3,
871
931
  "flexDirection": "row",
@@ -924,7 +984,12 @@ exports[`Toast renders correctly when intent is success 1`] = `
924
984
  "color": "#001f23",
925
985
  "fontSize": 20,
926
986
  },
927
- undefined,
987
+ [
988
+ {
989
+ "color": "#017d6d",
990
+ },
991
+ undefined,
992
+ ],
928
993
  ]
929
994
  }
930
995
  themeIntent="text"
@@ -953,7 +1018,12 @@ exports[`Toast renders correctly when intent is success 1`] = `
953
1018
  "letterSpacing": 0.48,
954
1019
  "lineHeight": 22,
955
1020
  },
956
- undefined,
1021
+ [
1022
+ {
1023
+ "color": "#017d6d",
1024
+ },
1025
+ undefined,
1026
+ ],
957
1027
  ]
958
1028
  }
959
1029
  themeIntent="body"
@@ -1012,7 +1082,12 @@ exports[`Toast renders correctly when intent is success 1`] = `
1012
1082
  "letterSpacing": 0.24,
1013
1083
  "lineHeight": 22,
1014
1084
  },
1015
- undefined,
1085
+ [
1086
+ {
1087
+ "color": "#017d6d",
1088
+ },
1089
+ undefined,
1090
+ ],
1016
1091
  ]
1017
1092
  }
1018
1093
  themeIntent="body"
@@ -1058,7 +1133,7 @@ exports[`Toast renders correctly when intent is warning 1`] = `
1058
1133
  collapsable={false}
1059
1134
  style={
1060
1135
  {
1061
- "backgroundColor": "#ffbe71",
1136
+ "backgroundColor": "#fff6eb",
1062
1137
  "borderRadius": 0,
1063
1138
  "elevation": 3,
1064
1139
  "flexDirection": "row",
@@ -1117,7 +1192,12 @@ exports[`Toast renders correctly when intent is warning 1`] = `
1117
1192
  "color": "#001f23",
1118
1193
  "fontSize": 20,
1119
1194
  },
1120
- undefined,
1195
+ [
1196
+ {
1197
+ "color": "#ac5d00",
1198
+ },
1199
+ undefined,
1200
+ ],
1121
1201
  ]
1122
1202
  }
1123
1203
  themeIntent="text"
@@ -1146,7 +1226,12 @@ exports[`Toast renders correctly when intent is warning 1`] = `
1146
1226
  "letterSpacing": 0.48,
1147
1227
  "lineHeight": 22,
1148
1228
  },
1149
- undefined,
1229
+ [
1230
+ {
1231
+ "color": "#ac5d00",
1232
+ },
1233
+ undefined,
1234
+ ],
1150
1235
  ]
1151
1236
  }
1152
1237
  themeIntent="body"
@@ -1205,7 +1290,12 @@ exports[`Toast renders correctly when intent is warning 1`] = `
1205
1290
  "letterSpacing": 0.24,
1206
1291
  "lineHeight": 22,
1207
1292
  },
1208
- undefined,
1293
+ [
1294
+ {
1295
+ "color": "#ac5d00",
1296
+ },
1297
+ undefined,
1298
+ ],
1209
1299
  ]
1210
1300
  }
1211
1301
  themeIntent="body"
@@ -1277,13 +1277,23 @@ exports[`theme returns correct theme object 1`] = `
1277
1277
  "base": 1,
1278
1278
  },
1279
1279
  "colors": {
1280
+ "backgrounds": {
1281
+ "error": "#fcebe7",
1282
+ "info": "#ecf0ff",
1283
+ "notification": "#ffffff",
1284
+ "snackbar": "#001f23",
1285
+ "success": "#f0fef4",
1286
+ "warning": "#fff6eb",
1287
+ },
1280
1288
  "divider": "#e8e9ea",
1281
- "error": "#f46363",
1282
- "info": "#b5c3fd",
1283
- "notification": "#ffffff",
1284
- "snackbar": "#001f23",
1285
- "success": "#5ace7d",
1286
- "warning": "#ffbe71",
1289
+ "texts": {
1290
+ "error": "#cb300a",
1291
+ "info": "#355bfb",
1292
+ "notification": "#001f23",
1293
+ "snackbar": "#ffffff",
1294
+ "success": "#017d6d",
1295
+ "warning": "#ac5d00",
1296
+ },
1287
1297
  },
1288
1298
  "radii": {
1289
1299
  "default": 16,
@@ -2,12 +2,22 @@ import type { GlobalTheme } from '../global';
2
2
 
3
3
  const getToastTheme = (theme: GlobalTheme) => {
4
4
  const colors = {
5
- success: theme.colors.success,
6
- warning: theme.colors.warning,
7
- error: theme.colors.error,
8
- info: theme.colors.info,
9
- notification: theme.colors.defaultGlobalSurface,
10
- snackbar: theme.colors.darkGlobalSurface,
5
+ backgrounds: {
6
+ success: theme.colors.successSurface,
7
+ warning: theme.colors.warningSurface,
8
+ error: theme.colors.errorSurface,
9
+ info: theme.colors.infoSurface,
10
+ notification: theme.colors.defaultGlobalSurface,
11
+ snackbar: theme.colors.darkGlobalSurface,
12
+ },
13
+ texts: {
14
+ success: theme.colors.onSuccessSurface,
15
+ warning: theme.colors.onWarningSurface,
16
+ error: theme.colors.onErrorSurface,
17
+ info: theme.colors.onInfoSurface,
18
+ notification: theme.colors.onDefaultGlobalSurface,
19
+ snackbar: theme.colors.onDarkGlobalSurface,
20
+ },
11
21
  divider: theme.colors.secondaryOutline,
12
22
  };
13
23
 
@@ -4840,3 +4840,5 @@ var drawChart = (function (exports) {
4840
4840
  </body>
4841
4841
  </html>
4842
4842
 
4843
+
4844
+
@@ -1,6 +1,8 @@
1
1
  import { Animated, TouchableOpacity, View } from 'react-native';
2
2
  import type { ViewProps } from 'react-native';
3
3
  import { IntentType } from './types';
4
+ import { TextProps } from '../Typography/Text';
5
+ import { IconProps } from '../Icon';
4
6
  declare const ToastContainerWrapper: import("@emotion/native").StyledComponent<ViewProps & {
5
7
  theme?: import("@emotion/react").Theme | undefined;
6
8
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
@@ -42,4 +44,16 @@ declare const CTAWrapper: import("@emotion/native").StyledComponent<import("reac
42
44
  }, {}, {
43
45
  ref?: import("react").Ref<TouchableOpacity> | undefined;
44
46
  }>;
45
- export { ToastContainerWrapper, Container, ContentContainer, TextContainer, IconContainer, CTAWrapper, };
47
+ declare const StyledBody: import("@emotion/native").StyledComponent<import("../Typography/Body").BodyProps & {
48
+ theme?: import("@emotion/react").Theme | undefined;
49
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
50
+ } & TextProps & {
51
+ themeIntent: IntentType;
52
+ }, {}, {}>;
53
+ declare const StyledIcon: import("@emotion/native").StyledComponent<IconProps & {
54
+ theme?: import("@emotion/react").Theme | undefined;
55
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
56
+ } & {
57
+ themeIntent: IntentType;
58
+ }, {}, {}>;
59
+ export { ToastContainerWrapper, Container, ContentContainer, TextContainer, IconContainer, CTAWrapper, StyledBody, StyledIcon, };
@@ -1,12 +1,22 @@
1
1
  import type { GlobalTheme } from '../global';
2
2
  declare const getToastTheme: (theme: GlobalTheme) => {
3
3
  colors: {
4
- success: string;
5
- warning: string;
6
- error: string;
7
- info: string;
8
- notification: string;
9
- snackbar: string;
4
+ backgrounds: {
5
+ success: string;
6
+ warning: string;
7
+ error: string;
8
+ info: string;
9
+ notification: string;
10
+ snackbar: string;
11
+ };
12
+ texts: {
13
+ success: string;
14
+ warning: string;
15
+ error: string;
16
+ info: string;
17
+ notification: string;
18
+ snackbar: string;
19
+ };
10
20
  divider: string;
11
21
  };
12
22
  radii: {
@@ -1,7 +0,0 @@
1
- (node:2808) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
2
- (Use `node --trace-warnings ...` to show where the warning was created)
3
- 
4
- src/index.ts → lib/index.js, es/index.js...
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
- (!) [plugin node-resolve] preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.
7
- created lib/index.js, es/index.js in 52.7s