@hero-design/rn 8.81.1 → 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,17 @@
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
+
9
+ ## 8.81.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [#3527](https://github.com/Thinkei/hero-design/pull/3527) [`228f8de96b09802ce890eeb6277a12a774af99ad`](https://github.com/Thinkei/hero-design/commit/228f8de96b09802ce890eeb6277a12a774af99ad) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [TimePicker] Fix bottom sheet value not in sync
14
+
3
15
  ## 8.81.1
4
16
 
5
17
  ### 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"
@@ -14462,7 +14472,7 @@ var customAlphabet = function customAlphabet(alphabet) {
14462
14472
  return function () {
14463
14473
  var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSize;
14464
14474
  var id = '';
14465
- var i = size;
14475
+ var i = size | 0;
14466
14476
  while (i--) {
14467
14477
  id += alphabet[Math.random() * alphabet.length | 0];
14468
14478
  }
@@ -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
 
@@ -19117,6 +19141,9 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
19117
19141
  var is12Hour = displayFormat.includes('hh');
19118
19142
  var displayValue = value ? format(displayFormat, value) : '';
19119
19143
  var theme = useTheme();
19144
+ useEffect(function () {
19145
+ setSelectingDate(value || new Date());
19146
+ }, [value]);
19120
19147
  return /*#__PURE__*/React__default.createElement(TouchableOpacity, {
19121
19148
  onPress: function onPress() {
19122
19149
  return setOpen(true);
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"
@@ -14489,7 +14499,7 @@ var customAlphabet = function customAlphabet(alphabet) {
14489
14499
  return function () {
14490
14500
  var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSize;
14491
14501
  var id = '';
14492
- var i = size;
14502
+ var i = size | 0;
14493
14503
  while (i--) {
14494
14504
  id += alphabet[Math.random() * alphabet.length | 0];
14495
14505
  }
@@ -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
 
@@ -19144,6 +19168,9 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
19144
19168
  var is12Hour = displayFormat.includes('hh');
19145
19169
  var displayValue = value ? format(displayFormat, value) : '';
19146
19170
  var theme = useTheme();
19171
+ React.useEffect(function () {
19172
+ setSelectingDate(value || new Date());
19173
+ }, [value]);
19147
19174
  return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
19148
19175
  onPress: function onPress() {
19149
19176
  return setOpen(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.81.1",
3
+ "version": "8.81.3-alpha.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -25,7 +25,7 @@
25
25
  "@hero-design/colors": "8.45.1",
26
26
  "date-fns": "^2.16.1",
27
27
  "hero-editor": "^1.9.21",
28
- "nanoid": "^4.0.2"
28
+ "nanoid": "^5.0.9"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@hero-design/react-native-month-year-picker": "^8.42.10",
@@ -93,6 +93,5 @@
93
93
  "ts-jest": "^29.1.1",
94
94
  "typescript": "4.8.4"
95
95
  },
96
- "prettier": "prettier-config-hd",
97
- "react-native": "src/index.ts"
96
+ "prettier": "prettier-config-hd"
98
97
  }
@@ -1,5 +1,5 @@
1
1
  import DateTimePicker from '@react-native-community/datetimepicker';
2
- import React, { useState } from 'react';
2
+ import React, { useEffect, useState } from 'react';
3
3
  import { TouchableOpacity, View } from 'react-native';
4
4
  import formatTime from 'date-fns/fp/format';
5
5
 
@@ -33,6 +33,10 @@ const TimePickerIOS = ({
33
33
  const displayValue = value ? formatTime(displayFormat, value) : '';
34
34
  const theme = useTheme();
35
35
 
36
+ useEffect(() => {
37
+ setSelectingDate(value || new Date());
38
+ }, [value]);
39
+
36
40
  return (
37
41
  <TouchableOpacity onPress={() => setOpen(true)} disabled={disabled}>
38
42
  <View pointerEvents="none" testID="timePickerInputIOS">
@@ -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
  )}