@utilitywarehouse/hearth-react-native 0.22.0 → 0.23.0-test-list

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 (70) hide show
  1. package/.turbo/turbo-build.log +5 -4
  2. package/CHANGELOG.md +36 -0
  3. package/build/components/List/List.js +2 -2
  4. package/build/components/Modal/Modal.d.ts +1 -1
  5. package/build/components/Modal/Modal.js +17 -5
  6. package/build/components/Modal/Modal.props.d.ts +1 -0
  7. package/build/components/ProgressBar/ProgressBar.d.ts +6 -0
  8. package/build/components/ProgressBar/ProgressBar.js +35 -0
  9. package/build/components/ProgressBar/ProgressBar.props.d.ts +60 -0
  10. package/build/components/ProgressBar/ProgressBar.props.js +1 -0
  11. package/build/components/ProgressBar/ProgressBarCircular.d.ts +6 -0
  12. package/build/components/ProgressBar/ProgressBarCircular.js +115 -0
  13. package/build/components/ProgressBar/ProgressBarLinear.d.ts +6 -0
  14. package/build/components/ProgressBar/ProgressBarLinear.js +79 -0
  15. package/build/components/ProgressBar/index.d.ts +2 -0
  16. package/build/components/ProgressBar/index.js +1 -0
  17. package/build/components/SegmentedControl/SegmentedControl.context.d.ts +14 -0
  18. package/build/components/SegmentedControl/SegmentedControl.context.js +9 -0
  19. package/build/components/SegmentedControl/SegmentedControl.d.ts +6 -0
  20. package/build/components/SegmentedControl/SegmentedControl.js +199 -0
  21. package/build/components/SegmentedControl/SegmentedControl.props.d.ts +18 -0
  22. package/build/components/SegmentedControl/SegmentedControl.props.js +1 -0
  23. package/build/components/SegmentedControl/SegmentedControlOption.d.ts +18 -0
  24. package/build/components/SegmentedControl/SegmentedControlOption.js +144 -0
  25. package/build/components/SegmentedControl/SegmentedControlOption.props.d.ts +14 -0
  26. package/build/components/SegmentedControl/SegmentedControlOption.props.js +1 -0
  27. package/build/components/SegmentedControl/index.d.ts +4 -0
  28. package/build/components/SegmentedControl/index.js +2 -0
  29. package/build/components/TimePicker/TimePicker.d.ts +6 -0
  30. package/build/components/TimePicker/TimePicker.js +78 -0
  31. package/build/components/TimePicker/TimePicker.props.d.ts +45 -0
  32. package/build/components/TimePicker/TimePicker.props.js +1 -0
  33. package/build/components/TimePicker/TimePickerView.d.ts +12 -0
  34. package/build/components/TimePicker/TimePickerView.js +130 -0
  35. package/build/components/TimePicker/TimePickerWheel.d.ts +8 -0
  36. package/build/components/TimePicker/TimePickerWheel.js +86 -0
  37. package/build/components/TimePicker/TimePickerWheel.web.d.ts +8 -0
  38. package/build/components/TimePicker/TimePickerWheel.web.js +122 -0
  39. package/build/components/TimePicker/index.d.ts +6 -0
  40. package/build/components/TimePicker/index.js +3 -0
  41. package/build/components/TimePickerInput/TimePickerInput.d.ts +6 -0
  42. package/build/components/TimePickerInput/TimePickerInput.js +127 -0
  43. package/build/components/TimePickerInput/TimePickerInput.props.d.ts +52 -0
  44. package/build/components/TimePickerInput/TimePickerInput.props.js +1 -0
  45. package/build/components/TimePickerInput/TimePickerInputDoneButton.d.ts +8 -0
  46. package/build/components/TimePickerInput/TimePickerInputDoneButton.js +19 -0
  47. package/build/components/TimePickerInput/TimePickerInputDoneButton.web.d.ts +5 -0
  48. package/build/components/TimePickerInput/TimePickerInputDoneButton.web.js +5 -0
  49. package/build/components/TimePickerInput/index.d.ts +2 -0
  50. package/build/components/TimePickerInput/index.js +1 -0
  51. package/build/components/VerificationInput/VerificationInput.js +182 -20
  52. package/build/components/VerificationInput/VerificationInput.utils.d.ts +8 -0
  53. package/build/components/VerificationInput/VerificationInput.utils.js +17 -0
  54. package/build/components/VerificationInput/VerificationInput.utils.test.d.ts +1 -0
  55. package/build/components/VerificationInput/VerificationInput.utils.test.js +36 -0
  56. package/build/components/VerificationInput/VerificationInputSlot.d.ts +7 -3
  57. package/build/components/VerificationInput/VerificationInputSlot.js +45 -7
  58. package/docs/changelog.mdx +249 -0
  59. package/package.json +3 -3
  60. package/src/components/List/List.tsx +5 -4
  61. package/src/components/Modal/Modal.docs.mdx +1 -0
  62. package/src/components/Modal/Modal.props.ts +1 -0
  63. package/src/components/Modal/Modal.stories.tsx +1 -0
  64. package/src/components/Modal/Modal.tsx +21 -3
  65. package/src/components/VerificationInput/VerificationInput.tsx +218 -29
  66. package/src/components/VerificationInput/VerificationInputSlot.tsx +90 -14
  67. package/.turbo/turbo-lint.log +0 -72
  68. package/build/components/VerificationInput/useVerificationInput.d.ts +0 -15
  69. package/build/components/VerificationInput/useVerificationInput.js +0 -73
  70. package/src/components/VerificationInput/useVerificationInput.ts +0 -88
@@ -1,15 +0,0 @@
1
- import { NativeSyntheticEvent, TextInput, TextInputKeyPressEventData } from 'react-native';
2
- interface UseVerificationInputProps {
3
- value: string;
4
- onChangeText?: (text: string) => void;
5
- }
6
- export declare const useVerificationInput: ({ value, onChangeText }: UseVerificationInputProps) => {
7
- inputRefs: import("react").RefObject<(TextInput | null)[]>;
8
- displayValue: string;
9
- focusedIndex: number | null;
10
- handleFocus: (index: number) => void;
11
- handleBlur: () => void;
12
- handleChangeText: (text: string, index: number) => void;
13
- handleKeyPress: (e: NativeSyntheticEvent<TextInputKeyPressEventData>, index: number) => void;
14
- };
15
- export {};
@@ -1,73 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- export const useVerificationInput = ({ value, onChangeText }) => {
3
- const length = 6;
4
- const inputRefs = useRef([]);
5
- const latestValueRef = useRef(value);
6
- const [displayValue, setDisplayValue] = useState(value);
7
- const [focusedIndex, setFocusedIndex] = useState(null);
8
- useEffect(() => {
9
- if (value !== latestValueRef.current) {
10
- latestValueRef.current = value;
11
- setDisplayValue(value);
12
- }
13
- }, [value]);
14
- const handleFocus = (index) => {
15
- setFocusedIndex(index);
16
- };
17
- const handleBlur = () => {
18
- setFocusedIndex(null);
19
- };
20
- const updateValue = (nextValue) => {
21
- latestValueRef.current = nextValue;
22
- setDisplayValue(nextValue);
23
- onChangeText?.(nextValue);
24
- };
25
- const handleChangeText = (text, index) => {
26
- const currentValue = latestValueRef.current;
27
- const chars = Array(length).fill('');
28
- for (let i = 0; i < currentValue.length && i < length; i++) {
29
- chars[i] = currentValue[i];
30
- }
31
- if (text.length > 1) {
32
- // Handle paste
33
- const pastedChars = text.slice(0, length - index).split('');
34
- for (let i = 0; i < pastedChars.length; i++) {
35
- chars[index + i] = pastedChars[i];
36
- }
37
- const nextIndex = Math.min(index + pastedChars.length, length - 1);
38
- inputRefs.current[nextIndex]?.focus();
39
- }
40
- else {
41
- // Handle single char input
42
- chars[index] = text;
43
- if (text.length === 1 && index < length - 1) {
44
- inputRefs.current[index + 1]?.focus();
45
- }
46
- }
47
- updateValue(chars.join(''));
48
- };
49
- const handleKeyPress = (e, index) => {
50
- if (e.nativeEvent.key === 'Backspace') {
51
- const currentValue = latestValueRef.current;
52
- if (!currentValue[index] && index > 0) {
53
- e.preventDefault();
54
- inputRefs.current[index - 1]?.focus();
55
- const chars = Array(length).fill('');
56
- for (let i = 0; i < currentValue.length && i < length; i++) {
57
- chars[i] = currentValue[i];
58
- }
59
- chars[index - 1] = '';
60
- updateValue(chars.join(''));
61
- }
62
- }
63
- };
64
- return {
65
- inputRefs,
66
- displayValue,
67
- focusedIndex,
68
- handleFocus,
69
- handleBlur,
70
- handleChangeText,
71
- handleKeyPress,
72
- };
73
- };
@@ -1,88 +0,0 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- import { NativeSyntheticEvent, TextInput, TextInputKeyPressEventData } from 'react-native';
3
-
4
- interface UseVerificationInputProps {
5
- value: string;
6
- onChangeText?: (text: string) => void;
7
- }
8
-
9
- export const useVerificationInput = ({ value, onChangeText }: UseVerificationInputProps) => {
10
- const length = 6;
11
- const inputRefs = useRef<(TextInput | null)[]>([]);
12
- const latestValueRef = useRef(value);
13
- const [displayValue, setDisplayValue] = useState(value);
14
- const [focusedIndex, setFocusedIndex] = useState<number | null>(null);
15
-
16
- useEffect(() => {
17
- if (value !== latestValueRef.current) {
18
- latestValueRef.current = value;
19
- setDisplayValue(value);
20
- }
21
- }, [value]);
22
-
23
- const handleFocus = (index: number) => {
24
- setFocusedIndex(index);
25
- };
26
-
27
- const handleBlur = () => {
28
- setFocusedIndex(null);
29
- };
30
-
31
- const updateValue = (nextValue: string) => {
32
- latestValueRef.current = nextValue;
33
- setDisplayValue(nextValue);
34
- onChangeText?.(nextValue);
35
- };
36
-
37
- const handleChangeText = (text: string, index: number) => {
38
- const currentValue = latestValueRef.current;
39
- const chars = Array(length).fill('');
40
- for (let i = 0; i < currentValue.length && i < length; i++) {
41
- chars[i] = currentValue[i];
42
- }
43
-
44
- if (text.length > 1) {
45
- // Handle paste
46
- const pastedChars = text.slice(0, length - index).split('');
47
- for (let i = 0; i < pastedChars.length; i++) {
48
- chars[index + i] = pastedChars[i];
49
- }
50
- const nextIndex = Math.min(index + pastedChars.length, length - 1);
51
- inputRefs.current[nextIndex]?.focus();
52
- } else {
53
- // Handle single char input
54
- chars[index] = text;
55
- if (text.length === 1 && index < length - 1) {
56
- inputRefs.current[index + 1]?.focus();
57
- }
58
- }
59
- updateValue(chars.join(''));
60
- };
61
-
62
- const handleKeyPress = (e: NativeSyntheticEvent<TextInputKeyPressEventData>, index: number) => {
63
- if (e.nativeEvent.key === 'Backspace') {
64
- const currentValue = latestValueRef.current;
65
- if (!currentValue[index] && index > 0) {
66
- e.preventDefault();
67
- inputRefs.current[index - 1]?.focus();
68
-
69
- const chars = Array(length).fill('');
70
- for (let i = 0; i < currentValue.length && i < length; i++) {
71
- chars[i] = currentValue[i];
72
- }
73
- chars[index - 1] = '';
74
- updateValue(chars.join(''));
75
- }
76
- }
77
- };
78
-
79
- return {
80
- inputRefs,
81
- displayValue,
82
- focusedIndex,
83
- handleFocus,
84
- handleBlur,
85
- handleChangeText,
86
- handleKeyPress,
87
- };
88
- };