@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,36 +1,187 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef, useImperativeHandle } from 'react';
3
- import { View } from 'react-native';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
3
+ import { Platform, TextInput, View } from 'react-native';
4
4
  import { StyleSheet } from 'react-native-unistyles';
5
5
  import { FormField } from '../FormField';
6
- import { useVerificationInput } from './useVerificationInput';
7
6
  import { VerificationInputSlot } from './VerificationInputSlot';
8
7
  const VerificationInput = forwardRef(({ value = '', onChangeText, label, labelVariant = 'body', helperText, helperIcon, validationStatus = 'initial', validText, invalidText, disabled = false, readonly = false, secureTextEntry = false, autoFocus = false, style, ...props }, ref) => {
9
8
  const length = 6;
10
- const { inputRefs, displayValue, focusedIndex, handleFocus, handleBlur, handleChangeText, handleKeyPress, } = useVerificationInput({
11
- value,
12
- onChangeText,
13
- });
9
+ const inputRef = useRef(null);
10
+ const latestValueRef = useRef(value);
11
+ const [displayValue, setDisplayValue] = useState(value);
12
+ const [focusedIndex, setFocusedIndex] = useState(null);
13
+ const [selection, setSelection] = useState({ start: 0, end: 0 });
14
+ const latestSelectionRef = useRef(selection);
15
+ const ignoreNextSelectionRef = useRef(false);
16
+ const pendingFocusIndexRef = useRef(null);
17
+ useEffect(() => {
18
+ if (value !== latestValueRef.current) {
19
+ const trimmedValue = value.slice(0, length);
20
+ latestValueRef.current = trimmedValue;
21
+ setDisplayValue(trimmedValue);
22
+ const nextPos = Math.min(trimmedValue.length, length);
23
+ const nextSelection = { start: nextPos, end: nextPos };
24
+ ignoreNextSelectionRef.current = true;
25
+ latestSelectionRef.current = nextSelection;
26
+ setSelection(nextSelection);
27
+ }
28
+ }, [length, value]);
29
+ const updateValue = (nextValue) => {
30
+ const trimmedValue = nextValue.slice(0, length);
31
+ latestValueRef.current = trimmedValue;
32
+ setDisplayValue(trimmedValue);
33
+ onChangeText?.(trimmedValue);
34
+ };
35
+ const setSelectionIndex = (index) => {
36
+ const clampedIndex = Math.max(0, Math.min(index, length));
37
+ const hasChar = !!latestValueRef.current[clampedIndex];
38
+ const endIndex = hasChar ? Math.min(clampedIndex + 1, length) : clampedIndex;
39
+ const nextSelection = { start: clampedIndex, end: endIndex };
40
+ ignoreNextSelectionRef.current = true;
41
+ latestSelectionRef.current = nextSelection;
42
+ setSelection(nextSelection);
43
+ setFocusedIndex(Math.min(clampedIndex, length - 1));
44
+ };
45
+ const setCaretIndex = (index) => {
46
+ const clampedIndex = Math.max(0, Math.min(index, length));
47
+ const nextSelection = { start: clampedIndex, end: clampedIndex };
48
+ ignoreNextSelectionRef.current = true;
49
+ latestSelectionRef.current = nextSelection;
50
+ setSelection(nextSelection);
51
+ setFocusedIndex(Math.min(clampedIndex, length - 1));
52
+ };
53
+ const findDiffIndex = (prevValue, nextValue) => {
54
+ const minLength = Math.min(prevValue.length, nextValue.length);
55
+ for (let i = 0; i < minLength; i += 1) {
56
+ if (prevValue[i] !== nextValue[i]) {
57
+ return i;
58
+ }
59
+ }
60
+ return minLength;
61
+ };
62
+ const handleChangeText = (text) => {
63
+ const prevValue = latestValueRef.current;
64
+ const nextValue = text.slice(0, length);
65
+ const prevLength = prevValue.length;
66
+ const nextLength = nextValue.length;
67
+ const diff = nextLength - prevLength;
68
+ const isBulkInsert = text.length > 1 && diff > 1;
69
+ const shouldBlur = nextLength >= length;
70
+ let nextIndex = Math.max(0, Math.min(latestSelectionRef.current.start + (diff >= 0 ? 1 : diff), length));
71
+ if (Platform.OS === 'android') {
72
+ const editedIndex = findDiffIndex(prevValue, nextValue);
73
+ nextIndex = diff >= 0 ? Math.min(editedIndex + 1, length) : Math.max(editedIndex, 0);
74
+ }
75
+ updateValue(nextValue);
76
+ if (isBulkInsert) {
77
+ setCaretIndex(Math.min(nextLength, length));
78
+ if (shouldBlur) {
79
+ inputRef.current?.blur();
80
+ }
81
+ return;
82
+ }
83
+ if (nextIndex >= length) {
84
+ setCaretIndex(nextIndex);
85
+ if (shouldBlur) {
86
+ inputRef.current?.blur();
87
+ }
88
+ return;
89
+ }
90
+ if (nextLength >= length) {
91
+ setSelectionIndex(nextIndex);
92
+ inputRef.current?.blur();
93
+ return;
94
+ }
95
+ const hasNextChar = !!nextValue[nextIndex];
96
+ if (hasNextChar) {
97
+ setSelectionIndex(nextIndex);
98
+ }
99
+ else {
100
+ setCaretIndex(nextIndex);
101
+ }
102
+ };
103
+ const handleFocus = () => {
104
+ if (pendingFocusIndexRef.current !== null) {
105
+ setSelectionIndex(pendingFocusIndexRef.current);
106
+ pendingFocusIndexRef.current = null;
107
+ return;
108
+ }
109
+ setFocusedIndex(Math.min(selection.start, length - 1));
110
+ };
111
+ const handleBlur = () => {
112
+ setFocusedIndex(null);
113
+ };
14
114
  useImperativeHandle(ref, () => ({
15
- focus: () => inputRefs.current[0]?.focus(),
16
- blur: () => {
17
- inputRefs.current.forEach(input => input?.blur());
115
+ focus: () => {
116
+ inputRef.current?.focus();
117
+ const nextIndex = Math.min(latestValueRef.current.length, length - 1);
118
+ if (latestValueRef.current.length >= length) {
119
+ setSelectionIndex(nextIndex);
120
+ }
121
+ else {
122
+ setCaretIndex(nextIndex);
123
+ }
124
+ },
125
+ blur: () => inputRef.current?.blur(),
126
+ clear: () => {
127
+ updateValue('');
128
+ setSelectionIndex(0);
129
+ inputRef.current?.blur();
130
+ setFocusedIndex(null);
18
131
  },
19
- clear: () => onChangeText?.(''),
20
132
  focusIndex: (index) => {
21
133
  if (index >= 0 && index < length) {
22
- inputRefs.current[index]?.focus();
134
+ inputRef.current?.focus();
135
+ setSelectionIndex(index);
23
136
  }
24
137
  },
25
138
  }), [length, onChangeText]);
26
139
  const slots = Array.from({ length }, (_, index) => index);
27
- return (_jsx(FormField, { label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validationStatus: validationStatus, validText: validText, invalidText: invalidText, disabled: disabled, readonly: readonly, style: [styles.root, style], ...props, children: _jsx(View, { style: styles.slotsContainer, children: slots.map(index => {
28
- const char = displayValue[index] || '';
29
- const isActive = focusedIndex === index;
30
- return (_jsx(VerificationInputSlot, { ref: inputRef => {
31
- inputRefs.current[index] = inputRef;
32
- }, autoFocus: index === 0 && autoFocus, value: char, isActive: isActive, validationStatus: validationStatus, disabled: disabled, readonly: readonly, secureTextEntry: secureTextEntry, onChangeText: text => handleChangeText(text, index), onKeyPress: e => handleKeyPress(e, index), onFocus: () => handleFocus(index), onBlur: handleBlur }, index));
33
- }) }) }));
140
+ const getAccessibilityLabel = () => {
141
+ return label || props.accessibilityLabel;
142
+ };
143
+ const getAccessibilityHint = () => {
144
+ let accessibilityHint = '';
145
+ if (helperText) {
146
+ accessibilityHint = accessibilityHint + helperText;
147
+ }
148
+ if (validationStatus !== 'initial') {
149
+ if (accessibilityHint.length > 0) {
150
+ accessibilityHint = accessibilityHint + ', ';
151
+ }
152
+ if (validationStatus === 'invalid' && invalidText) {
153
+ accessibilityHint = accessibilityHint + invalidText;
154
+ }
155
+ if (validationStatus === 'valid' && validText) {
156
+ accessibilityHint = accessibilityHint + validText;
157
+ }
158
+ }
159
+ return accessibilityHint || props.accessibilityHint;
160
+ };
161
+ return (_jsx(FormField, { label: label, labelVariant: labelVariant, helperText: helperText, helperIcon: helperIcon, validationStatus: validationStatus, validText: validText, invalidText: invalidText, disabled: disabled, readonly: readonly, accessibilityHandledByChildren: true, style: [styles.root, style], ...props, children: _jsxs(View, { style: styles.slotsContainer, children: [_jsx(TextInput, { ref: inputRef, value: displayValue, autoFocus: autoFocus, editable: !disabled && !readonly, accessibilityLabel: getAccessibilityLabel(), accessibilityHint: getAccessibilityHint(), accessibilityState: { disabled: disabled || readonly }, importantForAccessibility: "yes", onChangeText: handleChangeText, onSelectionChange: event => {
162
+ const nextSelection = event.nativeEvent.selection;
163
+ if (ignoreNextSelectionRef.current &&
164
+ (nextSelection.start !== latestSelectionRef.current.start ||
165
+ nextSelection.end !== latestSelectionRef.current.end)) {
166
+ return;
167
+ }
168
+ if (pendingFocusIndexRef.current !== null) {
169
+ return;
170
+ }
171
+ ignoreNextSelectionRef.current = false;
172
+ latestSelectionRef.current = nextSelection;
173
+ setSelection(nextSelection);
174
+ setFocusedIndex(Math.min(nextSelection.start, length - 1));
175
+ }, onFocus: handleFocus, onBlur: handleBlur, selection: selection, keyboardType: "number-pad", textContentType: "oneTimeCode", autoComplete: "sms-otp", secureTextEntry: secureTextEntry, maxLength: length, caretHidden: true, style: styles.hiddenInput, pointerEvents: "none" }), slots.map(index => {
176
+ const char = displayValue[index] || '';
177
+ const isActive = focusedIndex === index;
178
+ const displayChar = secureTextEntry && char ? '*' : char;
179
+ return (_jsx(VerificationInputSlot, { value: displayChar, isActive: isActive, showCaret: isActive && !displayChar, validationStatus: validationStatus, disabled: disabled, readonly: readonly, secureTextEntry: secureTextEntry, onPress: () => {
180
+ pendingFocusIndexRef.current = index;
181
+ inputRef.current?.focus();
182
+ setSelectionIndex(index);
183
+ } }, index));
184
+ })] }) }));
34
185
  });
35
186
  const styles = StyleSheet.create(theme => ({
36
187
  root: {
@@ -42,6 +193,17 @@ const styles = StyleSheet.create(theme => ({
42
193
  flexDirection: 'row',
43
194
  gap: theme.components.input.verification.gap,
44
195
  width: '100%',
196
+ position: 'relative',
197
+ },
198
+ hiddenInput: {
199
+ position: 'absolute',
200
+ width: '100%',
201
+ height: '100%',
202
+ left: 0,
203
+ top: 0,
204
+ color: 'transparent',
205
+ fontSize: 1,
206
+ opacity: 0.1,
45
207
  },
46
208
  }));
47
209
  VerificationInput.displayName = 'VerificationInput';
@@ -0,0 +1,8 @@
1
+ interface GetNextIndexFromValueChangeOptions {
2
+ prevValue: string;
3
+ nextValue: string;
4
+ length: number;
5
+ }
6
+ export declare const findDiffIndex: (prevValue: string, nextValue: string) => number;
7
+ export declare const getNextIndexFromValueChange: ({ prevValue, nextValue, length, }: GetNextIndexFromValueChangeOptions) => number;
8
+ export {};
@@ -0,0 +1,17 @@
1
+ export const findDiffIndex = (prevValue, nextValue) => {
2
+ const minLength = Math.min(prevValue.length, nextValue.length);
3
+ for (let i = 0; i < minLength; i += 1) {
4
+ if (prevValue[i] !== nextValue[i]) {
5
+ return i;
6
+ }
7
+ }
8
+ return minLength;
9
+ };
10
+ export const getNextIndexFromValueChange = ({ prevValue, nextValue, length, }) => {
11
+ const diff = nextValue.length - prevValue.length;
12
+ const editedIndex = findDiffIndex(prevValue, nextValue);
13
+ if (diff >= 0) {
14
+ return Math.min(editedIndex + 1, length);
15
+ }
16
+ return Math.max(editedIndex, 0);
17
+ };
@@ -0,0 +1,36 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { findDiffIndex, getNextIndexFromValueChange } from './VerificationInput.utils';
3
+ describe('findDiffIndex', () => {
4
+ it('returns first differing index', () => {
5
+ expect(findDiffIndex('12', '19')).toBe(1);
6
+ });
7
+ it('returns previous length when next appends', () => {
8
+ expect(findDiffIndex('12', '123')).toBe(2);
9
+ });
10
+ it('returns next length when next shortens with same prefix', () => {
11
+ expect(findDiffIndex('123', '12')).toBe(2);
12
+ });
13
+ });
14
+ describe('getNextIndexFromValueChange', () => {
15
+ it('moves to the slot after the one that changed when inserting in an empty later slot', () => {
16
+ expect(getNextIndexFromValueChange({
17
+ prevValue: '12',
18
+ nextValue: '123',
19
+ length: 6,
20
+ })).toBe(3);
21
+ });
22
+ it('caps at length when value becomes full', () => {
23
+ expect(getNextIndexFromValueChange({
24
+ prevValue: '12345',
25
+ nextValue: '123456',
26
+ length: 6,
27
+ })).toBe(6);
28
+ });
29
+ it('stays at edited index for deletions', () => {
30
+ expect(getNextIndexFromValueChange({
31
+ prevValue: '123',
32
+ nextValue: '12',
33
+ length: 6,
34
+ })).toBe(2);
35
+ });
36
+ });
@@ -1,9 +1,13 @@
1
- import { TextInput, TextInputProps } from 'react-native';
2
- interface VerificationInputSlotProps extends TextInputProps {
1
+ import { View, ViewProps } from 'react-native';
2
+ interface VerificationInputSlotProps extends ViewProps {
3
+ value: string;
3
4
  isActive: boolean;
5
+ showCaret?: boolean;
4
6
  validationStatus: 'initial' | 'valid' | 'invalid';
5
7
  disabled?: boolean;
6
8
  readonly?: boolean;
9
+ onPress?: () => void;
10
+ secureTextEntry?: boolean;
7
11
  }
8
- export declare const VerificationInputSlot: import("react").ForwardRefExoticComponent<VerificationInputSlotProps & import("react").RefAttributes<TextInput>>;
12
+ export declare const VerificationInputSlot: import("react").ForwardRefExoticComponent<VerificationInputSlotProps & import("react").RefAttributes<View>>;
9
13
  export {};
@@ -1,28 +1,46 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect } from 'react';
3
+ import { Pressable, Text } from 'react-native';
4
+ import Animated, { Easing, useAnimatedStyle, useSharedValue, withRepeat, withTiming, } from 'react-native-reanimated';
3
5
  import { StyleSheet } from 'react-native-unistyles';
4
- import InputField from '../Input/InputField';
5
- export const VerificationInputSlot = forwardRef(({ isActive, validationStatus, disabled, readonly, style, ...props }, ref) => {
6
+ export const VerificationInputSlot = forwardRef(({ value, isActive, showCaret, validationStatus, disabled, readonly, style, onPress, secureTextEntry, ...props }, ref) => {
6
7
  styles.useVariants({
7
8
  disabled,
8
9
  readonly,
9
10
  validationStatus,
10
11
  active: isActive,
12
+ secureTextEntry,
11
13
  });
12
- return (_jsx(InputField, { ref: ref, ...props, editable: !disabled && !readonly, selectTextOnFocus: true, keyboardType: "number-pad", style: [styles.slot, style] }));
14
+ const caretOpacity = useSharedValue(0);
15
+ const animatedCaretStyle = useAnimatedStyle(() => ({
16
+ opacity: caretOpacity.value,
17
+ }));
18
+ useEffect(() => {
19
+ if (showCaret && !disabled && !readonly) {
20
+ caretOpacity.value = withRepeat(withTiming(1, { duration: 500, easing: Easing.inOut(Easing.ease) }), -1, true);
21
+ return;
22
+ }
23
+ caretOpacity.value = withTiming(0, { duration: 150, easing: Easing.out(Easing.ease) });
24
+ }, [caretOpacity, disabled, readonly, showCaret]);
25
+ return (_jsxs(Pressable, { ref: ref, onPress: onPress, disabled: disabled || readonly, style: [styles.slot, style], accessibilityRole: "button", accessible: false, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", ...props, children: [_jsx(Text, { style: styles.slotText, children: value }), showCaret && !disabled && !readonly && (_jsx(Animated.View, { style: [styles.caret, animatedCaretStyle] }))] }));
13
26
  });
14
27
  VerificationInputSlot.displayName = 'VerificationInputSlot';
15
28
  const styles = StyleSheet.create(theme => ({
16
29
  slot: {
17
- flex: 0,
30
+ flexGrow: 0,
31
+ flexShrink: 0,
18
32
  width: theme.components.input.height,
19
33
  height: theme.components.input.height,
34
+ minWidth: theme.components.input.height,
35
+ minHeight: theme.components.input.height,
20
36
  borderWidth: theme.components.input.borderWidth,
21
37
  borderColor: theme.color.border.strong,
22
38
  borderRadius: theme.components.input.borderRadius,
23
39
  backgroundColor: theme.color.surface.neutral.strong,
24
- textAlign: 'center',
40
+ alignItems: 'center',
41
+ justifyContent: 'center',
25
42
  padding: 0,
43
+ position: 'relative',
26
44
  variants: {
27
45
  disabled: {
28
46
  true: {
@@ -69,4 +87,24 @@ const styles = StyleSheet.create(theme => ({
69
87
  },
70
88
  ],
71
89
  },
90
+ slotText: {
91
+ color: theme.color.text.primary,
92
+ fontSize: theme.typography.mobile.bodyText.md.fontSize,
93
+ fontFamily: theme.typography.mobile.bodyText.fontFamily,
94
+ fontWeight: `${theme.typography.mobile.bodyText.fontWeight}`,
95
+ textAlign: 'center',
96
+ variants: {
97
+ secureTextEntry: {
98
+ true: {
99
+ paddingTop: 5,
100
+ },
101
+ },
102
+ },
103
+ },
104
+ caret: {
105
+ position: 'absolute',
106
+ width: 2,
107
+ height: '55%',
108
+ backgroundColor: theme.color.text.brand,
109
+ },
72
110
  }));
@@ -9,6 +9,255 @@ import { BackToTopButton } from './components';
9
9
  The changelog for the Hearth React Native library. Here you can find all the changes, improvements, and bug fixes for each version.
10
10
 
11
11
 
12
+ ## 0.21.0
13
+
14
+ ### Minor Changes
15
+
16
+ - [#917](https://github.com/utilitywarehouse/hearth/pull/917) [`6a016dc`](https://github.com/utilitywarehouse/hearth/commit/6a016dca0d1a06e40a877da15aced590d0c68112) Thanks [@jordmccord](https://github.com/jordmccord)! - 🌟 [FEATURE]: Add 2xl size variant to Heading component
17
+
18
+ The `Heading` component now supports a `2xl` size option, providing a larger heading size for prominent page titles and hero sections. This size is responsive across device sizes with appropriate font sizes and line heights for mobile, tablet, and desktop viewports.
19
+
20
+ **Components affected**:
21
+ - `Heading`
22
+
23
+ **Developer changes**:
24
+
25
+ Use the new `2xl` size prop:
26
+
27
+ ```tsx
28
+ <Heading size="2xl">Welcome to Hearth</Heading>
29
+ ```
30
+
31
+ The `2xl` size will render with:
32
+ - Mobile: 44px font size, 52px line height
33
+ - Tablet: 44px font size, 52px line height
34
+ - Desktop: 54px font size, 62px line height
35
+
36
+ - [#949](https://github.com/utilitywarehouse/hearth/pull/949) [`e1aacf0`](https://github.com/utilitywarehouse/hearth/commit/e1aacf06a58fd8358e9e7546ec35d8194a0d8d74) Thanks [@MichalCiesliczka](https://github.com/MichalCiesliczka)! - 🌟 [FEATURE]: Add segment refs to `DateInput` for programmatic focus control
37
+
38
+ The `DateInput` component now supports direct refs for each segment input via `dayRef`, `monthRef`, and `yearRef`.
39
+ This makes it easier to move focus between segments from custom flows (for example, advancing focus after validation or from custom buttons).
40
+
41
+ Documentation and Storybook examples are also updated to show how to use segment refs in real usage.
42
+
43
+ **Components affected**:
44
+ - `DateInput`
45
+
46
+ **Developer changes**:
47
+
48
+ You can now pass refs to each segment and call `.focus()` when needed:
49
+
50
+ ```tsx
51
+ import { useRef, useState } from 'react';
52
+ import { TextInput } from 'react-native';
53
+ import { Button, DateInput } from '@utilitywarehouse/hearth-react-native';
54
+
55
+ const DateWithSegmentFocus = () => {
56
+ const [day, setDay] = useState('');
57
+ const [month, setMonth] = useState('');
58
+ const [year, setYear] = useState('');
59
+
60
+ const dayRef = useRef<TextInput>(null);
61
+ const monthRef = useRef<TextInput>(null);
62
+ const yearRef = useRef<TextInput>(null);
63
+
64
+ return (
65
+ <>
66
+ <DateInput
67
+ label="Date of birth"
68
+ dayValue={day}
69
+ monthValue={month}
70
+ yearValue={year}
71
+ onDayChange={setDay}
72
+ onMonthChange={setMonth}
73
+ onYearChange={setYear}
74
+ dayRef={dayRef}
75
+ monthRef={monthRef}
76
+ yearRef={yearRef}
77
+ />
78
+
79
+ <Button onPress={() => monthRef.current?.focus()}>Focus month</Button>
80
+ </>
81
+ );
82
+ };
83
+ ```
84
+
85
+ This is a non-breaking enhancement, so existing `DateInput` usage continues to work without any changes.
86
+
87
+ - [#918](https://github.com/utilitywarehouse/hearth/pull/918) [`2db4dbe`](https://github.com/utilitywarehouse/hearth/commit/2db4dbe273583239b148c4399af829df596a00c1) Thanks [@jordmccord](https://github.com/jordmccord)! - 💔 [BREAKING CHANGE]: Simplify semantic token naming and introduce utility prop types
88
+
89
+ This release simplifies the semantic token naming convention and introduces a new utility prop system to make the API more intuitive and consistent across components.
90
+
91
+ **Components affected**:
92
+ - `Box`
93
+ - `Container`
94
+ - `Card`
95
+ - `Flex`
96
+ - `Grid`
97
+ - `Center`
98
+ - `BodyText`
99
+ - `Heading`
100
+ - `DetailText`
101
+ - `Carousel`
102
+ - `CarouselItem`
103
+
104
+ **Developer changes**:
105
+
106
+ ### Background Colors
107
+
108
+ Background color props now accept simplified semantic tokens. Update your code as follows:
109
+
110
+ ```diff
111
+ - <Box backgroundColor="backgroundPrimary">
112
+ + <Box backgroundColor="primary">
113
+
114
+ - <Box backgroundColor="backgroundSecondary">
115
+ + <Box backgroundColor="secondary">
116
+
117
+ - <Box backgroundColor="backgroundBrand">
118
+ + <Box backgroundColor="brand">
119
+
120
+ - <Container bg="backgroundPrimary">
121
+ + <Container bg="primary">
122
+ ```
123
+
124
+ You can still use full color tokens (e.g., `backgroundColor={color.blue[400]}`) by using a `StyleSheet`, the `useTheme` hook, or directly importing from the tokens library:
125
+
126
+ ```tsx
127
+ import { StyleSheet } from 'react-native';
128
+
129
+ const styles = StyleSheet.create(theme => ({
130
+ customBackground: {
131
+ backgroundColor: theme.color.blue[400],
132
+ },
133
+ }));
134
+
135
+ <Box style={styles.customBackground} />;
136
+ ```
137
+
138
+ ```tsx
139
+ import { useTheme } from '@utilitywarehouse/hearth-react-native';
140
+
141
+ const theme = useTheme();
142
+
143
+ <Box backgroundColor={theme.color.purple[800]} />;
144
+ ```
145
+
146
+ ```tsx
147
+ import { color } from '@utilitywarehouse/hearth-tokens';
148
+
149
+ <Box backgroundColor={color.blue[400]} />;
150
+ ```
151
+
152
+ ### Text Colors
153
+
154
+ Text color props now accept simplified semantic tokens:
155
+
156
+ ```diff
157
+ - <BodyText color="white">Text</BodyText>
158
+ + <BodyText color="inverted">Text</BodyText>
159
+
160
+ - <BodyText color="grey1000">Text</BodyText>
161
+ + <BodyText color="primary">Text</BodyText>
162
+
163
+ - <Heading color="textSecondary">Heading</Heading>
164
+ + <Heading color="secondary">Heading</Heading>
165
+ ```
166
+
167
+ ### Border Colors
168
+
169
+ Border color props now accept simplified semantic tokens:
170
+
171
+ ```diff
172
+ - <Box borderColor="grey800">
173
+ + <Box borderColor="strong">
174
+
175
+ - <Box borderColor="borderSubtle">
176
+ + <Box borderColor="subtle">
177
+ ```
178
+
179
+ ### Utility Props
180
+
181
+ Components now support consistent utility props through shared type interfaces. The following components have been updated to support additional utility props:
182
+ - **Container**: Added `MarginProps`, `PaddingProps`, `GapProps`, and `BackgroundColorProps`
183
+ - **Card**: Added `MarginProps` and `GapProps`
184
+ - **Flex**: Now properly supports `MarginProps`, `PaddingProps`, and `GapProps`
185
+ - **Text components** (BodyText, Heading, DetailText): Now support `MarginProps`
186
+
187
+ This means you can now use margin utilities directly on these components:
188
+
189
+ ```tsx
190
+ <BodyText mt="200" mb="100">Text with margin utilities</BodyText>
191
+ <Container mx="300" py="200">Container with spacing utilities</Container>
192
+ <Card mt="200" gap="100">Card with margin and gap utilities</Card>
193
+ ```
194
+
195
+ **Migration guide**:
196
+ 1. Replace semantic background color tokens:
197
+ - `backgroundPrimary` → `primary`
198
+ - `backgroundSecondary` → `secondary`
199
+ - `backgroundBrand` → `brand`
200
+ 2. Replace semantic text color tokens:
201
+ - `white` → `inverted` (for text on dark backgrounds)
202
+ - `grey1000` / `textPrimary` → `primary`
203
+ - `textSecondary` → `secondary`
204
+ 3. Replace semantic border color tokens:
205
+ - `grey800` / `borderStrong` → `strong`
206
+ - `borderSubtle` → `subtle`
207
+ 4. For non-semantic colors, use a `StyleSheet` and use the full color token from the theme:
208
+
209
+ ```tsx
210
+ import { StyleSheet } from 'react-native';
211
+
212
+ const styles = StyleSheet.create(theme => ({
213
+ customBackground: {
214
+ backgroundColor: theme.color.blue[400],
215
+ },
216
+ }));
217
+
218
+ <Box style={styles.customBackground} />;
219
+ ```
220
+
221
+ or the `useTheme` hook:
222
+
223
+ ```tsx
224
+ import { useTheme } from '@utilitywarehouse/hearth-react-native';
225
+
226
+ const theme = useTheme();
227
+ <Box backgroundColor={theme.color.purple[800]} />;
228
+ ```
229
+
230
+ or use the tokens library:
231
+
232
+ ```tsx
233
+ import { color } from '@utilitywarehouse/hearth-tokens';
234
+
235
+ <Box backgroundColor={color.purple[800]} />;
236
+ ```
237
+
238
+ **Backwards compatibility**:
239
+
240
+ The full color tokens (e.g., `backgroundPrimary`, `grey1000`) are still supported as fallbacks but are deprecated and will cause type errors. We recommend migrating to the simplified tokens for a cleaner API.
241
+
242
+ **References**:
243
+ - [Semantic tokens documentation](https://github.com/utilitywarehouse/hearth/blob/main/packages/tokens/src/semantic-light.ts)
244
+
245
+ ### Patch Changes
246
+
247
+ - [#917](https://github.com/utilitywarehouse/hearth/pull/917) [`6a016dc`](https://github.com/utilitywarehouse/hearth/commit/6a016dca0d1a06e40a877da15aced590d0c68112) Thanks [@jordmccord](https://github.com/jordmccord)! - 💅 [ENHANCEMENT]: Update design tokens from Figma
248
+
249
+ Updated design tokens to include new font sizes, line heights, and component-specific tokens:
250
+ - Added `background.loading` colour token for both light and dark modes
251
+ - Added new font sizes: 575 (44px) and 650 (54px)
252
+ - Added new line heights: 975 (52px) and 1050 (62px)
253
+ - Updated `Modal` component tokens with `mobile.paddingBottom` and `handle.paddingBottom` properties
254
+ - Added `borderBottom` property to `Navigation` component tokens
255
+ - Updated `Skeleton` component `loadingColor` value in light mode
256
+
257
+ **Developer changes**:
258
+
259
+ No changes required. These tokens are automatically applied to components that use them.
260
+
12
261
  ## 0.20.0
13
262
 
14
263
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utilitywarehouse/hearth-react-native",
3
- "version": "0.22.0",
3
+ "version": "0.23.0-test-list",
4
4
  "description": "Utility Warehouse React Native UI library",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -43,7 +43,7 @@
43
43
  "react-native": "0.80.0",
44
44
  "react-native-edge-to-edge": "1.6.1",
45
45
  "react-native-gesture-handler": "2.28.0",
46
- "react-native-nitro-modules": "^0.31.4",
46
+ "react-native-nitro-modules": "0.31.4",
47
47
  "react-native-reanimated": "4.1.3",
48
48
  "react-native-svg": "^15.12.1",
49
49
  "react-native-unistyles": "3.0.17",
@@ -55,9 +55,9 @@
55
55
  "vite": "^7.1.3",
56
56
  "vite-plugin-svgr": "^4.5.0",
57
57
  "vitest": "^3.2.4",
58
+ "@utilitywarehouse/hearth-react-native-icons": "^0.8.0",
58
59
  "@utilitywarehouse/hearth-fonts": "^0.0.4",
59
60
  "@utilitywarehouse/hearth-react-icons": "^0.8.0",
60
- "@utilitywarehouse/hearth-react-native-icons": "^0.8.0",
61
61
  "@utilitywarehouse/hearth-svg-assets": "^0.5.0",
62
62
  "@utilitywarehouse/hearth-tokens": "^0.2.3"
63
63
  },