@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
@@ -1,15 +1,15 @@
1
- import React from 'react';
1
+ import React, { ReactNode, useMemo } from 'react';
2
2
  import { ViewProps } from 'react-native';
3
3
  import Box from '../Box';
4
- import Icon, { IconName } from '../Icon';
4
+ import { IconName } from '../Icon';
5
5
  import Typography from '../Typography';
6
- import { StyledChipWrapper } from './StyledChip';
6
+ import { StyledChipIcon, StyledChipWrapper } from './StyledChip';
7
7
 
8
8
  export interface ChipProps extends ViewProps {
9
9
  /**
10
10
  * The label of the chip.
11
11
  */
12
- label: string;
12
+ label: string | ReactNode;
13
13
  /**
14
14
  * Variant of the chip.
15
15
  */
@@ -32,6 +32,14 @@ export interface ChipProps extends ViewProps {
32
32
  showSelectedIcon?: boolean;
33
33
  }
34
34
 
35
+ const getChipLabel = (label: string | ReactNode) => {
36
+ if (typeof label === 'string') {
37
+ return <Typography.Body variant="small">{label}</Typography.Body>;
38
+ }
39
+
40
+ return label;
41
+ };
42
+
35
43
  const Chip = ({
36
44
  label,
37
45
  variant = 'outlined',
@@ -42,7 +50,11 @@ const Chip = ({
42
50
  ...otherProps
43
51
  }: ChipProps) => {
44
52
  const shouldShowSelectedIcon =
45
- variant === 'outlined' && selected && showSelectedIcon;
53
+ (variant === 'outlined' || variant === 'compact-outlined') &&
54
+ selected &&
55
+ showSelectedIcon;
56
+
57
+ const chipLabel = useMemo(() => getChipLabel(label), [label]);
46
58
 
47
59
  return (
48
60
  <StyledChipWrapper
@@ -53,19 +65,15 @@ const Chip = ({
53
65
  >
54
66
  {icon && (
55
67
  <Box marginRight="small">
56
- <Icon size="xsmall" icon={icon} testID={`chip-icon-${icon}`} />
68
+ <StyledChipIcon icon={icon} testID={`chip-icon-${icon}`} />
57
69
  </Box>
58
70
  )}
59
71
 
60
- <Typography.Body>{label}</Typography.Body>
72
+ {chipLabel}
61
73
 
62
74
  {shouldShowSelectedIcon && (
63
75
  <Box marginLeft="small">
64
- <Icon
65
- size="xsmall"
66
- icon="cancel"
67
- testID="selected-chip-icon-cancel"
68
- />
76
+ <StyledChipIcon icon="cancel" testID="selected-chip-icon-cancel" />
69
77
  </Box>
70
78
  )}
71
79
  </StyledChipWrapper>
@@ -628,6 +628,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
628
628
  }
629
629
  themeButtonVariant="text-primary"
630
630
  themeIntent="body"
631
+ themeIsPressed={false}
631
632
  themeTypeface="neutral"
632
633
  themeVariant="regular-bold"
633
634
  >
@@ -1502,6 +1502,7 @@ exports[`rendering allows custom renderer 1`] = `
1502
1502
  }
1503
1503
  themeButtonVariant="text-primary"
1504
1504
  themeIntent="body"
1505
+ themeIsPressed={false}
1505
1506
  themeTypeface="neutral"
1506
1507
  themeVariant="regular-bold"
1507
1508
  >
@@ -3230,6 +3231,7 @@ exports[`rendering renders correct floating bottom sheet variant 1`] = `
3230
3231
  }
3231
3232
  themeButtonVariant="text-primary"
3232
3233
  themeIntent="body"
3234
+ themeIsPressed={false}
3233
3235
  themeTypeface="neutral"
3234
3236
  themeVariant="regular-bold"
3235
3237
  >
@@ -5260,6 +5262,7 @@ exports[`rendering renders correctly when bottom sheet is visible 1`] = `
5260
5262
  }
5261
5263
  themeButtonVariant="text-primary"
5262
5264
  themeIntent="body"
5265
+ themeIsPressed={false}
5263
5266
  themeTypeface="neutral"
5264
5267
  themeVariant="regular-bold"
5265
5268
  >
@@ -6882,6 +6885,7 @@ exports[`rendering renders correctly when receives sections 1`] = `
6882
6885
  }
6883
6886
  themeButtonVariant="text-primary"
6884
6887
  themeIntent="body"
6888
+ themeIsPressed={false}
6885
6889
  themeTypeface="neutral"
6886
6890
  themeVariant="regular-bold"
6887
6891
  >
@@ -8177,6 +8181,7 @@ exports[`rendering renders correctly when receives sections 2`] = `
8177
8181
  }
8178
8182
  themeButtonVariant="text-primary"
8179
8183
  themeIntent="body"
8184
+ themeIsPressed={false}
8180
8185
  themeTypeface="neutral"
8181
8186
  themeVariant="regular-bold"
8182
8187
  >
@@ -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">
@@ -914,6 +914,7 @@ exports[`TimePickerIOS renders correctly 1`] = `
914
914
  }
915
915
  themeButtonVariant="text-primary"
916
916
  themeIntent="body"
917
+ themeIsPressed={false}
917
918
  themeTypeface="neutral"
918
919
  themeVariant="regular-bold"
919
920
  >
@@ -247,6 +247,11 @@ exports[`theme returns correct theme object 1`] = `
247
247
  "textPrimary": "#ece8ef",
248
248
  "textSecondary": "#f6f6f7",
249
249
  },
250
+ "pressedText": {
251
+ "danger": "#f68282",
252
+ "primary": "#33144d",
253
+ "secondary": "#001f23",
254
+ },
250
255
  "primary": "#401960",
251
256
  "secondary": "#4d6265",
252
257
  "textLoadingBackground": "#ece8ef",
@@ -396,6 +401,9 @@ exports[`theme returns correct theme object 1`] = `
396
401
  "secondaryBackground": "#ece8ef",
397
402
  "wrapperSelectedBorder": "transparent",
398
403
  },
404
+ "fontSizes": {
405
+ "icon": 12,
406
+ },
399
407
  "radii": {
400
408
  "wrapper": 999,
401
409
  },
@@ -55,6 +55,11 @@ const getButtonTheme = (theme: GlobalTheme) => {
55
55
  textSecondary: theme.colors.neutralGlobalSurface,
56
56
  textDanger: theme.colors.errorSurface,
57
57
  },
58
+ pressedText: {
59
+ primary: theme.colors.pressedSurface,
60
+ secondary: theme.colors.onDefaultGlobalSurface,
61
+ danger: theme.colors.mutedError,
62
+ },
58
63
  };
59
64
 
60
65
  const lineHeights = {
@@ -33,12 +33,17 @@ const getChipTheme = (theme: GlobalTheme) => {
33
33
  filledWrapper: theme.shadows.default,
34
34
  };
35
35
 
36
+ const fontSizes = {
37
+ icon: theme.fontSizes.small,
38
+ };
39
+
36
40
  return {
37
41
  colors,
38
42
  space,
39
43
  radii,
40
44
  borderWidths,
41
45
  shadows,
46
+ fontSizes,
42
47
  };
43
48
  };
44
49