@hero-design/rn 8.80.1 → 8.81.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 (39) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/es/index.js +74 -24
  3. package/lib/index.js +74 -24
  4. package/package.json +3 -2
  5. package/src/components/Button/Button.tsx +13 -5
  6. package/src/components/Button/StyledButton.tsx +60 -39
  7. package/src/components/Button/__tests__/Button.spec.tsx +21 -16
  8. package/src/components/Button/__tests__/StyledButton.spec.tsx +19 -12
  9. package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +670 -0
  10. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +153 -0
  11. package/src/components/Chip/StyledChip.tsx +6 -1
  12. package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +117 -60
  13. package/src/components/Chip/__tests__/index.spec.tsx +13 -0
  14. package/src/components/Chip/index.tsx +20 -12
  15. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +1 -0
  16. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
  17. package/src/components/TimePicker/TimePickerIOS.tsx +5 -1
  18. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +1 -0
  19. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +8 -0
  20. package/src/theme/components/button.ts +5 -0
  21. package/src/theme/components/chip.ts +5 -0
  22. package/stats/8.81.0/rn-stats.html +4842 -0
  23. package/stats/8.81.1/rn-stats.html +4842 -0
  24. package/types/components/Button/Button.d.ts +1 -1
  25. package/types/components/Button/StyledButton.d.ts +3 -0
  26. package/types/components/Chip/StyledChip.d.ts +5 -1
  27. package/types/components/Chip/index.d.ts +2 -2
  28. package/types/components/CompoundSearch/CompoundSearchHandler.d.ts +31 -0
  29. package/types/components/CompoundSearch/CompoundSearchTextInput.d.ts +60 -0
  30. package/types/components/CompoundSearch/StyledCompoundSearch.d.ts +40 -0
  31. package/types/components/CompoundSearch/index.d.ts +8 -0
  32. package/types/components/CompoundSearch/utils.d.ts +8 -0
  33. package/types/components/FloatingIsland/SingleLine/StyledSingleLine.d.ts +15 -0
  34. package/types/components/FloatingIsland/SingleLine/index.d.ts +24 -0
  35. package/types/components/FloatingIsland/StyledFloatingIsland.d.ts +2 -2
  36. package/types/theme/components/button.d.ts +5 -0
  37. package/types/theme/components/chip.d.ts +3 -0
  38. package/types/theme/components/compoundSearch.d.ts +36 -0
  39. package/.turbo/turbo-build.log +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.81.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3518](https://github.com/Thinkei/hero-design/pull/3518) [`b571a2a4e544551d3ed0cfb1baea6da4f2ae33e2`](https://github.com/Thinkei/hero-design/commit/b571a2a4e544551d3ed0cfb1baea6da4f2ae33e2) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Chip] Update styling and allow custom label
8
+
9
+ ## 8.81.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#3505](https://github.com/Thinkei/hero-design/pull/3505) [`6b9e214ee7e9fe63374a4ae7c11c8af4902437ac`](https://github.com/Thinkei/hero-design/commit/6b9e214ee7e9fe63374a4ae7c11c8af4902437ac) Thanks [@haudao-eh](https://github.com/haudao-eh)! - [Button] Support inline-text variant
14
+
3
15
  ## 8.80.1
4
16
 
5
17
  ### Patch Changes
package/es/index.js CHANGED
@@ -2483,6 +2483,11 @@ var getButtonTheme = function getButtonTheme(theme) {
2483
2483
  textPrimary: theme.colors.highlightedSurface,
2484
2484
  textSecondary: theme.colors.neutralGlobalSurface,
2485
2485
  textDanger: theme.colors.errorSurface
2486
+ },
2487
+ pressedText: {
2488
+ primary: theme.colors.pressedSurface,
2489
+ secondary: theme.colors.onDefaultGlobalSurface,
2490
+ danger: theme.colors.mutedError
2486
2491
  }
2487
2492
  };
2488
2493
  var lineHeights = {
@@ -2666,12 +2671,16 @@ var getChipTheme = function getChipTheme(theme) {
2666
2671
  var shadows = {
2667
2672
  filledWrapper: theme.shadows["default"]
2668
2673
  };
2674
+ var fontSizes = {
2675
+ icon: theme.fontSizes.small
2676
+ };
2669
2677
  return {
2670
2678
  colors: colors,
2671
2679
  space: space,
2672
2680
  radii: radii,
2673
2681
  borderWidths: borderWidths,
2674
- shadows: shadows
2682
+ shadows: shadows,
2683
+ fontSizes: fontSizes
2675
2684
  };
2676
2685
  };
2677
2686
 
@@ -9286,12 +9295,17 @@ var genOutlineContainerStyles = function genOutlineContainerStyles(theme, intent
9286
9295
  backgroundColor: 'transparent'
9287
9296
  }, borderColorStyling());
9288
9297
  };
9289
- var genTextStyles = function genTextStyles(theme, intent, disabled) {
9298
+ var genTextStyles = function genTextStyles(theme, intent, disabled, isPressed) {
9290
9299
  if (disabled) {
9291
9300
  return {
9292
9301
  color: theme.__hd__.button.colors.disabledText
9293
9302
  };
9294
9303
  }
9304
+ if (isPressed) {
9305
+ return {
9306
+ color: theme.__hd__.button.colors.pressedText[intent]
9307
+ };
9308
+ }
9295
9309
  return {
9296
9310
  color: theme.__hd__.button.colors[intent]
9297
9311
  };
@@ -9302,6 +9316,7 @@ var StyledButtonContainer = index$a(TouchableHighlight)(function (_ref) {
9302
9316
  _ref$loading = _ref.loading,
9303
9317
  loading = _ref$loading === void 0 ? false : _ref$loading,
9304
9318
  themeButtonVariant = _ref.themeButtonVariant,
9319
+ themeInlineText = _ref.themeInlineText,
9305
9320
  theme = _ref.theme;
9306
9321
  switch (themeButtonVariant) {
9307
9322
  case 'filled-primary':
@@ -9320,14 +9335,14 @@ var StyledButtonContainer = index$a(TouchableHighlight)(function (_ref) {
9320
9335
  case 'text-secondary':
9321
9336
  case 'text-danger':
9322
9337
  return {
9323
- height: scale(60),
9338
+ height: themeInlineText ? undefined : scale(60),
9324
9339
  borderRadius: theme.__hd__.button.radii.text,
9325
9340
  flexDirection: 'row',
9326
9341
  justifyContent: 'center',
9327
9342
  alignItems: 'center',
9328
- padding: theme.__hd__.button.space.textButtonPadding,
9343
+ padding: themeInlineText ? 0 : theme.__hd__.button.space.textButtonPadding,
9329
9344
  borderWidth: 0,
9330
- backgroundColor: loading ? theme.__hd__.button.colors.textLoadingBackground : 'transparent'
9345
+ backgroundColor: loading && !themeInlineText ? theme.__hd__.button.colors.textLoadingBackground : 'transparent'
9331
9346
  };
9332
9347
  }
9333
9348
  });
@@ -9365,15 +9380,16 @@ var StyledButtonText = index$a(Typography.Title)(function (_ref2) {
9365
9380
  var StyledButtonTitleOfVariantText = index$a(Typography.Body)(function (_ref3) {
9366
9381
  var disabled = _ref3.disabled,
9367
9382
  themeButtonVariant = _ref3.themeButtonVariant,
9383
+ themeIsPressed = _ref3.themeIsPressed,
9368
9384
  theme = _ref3.theme;
9369
9385
  var themeStyling = function themeStyling() {
9370
9386
  switch (themeButtonVariant) {
9371
9387
  case 'text-primary':
9372
- return genTextStyles(theme, 'primary', disabled);
9388
+ return genTextStyles(theme, 'primary', disabled, themeIsPressed);
9373
9389
  case 'text-secondary':
9374
- return genTextStyles(theme, 'secondary', disabled);
9390
+ return genTextStyles(theme, 'secondary', disabled, themeIsPressed);
9375
9391
  case 'text-danger':
9376
- return genTextStyles(theme, 'danger', disabled);
9392
+ return genTextStyles(theme, 'danger', disabled, themeIsPressed);
9377
9393
  }
9378
9394
  };
9379
9395
  return _objectSpread2({
@@ -9399,6 +9415,7 @@ var StyledButtonIconWrapper = index$a(View)(function (_ref4) {
9399
9415
  var StyledButtonIcon = index$a(Icon)(function (_ref5) {
9400
9416
  var disabled = _ref5.disabled,
9401
9417
  themeButtonVariant = _ref5.themeButtonVariant,
9418
+ themeIsPressed = _ref5.themeIsPressed,
9402
9419
  theme = _ref5.theme;
9403
9420
  var themeStyling = function themeStyling() {
9404
9421
  switch (themeButtonVariant) {
@@ -9415,11 +9432,11 @@ var StyledButtonIcon = index$a(Icon)(function (_ref5) {
9415
9432
  case 'outlined-danger':
9416
9433
  return genTextStyles(theme, 'danger', disabled);
9417
9434
  case 'text-primary':
9418
- return genTextStyles(theme, 'primary', disabled);
9435
+ return genTextStyles(theme, 'primary', disabled, themeIsPressed);
9419
9436
  case 'text-secondary':
9420
- return genTextStyles(theme, 'secondary', disabled);
9437
+ return genTextStyles(theme, 'secondary', disabled, themeIsPressed);
9421
9438
  case 'text-danger':
9422
- return genTextStyles(theme, 'danger', disabled);
9439
+ return genTextStyles(theme, 'danger', disabled, themeIsPressed);
9423
9440
  }
9424
9441
  };
9425
9442
  return _objectSpread2({
@@ -9498,11 +9515,16 @@ var Button = function Button(_ref) {
9498
9515
  text = _ref.text,
9499
9516
  _ref$variant = _ref.variant,
9500
9517
  variant = _ref$variant === void 0 ? 'filled' : _ref$variant;
9501
- var themeVariant = getThemeVariant(variant, intent);
9518
+ var isInlineText = variant === 'inline-text';
9519
+ var themeVariant = getThemeVariant(isInlineText ? 'text' : variant, intent);
9502
9520
  var theme = useTheme();
9503
9521
  var underlayColor = useMemo(function () {
9504
- return getUnderlayColor(theme, themeVariant);
9505
- }, [theme, themeVariant]);
9522
+ return isInlineText ? 'transparent' : getUnderlayColor(theme, themeVariant);
9523
+ }, [theme, themeVariant, isInlineText]);
9524
+ var _useState = useState(false),
9525
+ _useState2 = _slicedToArray(_useState, 2),
9526
+ isPressed = _useState2[0],
9527
+ setIsPressed = _useState2[1];
9506
9528
  useDeprecation("Button variant ".concat(deprecatedVariants.join(', '), " are deprecated."), deprecatedVariants.includes(themeVariant));
9507
9529
  return /*#__PURE__*/React__default.createElement(StyledButtonContainer, {
9508
9530
  accessibilityHint: accessibilityHint,
@@ -9513,7 +9535,14 @@ var Button = function Button(_ref) {
9513
9535
  testID: testID,
9514
9536
  themeButtonVariant: themeVariant,
9515
9537
  style: style,
9516
- underlayColor: underlayColor
9538
+ underlayColor: underlayColor,
9539
+ themeInlineText: isInlineText,
9540
+ onPressIn: function onPressIn() {
9541
+ return isInlineText && setIsPressed(true);
9542
+ },
9543
+ onPressOut: function onPressOut() {
9544
+ return isInlineText && setIsPressed(false);
9545
+ }
9517
9546
  }, loading === true ? /*#__PURE__*/React__default.createElement(LoadingIndicator, {
9518
9547
  testID: "".concat(testID, "-loading-indicator"),
9519
9548
  themeVariant: themeVariant
@@ -9523,13 +9552,15 @@ var Button = function Button(_ref) {
9523
9552
  disabled: disabled,
9524
9553
  icon: icon,
9525
9554
  testID: "".concat(testID, "-left-icon"),
9526
- themeButtonVariant: themeVariant
9555
+ themeButtonVariant: themeVariant,
9556
+ themeIsPressed: isPressed
9527
9557
  }) : icon), isTextVariant(themeVariant) ? /*#__PURE__*/React__default.createElement(StyledButtonTitleOfVariantText, {
9528
9558
  variant: "regular-bold",
9529
9559
  ellipsizeMode: "tail",
9530
9560
  numberOfLines: 1,
9531
9561
  disabled: disabled,
9532
- themeButtonVariant: themeVariant
9562
+ themeButtonVariant: themeVariant,
9563
+ themeIsPressed: isPressed
9533
9564
  }, text) : /*#__PURE__*/React__default.createElement(StyledButtonText, {
9534
9565
  level: "h5",
9535
9566
  ellipsizeMode: "tail",
@@ -9542,7 +9573,8 @@ var Button = function Button(_ref) {
9542
9573
  disabled: disabled,
9543
9574
  icon: rightIcon,
9544
9575
  testID: "".concat(testID, "-right-icon"),
9545
- themeButtonVariant: themeVariant
9576
+ themeButtonVariant: themeVariant,
9577
+ themeIsPressed: isPressed
9546
9578
  }) : rightIcon)));
9547
9579
  };
9548
9580
 
@@ -13144,8 +13176,22 @@ var StyledChipWrapper = index$a(TouchableOpacity)(function (_ref) {
13144
13176
  borderRadius: theme.__hd__.chip.radii.wrapper
13145
13177
  }, getShadowStyles()), getBorderStyles()), getPaddingStyles()), getBackgroundStyles());
13146
13178
  });
13179
+ var StyledChipIcon = index$a(Icon)(function (_ref2) {
13180
+ var theme = _ref2.theme;
13181
+ return {
13182
+ fontSize: theme.__hd__.chip.fontSizes.icon
13183
+ };
13184
+ });
13147
13185
 
13148
13186
  var _excluded$s = ["label", "variant", "selected", "icon", "onPress", "showSelectedIcon"];
13187
+ var getChipLabel = function getChipLabel(label) {
13188
+ if (typeof label === 'string') {
13189
+ return /*#__PURE__*/React__default.createElement(Typography.Body, {
13190
+ variant: "small"
13191
+ }, label);
13192
+ }
13193
+ return label;
13194
+ };
13149
13195
  var Chip = function Chip(_ref) {
13150
13196
  var label = _ref.label,
13151
13197
  _ref$variant = _ref.variant,
@@ -13157,21 +13203,22 @@ var Chip = function Chip(_ref) {
13157
13203
  _ref$showSelectedIcon = _ref.showSelectedIcon,
13158
13204
  showSelectedIcon = _ref$showSelectedIcon === void 0 ? true : _ref$showSelectedIcon,
13159
13205
  otherProps = _objectWithoutProperties(_ref, _excluded$s);
13160
- var shouldShowSelectedIcon = variant === 'outlined' && selected && showSelectedIcon;
13206
+ var shouldShowSelectedIcon = (variant === 'outlined' || variant === 'compact-outlined') && selected && showSelectedIcon;
13207
+ var chipLabel = useMemo(function () {
13208
+ return getChipLabel(label);
13209
+ }, [label]);
13161
13210
  return /*#__PURE__*/React__default.createElement(StyledChipWrapper, _extends$1({
13162
13211
  onPress: onPress,
13163
13212
  themeVariant: variant,
13164
13213
  themeSelected: selected
13165
13214
  }, otherProps), icon && /*#__PURE__*/React__default.createElement(Box, {
13166
13215
  marginRight: "small"
13167
- }, /*#__PURE__*/React__default.createElement(Icon, {
13168
- size: "xsmall",
13216
+ }, /*#__PURE__*/React__default.createElement(StyledChipIcon, {
13169
13217
  icon: icon,
13170
13218
  testID: "chip-icon-".concat(icon)
13171
- })), /*#__PURE__*/React__default.createElement(Typography.Body, null, label), shouldShowSelectedIcon && /*#__PURE__*/React__default.createElement(Box, {
13219
+ })), chipLabel, shouldShowSelectedIcon && /*#__PURE__*/React__default.createElement(Box, {
13172
13220
  marginLeft: "small"
13173
- }, /*#__PURE__*/React__default.createElement(Icon, {
13174
- size: "xsmall",
13221
+ }, /*#__PURE__*/React__default.createElement(StyledChipIcon, {
13175
13222
  icon: "cancel",
13176
13223
  testID: "selected-chip-icon-cancel"
13177
13224
  })));
@@ -19070,6 +19117,9 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
19070
19117
  var is12Hour = displayFormat.includes('hh');
19071
19118
  var displayValue = value ? format(displayFormat, value) : '';
19072
19119
  var theme = useTheme();
19120
+ useEffect(function () {
19121
+ setSelectingDate(value || new Date());
19122
+ }, [value]);
19073
19123
  return /*#__PURE__*/React__default.createElement(TouchableOpacity, {
19074
19124
  onPress: function onPress() {
19075
19125
  return setOpen(true);
package/lib/index.js CHANGED
@@ -2510,6 +2510,11 @@ var getButtonTheme = function getButtonTheme(theme) {
2510
2510
  textPrimary: theme.colors.highlightedSurface,
2511
2511
  textSecondary: theme.colors.neutralGlobalSurface,
2512
2512
  textDanger: theme.colors.errorSurface
2513
+ },
2514
+ pressedText: {
2515
+ primary: theme.colors.pressedSurface,
2516
+ secondary: theme.colors.onDefaultGlobalSurface,
2517
+ danger: theme.colors.mutedError
2513
2518
  }
2514
2519
  };
2515
2520
  var lineHeights = {
@@ -2693,12 +2698,16 @@ var getChipTheme = function getChipTheme(theme) {
2693
2698
  var shadows = {
2694
2699
  filledWrapper: theme.shadows["default"]
2695
2700
  };
2701
+ var fontSizes = {
2702
+ icon: theme.fontSizes.small
2703
+ };
2696
2704
  return {
2697
2705
  colors: colors,
2698
2706
  space: space,
2699
2707
  radii: radii,
2700
2708
  borderWidths: borderWidths,
2701
- shadows: shadows
2709
+ shadows: shadows,
2710
+ fontSizes: fontSizes
2702
2711
  };
2703
2712
  };
2704
2713
 
@@ -9313,12 +9322,17 @@ var genOutlineContainerStyles = function genOutlineContainerStyles(theme, intent
9313
9322
  backgroundColor: 'transparent'
9314
9323
  }, borderColorStyling());
9315
9324
  };
9316
- var genTextStyles = function genTextStyles(theme, intent, disabled) {
9325
+ var genTextStyles = function genTextStyles(theme, intent, disabled, isPressed) {
9317
9326
  if (disabled) {
9318
9327
  return {
9319
9328
  color: theme.__hd__.button.colors.disabledText
9320
9329
  };
9321
9330
  }
9331
+ if (isPressed) {
9332
+ return {
9333
+ color: theme.__hd__.button.colors.pressedText[intent]
9334
+ };
9335
+ }
9322
9336
  return {
9323
9337
  color: theme.__hd__.button.colors[intent]
9324
9338
  };
@@ -9329,6 +9343,7 @@ var StyledButtonContainer = index$a(reactNative.TouchableHighlight)(function (_r
9329
9343
  _ref$loading = _ref.loading,
9330
9344
  loading = _ref$loading === void 0 ? false : _ref$loading,
9331
9345
  themeButtonVariant = _ref.themeButtonVariant,
9346
+ themeInlineText = _ref.themeInlineText,
9332
9347
  theme = _ref.theme;
9333
9348
  switch (themeButtonVariant) {
9334
9349
  case 'filled-primary':
@@ -9347,14 +9362,14 @@ var StyledButtonContainer = index$a(reactNative.TouchableHighlight)(function (_r
9347
9362
  case 'text-secondary':
9348
9363
  case 'text-danger':
9349
9364
  return {
9350
- height: scale(60),
9365
+ height: themeInlineText ? undefined : scale(60),
9351
9366
  borderRadius: theme.__hd__.button.radii.text,
9352
9367
  flexDirection: 'row',
9353
9368
  justifyContent: 'center',
9354
9369
  alignItems: 'center',
9355
- padding: theme.__hd__.button.space.textButtonPadding,
9370
+ padding: themeInlineText ? 0 : theme.__hd__.button.space.textButtonPadding,
9356
9371
  borderWidth: 0,
9357
- backgroundColor: loading ? theme.__hd__.button.colors.textLoadingBackground : 'transparent'
9372
+ backgroundColor: loading && !themeInlineText ? theme.__hd__.button.colors.textLoadingBackground : 'transparent'
9358
9373
  };
9359
9374
  }
9360
9375
  });
@@ -9392,15 +9407,16 @@ var StyledButtonText = index$a(Typography.Title)(function (_ref2) {
9392
9407
  var StyledButtonTitleOfVariantText = index$a(Typography.Body)(function (_ref3) {
9393
9408
  var disabled = _ref3.disabled,
9394
9409
  themeButtonVariant = _ref3.themeButtonVariant,
9410
+ themeIsPressed = _ref3.themeIsPressed,
9395
9411
  theme = _ref3.theme;
9396
9412
  var themeStyling = function themeStyling() {
9397
9413
  switch (themeButtonVariant) {
9398
9414
  case 'text-primary':
9399
- return genTextStyles(theme, 'primary', disabled);
9415
+ return genTextStyles(theme, 'primary', disabled, themeIsPressed);
9400
9416
  case 'text-secondary':
9401
- return genTextStyles(theme, 'secondary', disabled);
9417
+ return genTextStyles(theme, 'secondary', disabled, themeIsPressed);
9402
9418
  case 'text-danger':
9403
- return genTextStyles(theme, 'danger', disabled);
9419
+ return genTextStyles(theme, 'danger', disabled, themeIsPressed);
9404
9420
  }
9405
9421
  };
9406
9422
  return _objectSpread2({
@@ -9426,6 +9442,7 @@ var StyledButtonIconWrapper = index$a(reactNative.View)(function (_ref4) {
9426
9442
  var StyledButtonIcon = index$a(Icon)(function (_ref5) {
9427
9443
  var disabled = _ref5.disabled,
9428
9444
  themeButtonVariant = _ref5.themeButtonVariant,
9445
+ themeIsPressed = _ref5.themeIsPressed,
9429
9446
  theme = _ref5.theme;
9430
9447
  var themeStyling = function themeStyling() {
9431
9448
  switch (themeButtonVariant) {
@@ -9442,11 +9459,11 @@ var StyledButtonIcon = index$a(Icon)(function (_ref5) {
9442
9459
  case 'outlined-danger':
9443
9460
  return genTextStyles(theme, 'danger', disabled);
9444
9461
  case 'text-primary':
9445
- return genTextStyles(theme, 'primary', disabled);
9462
+ return genTextStyles(theme, 'primary', disabled, themeIsPressed);
9446
9463
  case 'text-secondary':
9447
- return genTextStyles(theme, 'secondary', disabled);
9464
+ return genTextStyles(theme, 'secondary', disabled, themeIsPressed);
9448
9465
  case 'text-danger':
9449
- return genTextStyles(theme, 'danger', disabled);
9466
+ return genTextStyles(theme, 'danger', disabled, themeIsPressed);
9450
9467
  }
9451
9468
  };
9452
9469
  return _objectSpread2({
@@ -9525,11 +9542,16 @@ var Button = function Button(_ref) {
9525
9542
  text = _ref.text,
9526
9543
  _ref$variant = _ref.variant,
9527
9544
  variant = _ref$variant === void 0 ? 'filled' : _ref$variant;
9528
- var themeVariant = getThemeVariant(variant, intent);
9545
+ var isInlineText = variant === 'inline-text';
9546
+ var themeVariant = getThemeVariant(isInlineText ? 'text' : variant, intent);
9529
9547
  var theme = useTheme();
9530
9548
  var underlayColor = React.useMemo(function () {
9531
- return getUnderlayColor(theme, themeVariant);
9532
- }, [theme, themeVariant]);
9549
+ return isInlineText ? 'transparent' : getUnderlayColor(theme, themeVariant);
9550
+ }, [theme, themeVariant, isInlineText]);
9551
+ var _useState = React.useState(false),
9552
+ _useState2 = _slicedToArray(_useState, 2),
9553
+ isPressed = _useState2[0],
9554
+ setIsPressed = _useState2[1];
9533
9555
  useDeprecation("Button variant ".concat(deprecatedVariants.join(', '), " are deprecated."), deprecatedVariants.includes(themeVariant));
9534
9556
  return /*#__PURE__*/React__namespace.default.createElement(StyledButtonContainer, {
9535
9557
  accessibilityHint: accessibilityHint,
@@ -9540,7 +9562,14 @@ var Button = function Button(_ref) {
9540
9562
  testID: testID,
9541
9563
  themeButtonVariant: themeVariant,
9542
9564
  style: style,
9543
- underlayColor: underlayColor
9565
+ underlayColor: underlayColor,
9566
+ themeInlineText: isInlineText,
9567
+ onPressIn: function onPressIn() {
9568
+ return isInlineText && setIsPressed(true);
9569
+ },
9570
+ onPressOut: function onPressOut() {
9571
+ return isInlineText && setIsPressed(false);
9572
+ }
9544
9573
  }, loading === true ? /*#__PURE__*/React__namespace.default.createElement(LoadingIndicator, {
9545
9574
  testID: "".concat(testID, "-loading-indicator"),
9546
9575
  themeVariant: themeVariant
@@ -9550,13 +9579,15 @@ var Button = function Button(_ref) {
9550
9579
  disabled: disabled,
9551
9580
  icon: icon,
9552
9581
  testID: "".concat(testID, "-left-icon"),
9553
- themeButtonVariant: themeVariant
9582
+ themeButtonVariant: themeVariant,
9583
+ themeIsPressed: isPressed
9554
9584
  }) : icon), isTextVariant(themeVariant) ? /*#__PURE__*/React__namespace.default.createElement(StyledButtonTitleOfVariantText, {
9555
9585
  variant: "regular-bold",
9556
9586
  ellipsizeMode: "tail",
9557
9587
  numberOfLines: 1,
9558
9588
  disabled: disabled,
9559
- themeButtonVariant: themeVariant
9589
+ themeButtonVariant: themeVariant,
9590
+ themeIsPressed: isPressed
9560
9591
  }, text) : /*#__PURE__*/React__namespace.default.createElement(StyledButtonText, {
9561
9592
  level: "h5",
9562
9593
  ellipsizeMode: "tail",
@@ -9569,7 +9600,8 @@ var Button = function Button(_ref) {
9569
9600
  disabled: disabled,
9570
9601
  icon: rightIcon,
9571
9602
  testID: "".concat(testID, "-right-icon"),
9572
- themeButtonVariant: themeVariant
9603
+ themeButtonVariant: themeVariant,
9604
+ themeIsPressed: isPressed
9573
9605
  }) : rightIcon)));
9574
9606
  };
9575
9607
 
@@ -13171,8 +13203,22 @@ var StyledChipWrapper = index$a(reactNative.TouchableOpacity)(function (_ref) {
13171
13203
  borderRadius: theme.__hd__.chip.radii.wrapper
13172
13204
  }, getShadowStyles()), getBorderStyles()), getPaddingStyles()), getBackgroundStyles());
13173
13205
  });
13206
+ var StyledChipIcon = index$a(Icon)(function (_ref2) {
13207
+ var theme = _ref2.theme;
13208
+ return {
13209
+ fontSize: theme.__hd__.chip.fontSizes.icon
13210
+ };
13211
+ });
13174
13212
 
13175
13213
  var _excluded$s = ["label", "variant", "selected", "icon", "onPress", "showSelectedIcon"];
13214
+ var getChipLabel = function getChipLabel(label) {
13215
+ if (typeof label === 'string') {
13216
+ return /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
13217
+ variant: "small"
13218
+ }, label);
13219
+ }
13220
+ return label;
13221
+ };
13176
13222
  var Chip = function Chip(_ref) {
13177
13223
  var label = _ref.label,
13178
13224
  _ref$variant = _ref.variant,
@@ -13184,21 +13230,22 @@ var Chip = function Chip(_ref) {
13184
13230
  _ref$showSelectedIcon = _ref.showSelectedIcon,
13185
13231
  showSelectedIcon = _ref$showSelectedIcon === void 0 ? true : _ref$showSelectedIcon,
13186
13232
  otherProps = _objectWithoutProperties(_ref, _excluded$s);
13187
- var shouldShowSelectedIcon = variant === 'outlined' && selected && showSelectedIcon;
13233
+ var shouldShowSelectedIcon = (variant === 'outlined' || variant === 'compact-outlined') && selected && showSelectedIcon;
13234
+ var chipLabel = React.useMemo(function () {
13235
+ return getChipLabel(label);
13236
+ }, [label]);
13188
13237
  return /*#__PURE__*/React__namespace.default.createElement(StyledChipWrapper, _extends$1({
13189
13238
  onPress: onPress,
13190
13239
  themeVariant: variant,
13191
13240
  themeSelected: selected
13192
13241
  }, otherProps), icon && /*#__PURE__*/React__namespace.default.createElement(Box, {
13193
13242
  marginRight: "small"
13194
- }, /*#__PURE__*/React__namespace.default.createElement(Icon, {
13195
- size: "xsmall",
13243
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledChipIcon, {
13196
13244
  icon: icon,
13197
13245
  testID: "chip-icon-".concat(icon)
13198
- })), /*#__PURE__*/React__namespace.default.createElement(Typography.Body, null, label), shouldShowSelectedIcon && /*#__PURE__*/React__namespace.default.createElement(Box, {
13246
+ })), chipLabel, shouldShowSelectedIcon && /*#__PURE__*/React__namespace.default.createElement(Box, {
13199
13247
  marginLeft: "small"
13200
- }, /*#__PURE__*/React__namespace.default.createElement(Icon, {
13201
- size: "xsmall",
13248
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledChipIcon, {
13202
13249
  icon: "cancel",
13203
13250
  testID: "selected-chip-icon-cancel"
13204
13251
  })));
@@ -19097,6 +19144,9 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
19097
19144
  var is12Hour = displayFormat.includes('hh');
19098
19145
  var displayValue = value ? format(displayFormat, value) : '';
19099
19146
  var theme = useTheme();
19147
+ React.useEffect(function () {
19148
+ setSelectingDate(value || new Date());
19149
+ }, [value]);
19100
19150
  return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
19101
19151
  onPress: function onPress() {
19102
19152
  return setOpen(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.80.1",
3
+ "version": "8.81.1-alpha.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -93,5 +93,6 @@
93
93
  "ts-jest": "^29.1.1",
94
94
  "typescript": "4.8.4"
95
95
  },
96
- "prettier": "prettier-config-hd"
96
+ "prettier": "prettier-config-hd",
97
+ "react-native": "src/index.ts"
97
98
  }
@@ -1,4 +1,4 @@
1
- import React, { ReactChild, ReactNode, useMemo } from 'react';
1
+ import React, { ReactChild, ReactNode, useMemo, useState } from 'react';
2
2
  import type { StyleProp, ViewStyle } from 'react-native';
3
3
  import { Theme, useTheme } from '../../theme';
4
4
  import { useDeprecation } from '../../utils/hooks';
@@ -61,7 +61,7 @@ export interface ButtonProps {
61
61
  /**
62
62
  * Button type.
63
63
  */
64
- variant?: 'filled' | 'outlined' | 'text';
64
+ variant?: 'filled' | 'outlined' | 'text' | 'inline-text';
65
65
  }
66
66
 
67
67
  const isIconName = (icon: IconName | ReactNode): icon is IconName => {
@@ -151,11 +151,13 @@ const Button = ({
151
151
  text,
152
152
  variant = 'filled',
153
153
  }: ButtonProps): JSX.Element => {
154
- const themeVariant = getThemeVariant(variant, intent);
154
+ const isInlineText = variant === 'inline-text';
155
+ const themeVariant = getThemeVariant(isInlineText ? 'text' : variant, intent);
155
156
  const theme = useTheme();
156
157
  const underlayColor = useMemo(() => {
157
- return getUnderlayColor(theme, themeVariant);
158
- }, [theme, themeVariant]);
158
+ return isInlineText ? 'transparent' : getUnderlayColor(theme, themeVariant);
159
+ }, [theme, themeVariant, isInlineText]);
160
+ const [isPressed, setIsPressed] = useState(false);
159
161
 
160
162
  useDeprecation(
161
163
  `Button variant ${deprecatedVariants.join(', ')} are deprecated.`,
@@ -173,6 +175,9 @@ const Button = ({
173
175
  themeButtonVariant={themeVariant}
174
176
  style={style}
175
177
  underlayColor={underlayColor}
178
+ themeInlineText={isInlineText}
179
+ onPressIn={() => isInlineText && setIsPressed(true)}
180
+ onPressOut={() => isInlineText && setIsPressed(false)}
176
181
  >
177
182
  {loading === true ? (
178
183
  <LoadingIndicator
@@ -189,6 +194,7 @@ const Button = ({
189
194
  icon={icon}
190
195
  testID={`${testID}-left-icon`}
191
196
  themeButtonVariant={themeVariant}
197
+ themeIsPressed={isPressed}
192
198
  />
193
199
  ) : (
194
200
  icon
@@ -202,6 +208,7 @@ const Button = ({
202
208
  numberOfLines={1}
203
209
  disabled={disabled}
204
210
  themeButtonVariant={themeVariant}
211
+ themeIsPressed={isPressed}
205
212
  >
206
213
  {text}
207
214
  </StyledButtonTitleOfVariantText>
@@ -224,6 +231,7 @@ const Button = ({
224
231
  icon={rightIcon}
225
232
  testID={`${testID}-right-icon`}
226
233
  themeButtonVariant={themeVariant}
234
+ themeIsPressed={isPressed}
227
235
  />
228
236
  ) : (
229
237
  rightIcon