@hero-design/rn 8.103.2 → 8.103.4

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 (68) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/CHANGELOG.md +15 -0
  3. package/es/index.js +144 -106
  4. package/eslint.config.js +1 -0
  5. package/lib/index.js +144 -106
  6. package/package.json +3 -3
  7. package/src/components/DatePicker/DatePicker.tsx +38 -0
  8. package/src/components/DatePicker/DatePickerAndroid.tsx +6 -3
  9. package/src/components/DatePicker/DatePickerCalendar.tsx +6 -3
  10. package/src/components/DatePicker/DatePickerIOS.tsx +6 -3
  11. package/src/components/DatePicker/Dialog/IOSDialog.tsx +6 -1
  12. package/src/components/DatePicker/Dialog.tsx +15 -0
  13. package/src/components/DatePicker/StyledDatePicker.tsx +1 -0
  14. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +2 -0
  15. package/src/components/DatePicker/index.internal.tsx +10 -0
  16. package/src/components/DatePicker/index.tsx +6 -29
  17. package/src/components/DatePicker/types.ts +6 -0
  18. package/src/components/PinInput/PinCell.tsx +6 -1
  19. package/src/components/PinInput/StyledPinInput.tsx +2 -2
  20. package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +30 -0
  21. package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +287 -5
  22. package/src/components/PinInput/__tests__/index.spec.tsx +33 -0
  23. package/src/components/PinInput/index.tsx +6 -2
  24. package/src/components/Select/MultiSelect/index.tsx +15 -4
  25. package/src/components/Select/SingleSelect/index.tsx +15 -4
  26. package/src/components/Select/index.internal.tsx +13 -0
  27. package/src/components/Select/index.tsx +14 -2
  28. package/src/components/Select/types.ts +4 -0
  29. package/src/components/TimePicker/StyledTimePicker.tsx +1 -0
  30. package/src/components/TimePicker/TimePicker.tsx +15 -0
  31. package/src/components/TimePicker/TimePickerAndroid.tsx +6 -3
  32. package/src/components/TimePicker/TimePickerIOS.tsx +6 -3
  33. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +1 -0
  34. package/src/components/TimePicker/index.internal.tsx +9 -0
  35. package/src/components/TimePicker/index.tsx +4 -13
  36. package/src/components/TimePicker/types.ts +6 -0
  37. package/src/index.internal.ts +7 -0
  38. package/src/types.internal.ts +16 -0
  39. package/src/types.ts +4 -0
  40. package/stats/8.103.2/rn-stats.html +3 -1
  41. package/stats/8.103.3/rn-stats.html +4842 -0
  42. package/stats/8.103.4/rn-stats.html +4844 -0
  43. package/types/components/Calendar/CalendarRowItem.d.ts +1 -1
  44. package/types/components/Checkbox/index.d.ts +1 -1
  45. package/types/components/DatePicker/DatePicker.d.ts +4 -0
  46. package/types/components/DatePicker/DatePickerAndroid.d.ts +3 -3
  47. package/types/components/DatePicker/DatePickerCalendar.d.ts +2 -2
  48. package/types/components/DatePicker/DatePickerIOS.d.ts +3 -3
  49. package/types/components/DatePicker/Dialog.d.ts +4 -0
  50. package/types/components/DatePicker/index.d.ts +4 -5
  51. package/types/components/DatePicker/index.internal.d.ts +7 -0
  52. package/types/components/DatePicker/types.d.ts +4 -0
  53. package/types/components/PinInput/StyledPinInput.d.ts +2 -4
  54. package/types/components/Select/MultiSelect/index.d.ts +5 -1
  55. package/types/components/Select/SingleSelect/index.d.ts +5 -1
  56. package/types/components/Select/index.d.ts +5 -3
  57. package/types/components/Select/index.internal.d.ts +8 -0
  58. package/types/components/Select/types.d.ts +4 -0
  59. package/types/components/TextInput/index.d.ts +1 -1
  60. package/types/components/TimePicker/TimePicker.d.ts +4 -0
  61. package/types/components/TimePicker/TimePickerAndroid.d.ts +2 -2
  62. package/types/components/TimePicker/TimePickerIOS.d.ts +2 -2
  63. package/types/components/TimePicker/index.d.ts +3 -3
  64. package/types/components/TimePicker/index.internal.d.ts +5 -0
  65. package/types/components/TimePicker/types.d.ts +4 -0
  66. package/types/index.internal.d.ts +6 -0
  67. package/types/types.d.ts +3 -1
  68. package/types/types.internal.d.ts +5 -0
@@ -6,7 +6,7 @@ import type {
6
6
  import { TouchableOpacity, View } from 'react-native';
7
7
  import BottomSheet from '../../BottomSheet';
8
8
  import Box from '../../Box';
9
- import TextInput from '../../TextInput';
9
+ import TextInput, { TextInputProps } from '../../TextInput';
10
10
  import Footer from '../Footer';
11
11
  import { getScrollParams, toFlatOptions, toSections } from '../helpers';
12
12
  import { StyledSearchBar } from '../StyledSelect';
@@ -52,6 +52,14 @@ export interface MultiSelectProps<
52
52
  supportedOrientations?: ('portrait' | 'landscape')[];
53
53
  }
54
54
 
55
+ // Add an internal prop type for TextInputComponent, not exported
56
+ export interface InternalMultiSelectProps<
57
+ V,
58
+ T extends SelectOptionType<V> = SelectOptionType<V>
59
+ > extends MultiSelectProps<V, T> {
60
+ TextInputComponent?: React.ComponentType<TextInputProps>;
61
+ }
62
+
55
63
  function MultiSelect<V, T extends SelectOptionType<V>>({
56
64
  footerLabel,
57
65
  label,
@@ -74,7 +82,8 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
74
82
  value,
75
83
  supportedOrientations = ['portrait'],
76
84
  bottomSheetConfig = {},
77
- }: MultiSelectProps<V, T>) {
85
+ ...rest
86
+ }: InternalMultiSelectProps<V, T>) {
78
87
  const { isKeyboardVisible, keyboardHeight } = useKeyboard();
79
88
  const [open, setOpen] = useState(false);
80
89
  const [selectingValue, setSelectingValue] = useState(value);
@@ -89,6 +98,8 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
89
98
  const { variant: bottomSheetVariant, header: bottomSheetHeader } =
90
99
  bottomSheetConfig;
91
100
 
101
+ const TextInputComponent = rest.TextInputComponent || TextInput;
102
+
92
103
  useEffect(() => {
93
104
  setSelectingValue(value);
94
105
  }, [open, value]);
@@ -105,7 +116,7 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
105
116
  // prevent users from focusing TextInput
106
117
  }
107
118
  <View pointerEvents="none">
108
- <TextInput
119
+ <TextInputComponent
109
120
  {...inputProps}
110
121
  label={label}
111
122
  value={renderSelectedValue ? rawValue : displayedValue}
@@ -166,7 +177,7 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
166
177
  >
167
178
  {onQueryChange && (
168
179
  <StyledSearchBar>
169
- <TextInput
180
+ <TextInputComponent
170
181
  editable
171
182
  placeholder="Search"
172
183
  suffix="search-outlined"
@@ -5,7 +5,7 @@ import type {
5
5
  } from 'react-native';
6
6
  import { TouchableOpacity, View } from 'react-native';
7
7
  import BottomSheet from '../../BottomSheet';
8
- import TextInput from '../../TextInput';
8
+ import TextInput, { TextInputProps } from '../../TextInput';
9
9
  import { getScrollParams, toFlatOptions, toSections } from '../helpers';
10
10
  import { StyledSearchBar } from '../StyledSelect';
11
11
  import type { SelectOptionType, SectionType, SelectProps } from '../types';
@@ -37,6 +37,14 @@ export interface SingleSelectProps<
37
37
  supportedOrientations?: ('portrait' | 'landscape')[];
38
38
  }
39
39
 
40
+ // Add an internal prop type for TextInputComponent, not exported
41
+ export interface InternalSingleSelectProps<
42
+ V,
43
+ T extends SelectOptionType<V> = SelectOptionType<V>
44
+ > extends SingleSelectProps<V, T> {
45
+ TextInputComponent?: React.ComponentType<TextInputProps>;
46
+ }
47
+
40
48
  const SingleSelect = <V, T extends SelectOptionType<V>>({
41
49
  label,
42
50
  loading = false,
@@ -58,7 +66,8 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
58
66
  value,
59
67
  supportedOrientations = ['portrait'],
60
68
  bottomSheetConfig = {},
61
- }: SingleSelectProps<V, T>) => {
69
+ ...rest
70
+ }: InternalSingleSelectProps<V, T>) => {
62
71
  const { isKeyboardVisible, keyboardHeight } = useKeyboard();
63
72
  const [open, setOpen] = useState(false);
64
73
  const sectionListRef = useRef<SectionList<T, SectionType>>(null);
@@ -72,6 +81,8 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
72
81
  const { variant: bottomSheetVariant, header: bottomSheetHeader } =
73
82
  bottomSheetConfig;
74
83
 
84
+ const TextInputComponent = rest.TextInputComponent || TextInput;
85
+
75
86
  return (
76
87
  <>
77
88
  <View
@@ -84,7 +95,7 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
84
95
  // prevent users from focusing TextInput
85
96
  }
86
97
  <View pointerEvents="none">
87
- <TextInput
98
+ <TextInputComponent
88
99
  {...inputProps}
89
100
  label={label}
90
101
  value={renderSelectedValue ? rawValue : displayedValue}
@@ -127,7 +138,7 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
127
138
  >
128
139
  {onQueryChange && (
129
140
  <StyledSearchBar>
130
- <TextInput
141
+ <TextInputComponent
131
142
  editable
132
143
  placeholder="Search"
133
144
  suffix="search-outlined"
@@ -0,0 +1,13 @@
1
+ import MultiSelect from './MultiSelect';
2
+ import SingleSelect from './SingleSelect';
3
+ import type { InternalMultiSelectProps } from './MultiSelect';
4
+ import type { InternalSingleSelectProps } from './SingleSelect';
5
+
6
+ export type {
7
+ InternalMultiSelectProps as MultiSelectProps,
8
+ InternalSingleSelectProps as SingleSelectProps,
9
+ };
10
+
11
+ export default Object.assign(SingleSelect, {
12
+ Multi: MultiSelect,
13
+ });
@@ -2,9 +2,21 @@ import MultiSelect from './MultiSelect';
2
2
  import SingleSelect from './SingleSelect';
3
3
  import type { MultiSelectProps } from './MultiSelect';
4
4
  import type { SingleSelectProps } from './SingleSelect';
5
+ import { SelectOptionType } from './types';
5
6
 
6
7
  export type { MultiSelectProps, SingleSelectProps };
7
8
 
8
- export default Object.assign(SingleSelect, {
9
- Multi: MultiSelect,
9
+ type SingleSelectType = <
10
+ V,
11
+ T extends SelectOptionType<V> = SelectOptionType<V>
12
+ >(
13
+ props: Omit<SingleSelectProps<V, T>, 'TextInputComponent'>
14
+ ) => React.ReactElement;
15
+
16
+ type MultiSelectType = <V, T extends SelectOptionType<V> = SelectOptionType<V>>(
17
+ props: Omit<MultiSelectProps<V, T>, 'TextInputComponent'>
18
+ ) => React.ReactElement;
19
+
20
+ export default Object.assign(SingleSelect as SingleSelectType, {
21
+ Multi: MultiSelect as MultiSelectType,
10
22
  });
@@ -102,4 +102,8 @@ export interface SelectProps<V, T extends SelectOptionType<V>>
102
102
  variant?: BottomSheetProps['variant'];
103
103
  header?: BottomSheetProps['header'];
104
104
  };
105
+ /**
106
+ * Inject a custom TextInput component (e.g., from rn-work-uikit). Defaults to local TextInput.
107
+ */
108
+ TextInputComponent?: React.ComponentType<TextInputProps>;
105
109
  }
@@ -4,6 +4,7 @@ import type { ViewProps } from 'react-native';
4
4
 
5
5
  const StyledPickerWrapper = styled(View)<ViewProps>(({ theme }) => ({
6
6
  height: theme.__hd__.timePicker.sizes.height,
7
+ alignItems: 'center',
7
8
  }));
8
9
 
9
10
  export { StyledPickerWrapper };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { Platform } from 'react-native';
3
+ import TimePickerAndroid from './TimePickerAndroid';
4
+ import TimePickerIOS from './TimePickerIOS';
5
+ import type { InternalTimePickerProps } from './types';
6
+
7
+ const TimePicker = (props: InternalTimePickerProps) => {
8
+ if (Platform.OS === 'ios') {
9
+ return <TimePickerIOS {...props} />;
10
+ }
11
+
12
+ return <TimePickerAndroid {...props} />;
13
+ };
14
+
15
+ export default TimePicker;
@@ -4,7 +4,7 @@ import { TouchableOpacity, View } from 'react-native';
4
4
  import formatTime from 'date-fns/fp/format';
5
5
 
6
6
  import TextInput from '../TextInput';
7
- import type { TimePickerProps } from './types';
7
+ import type { InternalTimePickerProps } from './types';
8
8
 
9
9
  const TimePickerAndroid = ({
10
10
  value,
@@ -19,17 +19,20 @@ const TimePickerAndroid = ({
19
19
  style,
20
20
  testID,
21
21
  showSuffix = true,
22
- }: TimePickerProps) => {
22
+ TextInputComponent,
23
+ }: InternalTimePickerProps) => {
23
24
  const [open, setOpen] = useState(false);
24
25
 
25
26
  const is12Hour = displayFormat.includes('hh');
26
27
  const displayValue = value ? formatTime(displayFormat, value) : '';
27
28
  const pickerInitValue = value || new Date();
28
29
 
30
+ const InputComponent = TextInputComponent || TextInput;
31
+
29
32
  return (
30
33
  <TouchableOpacity onPress={() => setOpen(true)} disabled={disabled}>
31
34
  <View pointerEvents="none" testID="timePickerInputAndroid">
32
- <TextInput
35
+ <InputComponent
33
36
  label={label}
34
37
  value={displayValue}
35
38
  suffix={showSuffix ? 'clock-3' : undefined}
@@ -7,7 +7,7 @@ import BottomSheet from '../BottomSheet';
7
7
  import TextInput from '../TextInput';
8
8
  import Button from '../Button';
9
9
  import { StyledPickerWrapper } from './StyledTimePicker';
10
- import type { TimePickerProps } from './types';
10
+ import type { InternalTimePickerProps } from './types';
11
11
  import { useTheme } from '../../theme';
12
12
 
13
13
  const TimePickerIOS = ({
@@ -25,7 +25,8 @@ const TimePickerIOS = ({
25
25
  testID,
26
26
  showSuffix = true,
27
27
  supportedOrientations = ['portrait'],
28
- }: TimePickerProps) => {
28
+ TextInputComponent,
29
+ }: InternalTimePickerProps) => {
29
30
  const [selectingDate, setSelectingDate] = useState<Date>(value || new Date());
30
31
  const [open, setOpen] = useState(false);
31
32
 
@@ -33,6 +34,8 @@ const TimePickerIOS = ({
33
34
  const displayValue = value ? formatTime(displayFormat, value) : '';
34
35
  const theme = useTheme();
35
36
 
37
+ const InputComponent = TextInputComponent || TextInput;
38
+
36
39
  useEffect(() => {
37
40
  setSelectingDate(value || new Date());
38
41
  }, [value]);
@@ -40,7 +43,7 @@ const TimePickerIOS = ({
40
43
  return (
41
44
  <TouchableOpacity onPress={() => setOpen(true)} disabled={disabled}>
42
45
  <View pointerEvents="none" testID="timePickerInputIOS">
43
- <TextInput
46
+ <InputComponent
44
47
  label={label}
45
48
  value={displayValue}
46
49
  suffix={showSuffix ? 'clock-3' : undefined}
@@ -815,6 +815,7 @@ exports[`TimePickerIOS renders correctly 1`] = `
815
815
  style={
816
816
  [
817
817
  {
818
+ "alignItems": "center",
818
819
  "height": 176,
819
820
  },
820
821
  undefined,
@@ -0,0 +1,9 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { InternalTimePickerProps } from './types';
3
+ import TimePicker from './TimePicker';
4
+
5
+ const InternalTimePicker =
6
+ TimePicker as FunctionComponent<InternalTimePickerProps>;
7
+
8
+ export type { InternalTimePickerProps as TimePickerProps };
9
+ export default InternalTimePicker;
@@ -1,15 +1,6 @@
1
- import React from 'react';
2
- import { Platform } from 'react-native';
3
- import TimePickerAndroid from './TimePickerAndroid';
4
- import TimePickerIOS from './TimePickerIOS';
1
+ import { FunctionComponent } from 'react';
5
2
  import type { TimePickerProps } from './types';
3
+ import TimePicker from './TimePicker';
6
4
 
7
- const TimePicker = (props: TimePickerProps) => {
8
- if (Platform.OS === 'ios') {
9
- return <TimePickerIOS {...props} />;
10
- }
11
-
12
- return <TimePickerAndroid {...props} />;
13
- };
14
-
15
- export default TimePicker;
5
+ const PublicTimePicker = TimePicker as FunctionComponent<TimePickerProps>;
6
+ export default PublicTimePicker;
@@ -1,4 +1,5 @@
1
1
  import type { StyleProp, ViewStyle } from 'react-native';
2
+ import { TextInputProps } from '../TextInput';
2
3
 
3
4
  export interface TimePickerProps {
4
5
  /**
@@ -61,3 +62,8 @@ export interface TimePickerProps {
61
62
  */
62
63
  supportedOrientations?: ('portrait' | 'landscape')[];
63
64
  }
65
+
66
+ // Add an internal prop type for TextInputComponent, not exported
67
+ export interface InternalTimePickerProps extends TimePickerProps {
68
+ TextInputComponent?: React.ComponentType<TextInputProps>;
69
+ }
@@ -0,0 +1,7 @@
1
+ import Select from './components/Select/index.internal';
2
+ import DatePicker from './components/DatePicker/index.internal';
3
+ import TimePicker from './components/TimePicker/index.internal';
4
+
5
+ export * from '.';
6
+ export { Select, DatePicker, TimePicker };
7
+ export type { MultiSelectProps, SingleSelectProps } from './types.internal';
@@ -0,0 +1,16 @@
1
+ import type {
2
+ SingleSelectProps,
3
+ MultiSelectProps,
4
+ } from './components/Select/index.internal';
5
+
6
+ import type { DatePickerProps } from './components/DatePicker/index.internal';
7
+ import type { TimePickerProps } from './components/TimePicker/index.internal';
8
+
9
+ export * from './types';
10
+
11
+ export {
12
+ SingleSelectProps,
13
+ MultiSelectProps,
14
+ DatePickerProps,
15
+ TimePickerProps,
16
+ };
package/src/types.ts CHANGED
@@ -49,6 +49,8 @@ import { TitleProps } from './components/Typography/Title';
49
49
  import { CarouselData, CarouselImageProps } from './components/Carousel/types';
50
50
  import { PinInputHandler } from './components/PinInput';
51
51
  import { ThemeScale } from './components/Box/types';
52
+ import { TimePickerProps } from './components/TimePicker/types';
53
+ import { DatePickerProps } from './components/DatePicker/types';
52
54
 
53
55
  export type {
54
56
  Space,
@@ -101,4 +103,6 @@ export type {
101
103
  ListItemProps,
102
104
  IconButtonProps,
103
105
  BadgeProps,
106
+ TimePickerProps,
107
+ DatePickerProps,
104
108
  };