@hero-design/rn 7.28.0 → 7.29.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 (80) hide show
  1. package/.eslintrc.js +2 -1
  2. package/.turbo/turbo-build.log +9 -9
  3. package/es/index.js +119 -95
  4. package/lib/index.js +119 -95
  5. package/package.json +5 -4
  6. package/src/components/Alert/index.tsx +1 -0
  7. package/src/components/BottomSheet/Header.tsx +1 -1
  8. package/src/components/BottomSheet/StyledBottomSheet.tsx +1 -2
  9. package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +12 -14
  10. package/src/components/DatePicker/DatePickerIOS.tsx +5 -11
  11. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +1 -0
  12. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +35 -16
  13. package/src/components/Empty/StyledEmpty.tsx +1 -1
  14. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +10 -10
  15. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
  16. package/src/components/FAB/ActionGroup/index.tsx +1 -1
  17. package/src/components/List/ListItem.tsx +2 -2
  18. package/src/components/Progress/ProgressCircle.tsx +1 -1
  19. package/src/components/Select/{StyledOptionList.tsx → BaseOptionList.tsx} +6 -6
  20. package/src/components/Select/Footer.tsx +2 -7
  21. package/src/components/Select/MultiSelect/Option.tsx +24 -11
  22. package/src/components/Select/MultiSelect/OptionList.tsx +3 -2
  23. package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +3 -2
  24. package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +47 -21
  25. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +204 -107
  26. package/src/components/Select/MultiSelect/index.tsx +16 -0
  27. package/src/components/Select/SingleSelect/Option.tsx +12 -12
  28. package/src/components/Select/SingleSelect/OptionList.tsx +3 -2
  29. package/src/components/Select/SingleSelect/StyledSingleSelect.tsx +6 -0
  30. package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +0 -1
  31. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +32 -16
  32. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +70 -54
  33. package/src/components/Select/SingleSelect/index.tsx +16 -0
  34. package/src/components/Select/StyledSelect.tsx +6 -7
  35. package/src/components/Select/types.ts +1 -0
  36. package/src/components/Tabs/ScrollableTabs.tsx +1 -1
  37. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +9 -3
  38. package/src/components/Tag/index.tsx +2 -2
  39. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +12 -0
  40. package/src/components/TextInput/__tests__/index.spec.tsx +4 -2
  41. package/src/components/TextInput/index.tsx +7 -1
  42. package/src/components/TimePicker/TimePickerIOS.tsx +5 -11
  43. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +1 -0
  44. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +35 -16
  45. package/src/components/Toast/ToastContainer.tsx +1 -1
  46. package/src/components/Toast/ToastProvider.tsx +10 -1
  47. package/src/components/Toast/__tests__/ToastContainer.spec.tsx +5 -5
  48. package/src/components/Toast/__tests__/__snapshots__/ToastContainer.spec.tsx.snap +4 -4
  49. package/src/components/Typography/Text/StyledText.tsx +2 -1
  50. package/src/components/Typography/Text/index.tsx +2 -1
  51. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +19 -15
  52. package/src/theme/components/bottomSheet.ts +4 -5
  53. package/src/theme/components/empty.ts +6 -5
  54. package/src/theme/components/fab.ts +1 -1
  55. package/src/theme/components/select.ts +4 -6
  56. package/src/theme/components/typography.ts +2 -0
  57. package/src/theme/global/colors/global.ts +1 -0
  58. package/src/theme/global/colors/types.ts +1 -0
  59. package/src/theme/global/typography.ts +4 -1
  60. package/types/components/Alert/index.d.ts +1 -0
  61. package/types/components/List/ListItem.d.ts +2 -2
  62. package/types/components/Select/{StyledOptionList.d.ts → BaseOptionList.d.ts} +3 -3
  63. package/types/components/Select/MultiSelect/Option.d.ts +2 -1
  64. package/types/components/Select/SingleSelect/Option.d.ts +2 -1
  65. package/types/components/Select/SingleSelect/StyledSingleSelect.d.ts +1 -0
  66. package/types/components/Select/StyledSelect.d.ts +3 -6
  67. package/types/components/Select/types.d.ts +1 -0
  68. package/types/components/Toast/ToastProvider.d.ts +1 -1
  69. package/types/components/Toast/index.d.ts +1 -1
  70. package/types/components/Typography/Text/StyledText.d.ts +1 -1
  71. package/types/components/Typography/Text/index.d.ts +1 -1
  72. package/types/theme/components/bottomSheet.d.ts +0 -1
  73. package/types/theme/components/empty.d.ts +1 -0
  74. package/types/theme/components/select.d.ts +3 -4
  75. package/types/theme/components/typography.d.ts +2 -0
  76. package/types/theme/global/colors/types.d.ts +1 -0
  77. package/types/theme/global/index.d.ts +1 -0
  78. package/types/theme/global/typography.d.ts +1 -0
  79. package/src/components/Select/__tests__/StyledSelect.spec.tsx +0 -14
  80. package/src/components/Select/__tests__/__snapshots__/StyledSelect.spec.tsx.snap +0 -29
@@ -4,6 +4,7 @@ import type {
4
4
  TextInputProps as NativeTextInputProps,
5
5
  } from 'react-native';
6
6
  import { TouchableOpacity, View } from 'react-native';
7
+ import { useDeprecation } from '../../../utils/hooks';
7
8
  import BottomSheet from '../../BottomSheet';
8
9
  import Box from '../../Box';
9
10
  import TextInput from '../../TextInput';
@@ -83,6 +84,21 @@ function MultiSelect<V, T extends OptionType<V>>({
83
84
  .map((opt) => opt.text)
84
85
  .join(', ');
85
86
 
87
+ useDeprecation(
88
+ "Select's onDimiss is deprecated and will be removed in the next major release. Please use onDismiss instead.",
89
+ onDimiss !== undefined
90
+ );
91
+
92
+ useDeprecation(
93
+ "Select's numberOfLines is deprecated and will be removed in the next major release. Please use inputProps.numberOfLines instead.",
94
+ numberOfLines !== undefined
95
+ );
96
+
97
+ useDeprecation(
98
+ "Select's inputProps.required is deprecated and will be removed in the next major release. Please use Select's required prop instead.",
99
+ inputProps?.required !== undefined
100
+ );
101
+
86
102
  useEffect(() => {
87
103
  setSelectingValue(value);
88
104
  }, [open]);
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import type { ReactElement } from 'react';
3
- import { useTheme } from '../../../theme';
4
3
  import List from '../../List';
5
4
 
6
5
  const Option = ({
@@ -8,23 +7,24 @@ const Option = ({
8
7
  disabled = false,
9
8
  selected,
10
9
  onPress,
10
+ highlighted = false,
11
11
  }: {
12
12
  text: string | ReactElement;
13
13
  disabled?: boolean;
14
14
  selected: boolean;
15
15
  onPress: () => void;
16
+ highlighted?: boolean;
16
17
  }) => {
17
- const theme = useTheme();
18
- return (
19
- <List.BasicItem
20
- selected={selected}
21
- disabled={disabled}
22
- onPress={onPress}
23
- title={text}
24
- style={{
25
- marginHorizontal: theme.__hd__.select.space.optionHorizontalMargin,
26
- }}
27
- />
18
+ const props = {
19
+ selected,
20
+ disabled,
21
+ onPress,
22
+ title: text,
23
+ };
24
+ return highlighted === true ? (
25
+ <List.Item {...props} />
26
+ ) : (
27
+ <List.BasicItem {...props} />
28
28
  );
29
29
  };
30
30
 
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import type { SectionListRenderItemInfo, SectionList } from 'react-native';
3
- import StyledOptionList from '../StyledOptionList';
4
3
  import Option from './Option';
5
4
  import type { SingleSelectProps } from '.';
6
5
  import type { OptionType, SectionData, SectionType } from '../types';
6
+ import { StyledOptionList } from './StyledSingleSelect';
7
7
 
8
8
  type OptionListProps<V, T extends OptionType<V>> = Pick<
9
9
  SingleSelectProps<V, T>,
@@ -49,12 +49,13 @@ const OptionList = <V, T extends OptionType<V>>({
49
49
  text={item.text}
50
50
  disabled={item.disabled}
51
51
  onPress={onItemPress}
52
+ highlighted={item.highlighted}
52
53
  />
53
54
  );
54
55
  };
55
56
 
56
57
  return (
57
- <StyledOptionList
58
+ <StyledOptionList<V, T>
58
59
  keyExtractor={keyExtractor}
59
60
  loading={loading}
60
61
  onEndReached={onEndReached}
@@ -0,0 +1,6 @@
1
+ import styled from '@emotion/native';
2
+ import BaseOptionList from '../BaseOptionList';
3
+
4
+ export const StyledOptionList = styled(BaseOptionList)(({ theme }) => ({
5
+ paddingBottom: theme.__hd__.select.space.singleSelectContentPaddingBottom,
6
+ })) as typeof BaseOptionList;
@@ -19,7 +19,6 @@ exports[`Option renders correctly 1`] = `
19
19
  "backgroundColor": "#ece8ef",
20
20
  "borderRadius": 4,
21
21
  "flexDirection": "row",
22
- "marginHorizontal": 12,
23
22
  "opacity": 1,
24
23
  "padding": 16,
25
24
  }
@@ -61,7 +61,14 @@ exports[`OptionList render isLoading correctly 1`] = `
61
61
  3,
62
62
  ]
63
63
  }
64
- style={Object {}}
64
+ style={
65
+ Array [
66
+ Object {
67
+ "paddingHorizontal": 12,
68
+ },
69
+ Object {},
70
+ ]
71
+ }
65
72
  >
66
73
  <View>
67
74
  <View
@@ -197,7 +204,6 @@ exports[`OptionList render isLoading correctly 1`] = `
197
204
  "backgroundColor": "#ece8ef",
198
205
  "borderRadius": 4,
199
206
  "flexDirection": "row",
200
- "marginHorizontal": 12,
201
207
  "opacity": 1,
202
208
  "padding": 16,
203
209
  }
@@ -417,7 +423,6 @@ exports[`OptionList render isLoading correctly 1`] = `
417
423
  "backgroundColor": "#ffffff",
418
424
  "borderRadius": 4,
419
425
  "flexDirection": "row",
420
- "marginHorizontal": 12,
421
426
  "opacity": 1,
422
427
  "padding": 16,
423
428
  }
@@ -529,7 +534,6 @@ exports[`OptionList render isLoading correctly 1`] = `
529
534
  "backgroundColor": "#ffffff",
530
535
  "borderRadius": 4,
531
536
  "flexDirection": "row",
532
- "marginHorizontal": 12,
533
537
  "opacity": 1,
534
538
  "padding": 16,
535
539
  }
@@ -829,7 +833,14 @@ exports[`OptionList renders correctly 1`] = `
829
833
  3,
830
834
  ]
831
835
  }
832
- style={Object {}}
836
+ style={
837
+ Array [
838
+ Object {
839
+ "paddingHorizontal": 12,
840
+ },
841
+ Object {},
842
+ ]
843
+ }
833
844
  >
834
845
  <View>
835
846
  <View
@@ -965,7 +976,6 @@ exports[`OptionList renders correctly 1`] = `
965
976
  "backgroundColor": "#ece8ef",
966
977
  "borderRadius": 4,
967
978
  "flexDirection": "row",
968
- "marginHorizontal": 12,
969
979
  "opacity": 1,
970
980
  "padding": 16,
971
981
  }
@@ -1185,7 +1195,6 @@ exports[`OptionList renders correctly 1`] = `
1185
1195
  "backgroundColor": "#ffffff",
1186
1196
  "borderRadius": 4,
1187
1197
  "flexDirection": "row",
1188
- "marginHorizontal": 12,
1189
1198
  "opacity": 1,
1190
1199
  "padding": 16,
1191
1200
  }
@@ -1297,7 +1306,6 @@ exports[`OptionList renders correctly 1`] = `
1297
1306
  "backgroundColor": "#ffffff",
1298
1307
  "borderRadius": 4,
1299
1308
  "flexDirection": "row",
1300
- "marginHorizontal": 12,
1301
1309
  "opacity": 1,
1302
1310
  "padding": 16,
1303
1311
  }
@@ -1437,7 +1445,14 @@ exports[`OptionList trigger onPress correctly on select new value 1`] = `
1437
1445
  3,
1438
1446
  ]
1439
1447
  }
1440
- style={Object {}}
1448
+ style={
1449
+ Array [
1450
+ Object {
1451
+ "paddingHorizontal": 12,
1452
+ },
1453
+ Object {},
1454
+ ]
1455
+ }
1441
1456
  >
1442
1457
  <View>
1443
1458
  <View
@@ -1573,7 +1588,6 @@ exports[`OptionList trigger onPress correctly on select new value 1`] = `
1573
1588
  "backgroundColor": "#ece8ef",
1574
1589
  "borderRadius": 4,
1575
1590
  "flexDirection": "row",
1576
- "marginHorizontal": 12,
1577
1591
  "opacity": 1,
1578
1592
  "padding": 16,
1579
1593
  }
@@ -1793,7 +1807,6 @@ exports[`OptionList trigger onPress correctly on select new value 1`] = `
1793
1807
  "backgroundColor": "#ffffff",
1794
1808
  "borderRadius": 4,
1795
1809
  "flexDirection": "row",
1796
- "marginHorizontal": 12,
1797
1810
  "opacity": 1,
1798
1811
  "padding": 16,
1799
1812
  }
@@ -1905,7 +1918,6 @@ exports[`OptionList trigger onPress correctly on select new value 1`] = `
1905
1918
  "backgroundColor": "#ffffff",
1906
1919
  "borderRadius": 4,
1907
1920
  "flexDirection": "row",
1908
- "marginHorizontal": 12,
1909
1921
  "opacity": 1,
1910
1922
  "padding": 16,
1911
1923
  }
@@ -2045,7 +2057,14 @@ exports[`OptionList trigger onPress correctly on unselect current value 1`] = `
2045
2057
  3,
2046
2058
  ]
2047
2059
  }
2048
- style={Object {}}
2060
+ style={
2061
+ Array [
2062
+ Object {
2063
+ "paddingHorizontal": 12,
2064
+ },
2065
+ Object {},
2066
+ ]
2067
+ }
2049
2068
  >
2050
2069
  <View>
2051
2070
  <View
@@ -2181,7 +2200,6 @@ exports[`OptionList trigger onPress correctly on unselect current value 1`] = `
2181
2200
  "backgroundColor": "#ece8ef",
2182
2201
  "borderRadius": 4,
2183
2202
  "flexDirection": "row",
2184
- "marginHorizontal": 12,
2185
2203
  "opacity": 1,
2186
2204
  "padding": 16,
2187
2205
  }
@@ -2401,7 +2419,6 @@ exports[`OptionList trigger onPress correctly on unselect current value 1`] = `
2401
2419
  "backgroundColor": "#ffffff",
2402
2420
  "borderRadius": 4,
2403
2421
  "flexDirection": "row",
2404
- "marginHorizontal": 12,
2405
2422
  "opacity": 1,
2406
2423
  "padding": 16,
2407
2424
  }
@@ -2513,7 +2530,6 @@ exports[`OptionList trigger onPress correctly on unselect current value 1`] = `
2513
2530
  "backgroundColor": "#ffffff",
2514
2531
  "borderRadius": 4,
2515
2532
  "flexDirection": "row",
2516
- "marginHorizontal": 12,
2517
2533
  "opacity": 1,
2518
2534
  "padding": 16,
2519
2535
  }