@utilitywarehouse/hearth-react-native 0.22.1 → 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 (61) hide show
  1. package/.turbo/turbo-build.log +5 -4
  2. package/CHANGELOG.md +21 -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.utils.d.ts +8 -0
  52. package/build/components/VerificationInput/VerificationInput.utils.js +17 -0
  53. package/build/components/VerificationInput/VerificationInput.utils.test.d.ts +1 -0
  54. package/build/components/VerificationInput/VerificationInput.utils.test.js +36 -0
  55. package/package.json +2 -2
  56. package/src/components/List/List.tsx +5 -4
  57. package/src/components/Modal/Modal.docs.mdx +1 -0
  58. package/src/components/Modal/Modal.props.ts +1 -0
  59. package/src/components/Modal/Modal.stories.tsx +1 -0
  60. package/src/components/Modal/Modal.tsx +21 -3
  61. package/.turbo/turbo-lint.log +0 -72
@@ -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
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utilitywarehouse/hearth-react-native",
3
- "version": "0.22.1",
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",
@@ -55,8 +55,8 @@
55
55
  "vite": "^7.1.3",
56
56
  "vite-plugin-svgr": "^4.5.0",
57
57
  "vitest": "^3.2.4",
58
- "@utilitywarehouse/hearth-fonts": "^0.0.4",
59
58
  "@utilitywarehouse/hearth-react-native-icons": "^0.8.0",
59
+ "@utilitywarehouse/hearth-fonts": "^0.0.4",
60
60
  "@utilitywarehouse/hearth-react-icons": "^0.8.0",
61
61
  "@utilitywarehouse/hearth-svg-assets": "^0.5.0",
62
62
  "@utilitywarehouse/hearth-tokens": "^0.2.3"
@@ -14,7 +14,8 @@ const List = ({
14
14
  invalidText,
15
15
  ...props
16
16
  }: ListProps) => {
17
- const { loading, disabled, container = 'none' } = props;
17
+ const { loading, disabled, container = 'none', testID, style, ...rest } = props;
18
+
18
19
  const orderRef = useRef<string[]>([]);
19
20
  const [firstItemId, setFirstItemId] = useState<string | undefined>(undefined);
20
21
  const containerToCard: {
@@ -51,7 +52,7 @@ const List = ({
51
52
  styles.useVariants({ disabled });
52
53
  return (
53
54
  <ListContext.Provider value={value}>
54
- <View {...props} style={[styles.container, props.style]}>
55
+ <View {...rest} style={[styles.container, style]}>
55
56
  {heading ? (
56
57
  <SectionHeader
57
58
  heading={heading}
@@ -61,10 +62,10 @@ const List = ({
61
62
  />
62
63
  ) : null}
63
64
  {container === 'none' ? (
64
- <View>{children}</View>
65
+ <View testID={testID}>{children}</View>
65
66
  ) : (
66
67
  React.Children.count(children) > 0 && (
67
- <Card {...containerToCard} noPadding style={styles.card}>
68
+ <Card {...containerToCard} noPadding style={styles.card} testID={testID}>
68
69
  <>{children}</>
69
70
  </Card>
70
71
  )
@@ -109,6 +109,7 @@ The Modal component extends the `BottomSheetModal` component and accepts all of
109
109
  | `closeButtonProps` | `Omit<UnstyledIconButtonProps, 'children'>` | Additional props to pass to the close button | - |
110
110
  | `fullscreen` | `boolean` | Whether the modal should take up the full screen height | `false` |
111
111
  | `inNavModal` | `boolean` | Renders the modal correctly when used inside a navigation modal | `false` |
112
+ | `background` | `'default' \| 'brand'` | Sets the modal background. Only applies when `inNavModal` is `true` | `'default'` |
112
113
 
113
114
  \* use this to detect if the modal has been opened or closed, index 0 indicates open state and -1 indicates closed state
114
115
 
@@ -25,6 +25,7 @@ interface ModalProps extends Omit<BottomSheetProps, 'children'> {
25
25
  primaryButtonProps?: Omit<ButtonWithoutChildrenProps, 'children'>;
26
26
  secondaryButtonProps?: Omit<ButtonWithoutChildrenProps, 'children'>;
27
27
  closeButtonProps?: Omit<UnstyledIconButtonProps, 'children'>;
28
+ background?: 'default' | 'brand';
28
29
  }
29
30
 
30
31
  export default ModalProps;
@@ -66,6 +66,7 @@ const meta = {
66
66
  onPressCloseButton: () => null,
67
67
  onPressPrimaryButton: () => null,
68
68
  onPressSecondaryButton: () => null,
69
+ background: 'brand',
69
70
  },
70
71
  } satisfies Meta<typeof Modal>;
71
72
 
@@ -7,7 +7,7 @@ import {
7
7
  import { BottomSheetModalMethods } from '@gorhom/bottom-sheet/lib/typescript/types';
8
8
  import { CloseMediumIcon } from '@utilitywarehouse/hearth-react-native-icons';
9
9
  import { useCallback, useEffect, useImperativeHandle, useRef } from 'react';
10
- import { AccessibilityInfo, Platform, View, findNodeHandle } from 'react-native';
10
+ import { AccessibilityInfo, Platform, ScrollView, View, findNodeHandle } from 'react-native';
11
11
  import Animated, {
12
12
  Easing,
13
13
  useAnimatedStyle,
@@ -50,6 +50,7 @@ const Modal = ({
50
50
  closeButtonProps,
51
51
  inNavModal = false,
52
52
  stickyFooter = true,
53
+ background = 'default',
53
54
  ...props
54
55
  }: ModalProps) => {
55
56
  const bottomSheetModalRef = useRef<BottomSheetModal>(null);
@@ -170,6 +171,7 @@ const Modal = ({
170
171
  noButtons,
171
172
  stickyFooter,
172
173
  showHandle: props.showHandle,
174
+ background: background === 'brand' ? 'brand' : 'primary',
173
175
  });
174
176
 
175
177
  const footer = (
@@ -178,6 +180,7 @@ const Modal = ({
178
180
  <Button
179
181
  onPress={handlePrimaryButtonPress}
180
182
  text={primaryButtonText}
183
+ inverted={background === 'brand' && inNavModal}
181
184
  {...primaryButtonProps}
182
185
  variant={(primaryButtonProps?.variant as 'solid') ?? 'solid'}
183
186
  colorScheme={(primaryButtonProps?.colorScheme as 'highlight') ?? 'highlight'}
@@ -187,6 +190,7 @@ const Modal = ({
187
190
  <Button
188
191
  onPress={handleSecondaryButtonPress}
189
192
  text={secondaryButtonText}
193
+ inverted={background === 'brand' && inNavModal}
190
194
  {...secondaryButtonProps}
191
195
  variant={(secondaryButtonProps?.variant as 'outline') ?? 'outline'}
192
196
  colorScheme={(secondaryButtonProps?.colorScheme as 'functional') ?? 'functional'}
@@ -232,6 +236,7 @@ const Modal = ({
232
236
  icon={CloseMediumIcon}
233
237
  onPress={handleCloseButtonPress}
234
238
  accessibilityLabel="Close modal"
239
+ inverted={background === 'brand' && inNavModal}
235
240
  {...closeButtonProps}
236
241
  />
237
242
  ) : null}
@@ -253,7 +258,7 @@ const Modal = ({
253
258
  </View>
254
259
  </View>
255
260
  ) : null}
256
- {children}
261
+ {inNavModal ? <ScrollView style={{ flex: 1 }}>{children}</ScrollView> : children}
257
262
  {(!stickyFooter || inNavModal) && !noButtons ? footer : null}
258
263
  </View>
259
264
  )}
@@ -277,7 +282,12 @@ const Modal = ({
277
282
  );
278
283
 
279
284
  return inNavModal ? (
280
- <View style={{ flex: 1, backgroundColor: theme.color.background.primary }}>
285
+ <View
286
+ style={{
287
+ flex: 1,
288
+ backgroundColor: theme.color.background[background === 'brand' ? 'brand' : 'primary'],
289
+ }}
290
+ >
281
291
  {Platform.OS === 'android' ? (
282
292
  <Animated.View style={[styles.androidContainer, animatedBackgroundStyle]}>
283
293
  <Animated.View style={[styles.pretendContent, animatedPretendContentStyle]} />
@@ -420,6 +430,14 @@ const styles = StyleSheet.create((theme, rt) => ({
420
430
  gap: theme.components.modal.gap,
421
431
  padding: theme.components.modal.padding,
422
432
  paddingBottom: theme.components.modal.padding + rt.insets.bottom,
433
+ variants: {
434
+ background: {
435
+ primary: {},
436
+ brand: {
437
+ backgroundColor: theme.color.background.brand,
438
+ },
439
+ },
440
+ },
423
441
  },
424
442
  androidContainer: {
425
443
  height: rt.insets.top + 18,
@@ -1,72 +0,0 @@
1
-
2
- > @utilitywarehouse/hearth-react-native@0.22.1 lint /home/runner/work/hearth/hearth/packages/react-native
3
- > TIMING=1 eslint .
4
-
5
-
6
- /home/runner/work/hearth/hearth/packages/react-native/src/components/Carousel/Carousel.context.tsx
7
- 6:14 warning Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components react-refresh/only-export-components
8
-
9
- /home/runner/work/hearth/hearth/packages/react-native/src/components/Carousel/Carousel.tsx
10
- 146:6 warning React Hook useMemo has a missing dependency: 'hasCarouselControlsInTree'. Either include it or remove the dependency array react-hooks/exhaustive-deps
11
-
12
- /home/runner/work/hearth/hearth/packages/react-native/src/components/DatePicker/DatePicker.tsx
13
- 109:6 warning React Hook useCallback has an unnecessary dependency: 'modalRef.current'. Either exclude it or remove the dependency array. Mutable values like 'modalRef.current' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
14
- 259:6 warning React Hook useEffect has a missing dependency: 'initialState'. Either include it or remove the dependency array react-hooks/exhaustive-deps
15
- 346:6 warning React Hook useEffect has a missing dependency: 'onChange'. Either include it or remove the dependency array react-hooks/exhaustive-deps
16
- 468:5 warning React Hook useCallback has a missing dependency: 'onChange'. Either include it or remove the dependency array react-hooks/exhaustive-deps
17
- 536:6 warning React Hook useEffect has a missing dependency: 'onSelectMonth'. Either include it or remove the dependency array react-hooks/exhaustive-deps
18
- 542:6 warning React Hook useEffect has a missing dependency: 'onSelectYear'. Either include it or remove the dependency array react-hooks/exhaustive-deps
19
-
20
- /home/runner/work/hearth/hearth/packages/react-native/src/components/DatePicker/DatePickerDay.tsx
21
- 76:6 warning React Hook useMemo has an unnecessary dependency: 'styles.rangeRoot'. Either exclude it or remove the dependency array. Outer scope values like 'styles.rangeRoot' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
22
- 84:6 warning React Hook useMemo has a missing dependency: 'isSelected'. Either include it or remove the dependency array react-hooks/exhaustive-deps
23
-
24
- /home/runner/work/hearth/hearth/packages/react-native/src/components/DatePicker/DatePickerDays.tsx
25
- 179:6 warning React Hook useMemo has unnecessary dependencies: 'month' and 'year'. Either exclude them or remove the dependency array react-hooks/exhaustive-deps
26
-
27
- /home/runner/work/hearth/hearth/packages/react-native/src/components/DatePicker/DatePickerYears.tsx
28
- 52:6 warning React Hook useCallback has a missing dependency: 'containerHeight'. Either include it or remove the dependency array. Outer scope values like 'styles' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
29
-
30
- /home/runner/work/hearth/hearth/packages/react-native/src/components/Input/Input.tsx
31
- 78:8 warning React Hook useEffect has a missing dependency: 'formFieldContext'. Either include it or remove the dependency array react-hooks/exhaustive-deps
32
-
33
- /home/runner/work/hearth/hearth/packages/react-native/src/components/Modal/Modal.tsx
34
- 73:6 warning React Hook useCallback has an unnecessary dependency: 'Platform.OS'. Either exclude it or remove the dependency array. Outer scope values like 'Platform.OS' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
35
- 269:5 warning React Hook useCallback has a missing dependency: 'footer'. Either include it or remove the dependency array react-hooks/exhaustive-deps
36
-
37
- /home/runner/work/hearth/hearth/packages/react-native/src/components/Modal/Modal.web.tsx
38
- 66:6 warning React Hook useCallback has an unnecessary dependency: 'Platform.OS'. Either exclude it or remove the dependency array. Outer scope values like 'Platform.OS' aren't valid dependencies because mutating them doesn't re-render the component react-hooks/exhaustive-deps
39
-
40
- /home/runner/work/hearth/hearth/packages/react-native/src/components/PillGroup/PillGroup.tsx
41
- 17:9 warning The 'normalizedValue' conditional could make the dependencies of useMemo Hook (at line 33) change on every render. Move it inside the useMemo callback. Alternatively, wrap the initialization of 'normalizedValue' in its own useMemo() Hook react-hooks/exhaustive-deps
42
-
43
- /home/runner/work/hearth/hearth/packages/react-native/src/components/Tabs/Tabs.tsx
44
- 53:6 warning React Hook useEffect has a missing dependency: 'tabValues'. Either include it or remove the dependency array react-hooks/exhaustive-deps
45
- 53:7 warning React Hook useEffect has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked react-hooks/exhaustive-deps
46
- 104:5 warning React Hook useMemo has an unnecessary dependency: 'tabValues'. Either exclude it or remove the dependency array react-hooks/exhaustive-deps
47
- 127:62 warning React Hook useEffect has a complex expression in the dependency array. Extract it to a separate variable so it can be statically checked react-hooks/exhaustive-deps
48
-
49
- /home/runner/work/hearth/hearth/packages/react-native/src/components/Textarea/Textarea.tsx
50
- 45:6 warning React Hook useEffect has a missing dependency: 'formFieldContext'. Either include it or remove the dependency array react-hooks/exhaustive-deps
51
-
52
- /home/runner/work/hearth/hearth/packages/react-native/src/components/Toast/Toast.context.tsx
53
- 14:14 warning Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components react-refresh/only-export-components
54
- 106:14 warning Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components react-refresh/only-export-components
55
-
56
- /home/runner/work/hearth/hearth/packages/react-native/src/components/VerificationInput/VerificationInput.tsx
57
- 174:7 warning React Hook useImperativeHandle has a missing dependency: 'updateValue'. Either include it or remove the dependency array react-hooks/exhaustive-deps
58
-
59
- ✖ 25 problems (0 errors, 25 warnings)
60
-
61
- Rule | Time (ms) | Relative
62
- :-----------------------------------------|----------:|--------:
63
- @typescript-eslint/no-unused-vars | 1480.154 | 63.5%
64
- no-global-assign | 86.111 | 3.7%
65
- react-hooks/exhaustive-deps | 81.893 | 3.5%
66
- react-hooks/rules-of-hooks | 58.807 | 2.5%
67
- no-misleading-character-class | 53.302 | 2.3%
68
- @typescript-eslint/ban-ts-comment | 49.364 | 2.1%
69
- no-unexpected-multiline | 36.564 | 1.6%
70
- no-fallthrough | 32.890 | 1.4%
71
- @typescript-eslint/triple-slash-reference | 30.004 | 1.3%
72
- no-regex-spaces | 26.454 | 1.1%