@utilitywarehouse/hearth-react-native 0.19.0 → 0.19.1
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.
- package/.storybook/preview.tsx +1 -0
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +16 -16
- package/CHANGELOG.md +26 -0
- package/build/components/Menu/Menu.d.ts +1 -1
- package/build/components/Menu/Menu.js +2 -2
- package/build/components/Menu/Menu.props.d.ts +2 -6
- package/build/components/Modal/Modal.d.ts +1 -1
- package/build/components/Modal/Modal.js +2 -2
- package/build/components/Modal/Modal.props.d.ts +1 -0
- package/build/components/Modal/Modal.web.d.ts +1 -1
- package/build/components/Modal/Modal.web.js +2 -2
- package/build/components/Toast/ToastItem.js +3 -1
- package/docs/changelog.mdx +687 -0
- package/package.json +4 -4
- package/scripts/copyChangelog.js +50 -0
- package/src/components/Menu/Menu.docs.mdx +8 -5
- package/src/components/Menu/Menu.figma.tsx +27 -27
- package/src/components/Menu/Menu.props.ts +2 -6
- package/src/components/Menu/Menu.tsx +3 -6
- package/src/components/Menu/MenuItem.figma.tsx +26 -18
- package/src/components/Modal/Modal.docs.mdx +22 -21
- package/src/components/Modal/Modal.figma.tsx +58 -47
- package/src/components/Modal/Modal.props.ts +1 -0
- package/src/components/Modal/Modal.stories.tsx +4 -0
- package/src/components/Modal/Modal.tsx +2 -1
- package/src/components/Modal/Modal.web.tsx +2 -1
- package/src/components/Toast/ToastItem.tsx +3 -1
package/.storybook/preview.tsx
CHANGED
package/.turbo/turbo-build.log
CHANGED
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @utilitywarehouse/hearth-react-native@0.19.
|
|
2
|
+
> @utilitywarehouse/hearth-react-native@0.19.1 lint /home/runner/work/hearth/hearth/packages/react-native
|
|
3
3
|
> TIMING=1 eslint .
|
|
4
4
|
|
|
5
5
|
|
|
@@ -31,11 +31,11 @@
|
|
|
31
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
32
|
|
|
33
33
|
/home/runner/work/hearth/hearth/packages/react-native/src/components/Modal/Modal.tsx
|
|
34
|
-
|
|
35
|
-
|
|
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
36
|
|
|
37
37
|
/home/runner/work/hearth/hearth/packages/react-native/src/components/Modal/Modal.web.tsx
|
|
38
|
-
|
|
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
39
|
|
|
40
40
|
/home/runner/work/hearth/hearth/packages/react-native/src/components/PillGroup/PillGroup.tsx
|
|
41
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
|
|
@@ -58,15 +58,15 @@
|
|
|
58
58
|
|
|
59
59
|
✖ 25 problems (0 errors, 25 warnings)
|
|
60
60
|
|
|
61
|
-
Rule
|
|
62
|
-
|
|
63
|
-
@typescript-eslint/no-unused-vars
|
|
64
|
-
|
|
65
|
-
react-hooks/rules-of-hooks
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
no-misleading-character-class
|
|
71
|
-
no-
|
|
72
|
-
|
|
61
|
+
Rule | Time (ms) | Relative
|
|
62
|
+
:-------------------------------------------------|----------:|--------:
|
|
63
|
+
@typescript-eslint/no-unused-vars | 1514.844 | 61.6%
|
|
64
|
+
no-global-assign | 96.121 | 3.9%
|
|
65
|
+
react-hooks/rules-of-hooks | 93.488 | 3.8%
|
|
66
|
+
react-hooks/exhaustive-deps | 87.951 | 3.6%
|
|
67
|
+
no-unexpected-multiline | 50.126 | 2.0%
|
|
68
|
+
@typescript-eslint/triple-slash-reference | 46.928 | 1.9%
|
|
69
|
+
@typescript-eslint/ban-ts-comment | 41.120 | 1.7%
|
|
70
|
+
no-misleading-character-class | 40.149 | 1.6%
|
|
71
|
+
@typescript-eslint/no-unnecessary-type-constraint | 31.744 | 1.3%
|
|
72
|
+
no-loss-of-precision | 31.510 | 1.3%
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @utilitywarehouse/hearth-react-native
|
|
2
2
|
|
|
3
|
+
## 0.19.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#886](https://github.com/utilitywarehouse/hearth/pull/886) [`7a948de`](https://github.com/utilitywarehouse/hearth/commit/7a948dea0d15ce7ca34e4d405e86984213c96196) Thanks [@jordmccord](https://github.com/jordmccord)! - 💅 [ENHANCEMENT]: Add `loadingHeading` prop to `Modal` component
|
|
8
|
+
|
|
9
|
+
The `Modal` component now supports a `loadingHeading` prop to customize the heading text displayed during loading states. If not provided, it defaults to 'Loading...'.
|
|
10
|
+
|
|
11
|
+
**Components affected**:
|
|
12
|
+
- `Modal`
|
|
13
|
+
|
|
14
|
+
**Developer changes**:
|
|
15
|
+
|
|
16
|
+
No changes required. To customize the loading heading text, use the new `loadingHeading` prop:
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
<Modal
|
|
20
|
+
loading={isLoading}
|
|
21
|
+
loadingHeading="Processing your request..."
|
|
22
|
+
heading="Confirm Action"
|
|
23
|
+
description="Please wait while we process your request"
|
|
24
|
+
/>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- [#888](https://github.com/utilitywarehouse/hearth/pull/888) [`9b3e172`](https://github.com/utilitywarehouse/hearth/commit/9b3e172f9964026f4f3ba140731432ac63550256) Thanks [@jordmccord](https://github.com/jordmccord)! - 🐛 [FIX]: Align `Toast` icon and dismiss button to the top
|
|
28
|
+
|
|
3
29
|
## 0.19.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type MenuProps from './Menu.props';
|
|
2
2
|
import type { MenuMethods } from './Menu.props';
|
|
3
|
-
declare const Menu: import("react").ForwardRefExoticComponent<MenuProps & import("react").RefAttributes<MenuMethods>>;
|
|
3
|
+
declare const Menu: import("react").ForwardRefExoticComponent<Omit<MenuProps, "ref"> & import("react").RefAttributes<MenuMethods>>;
|
|
4
4
|
export default Menu;
|
|
@@ -4,7 +4,7 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
4
4
|
import { BodyText } from '../BodyText';
|
|
5
5
|
import { BottomSheetModal, BottomSheetScrollView } from '../BottomSheet';
|
|
6
6
|
import { MenuContext } from './Menu.context';
|
|
7
|
-
const Menu = forwardRef(({ heading, children,
|
|
7
|
+
const Menu = forwardRef(({ heading, children, ...props }, ref) => {
|
|
8
8
|
const bottomSheetModalRef = useRef(null);
|
|
9
9
|
useImperativeHandle(ref, () => ({
|
|
10
10
|
present: () => bottomSheetModalRef.current?.present(),
|
|
@@ -14,7 +14,7 @@ const Menu = forwardRef(({ heading, children, bottomSheetProps }, ref) => {
|
|
|
14
14
|
bottomSheetModalRef.current?.dismiss();
|
|
15
15
|
}, []);
|
|
16
16
|
const contextValue = useMemo(() => ({ close: handleClose }), [handleClose]);
|
|
17
|
-
return (_jsx(BottomSheetModal, { ref: bottomSheetModalRef, ...
|
|
17
|
+
return (_jsx(BottomSheetModal, { ref: bottomSheetModalRef, ...props, children: _jsx(BottomSheetScrollView, { contentContainerStyle: styles.container, children: _jsxs(MenuContext.Provider, { value: contextValue, children: [heading && (_jsx(BodyText, { size: "md", weight: "semibold", children: heading })), children] }) }) }));
|
|
18
18
|
});
|
|
19
19
|
Menu.displayName = 'Menu';
|
|
20
20
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { BottomSheetModalProps } from '@gorhom/bottom-sheet';
|
|
2
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import { BottomSheetProps } from '../BottomSheet';
|
|
3
3
|
export interface MenuMethods {
|
|
4
4
|
present: () => void;
|
|
5
5
|
dismiss: () => void;
|
|
6
6
|
}
|
|
7
|
-
export interface MenuProps {
|
|
7
|
+
export interface MenuProps extends BottomSheetProps {
|
|
8
8
|
/**
|
|
9
9
|
* Heading text displayed at the top of the menu
|
|
10
10
|
*/
|
|
@@ -13,9 +13,5 @@ export interface MenuProps {
|
|
|
13
13
|
* Menu items to display
|
|
14
14
|
*/
|
|
15
15
|
children: ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* Optional bottom sheet modal props to customise the menu behavior
|
|
18
|
-
*/
|
|
19
|
-
bottomSheetProps?: Partial<BottomSheetModalProps>;
|
|
20
16
|
}
|
|
21
17
|
export default MenuProps;
|
|
@@ -3,5 +3,5 @@ import ModalProps from './Modal.props';
|
|
|
3
3
|
type Modal<T = any> = BottomSheetModalMethods<T> & {
|
|
4
4
|
triggerCloseAnimation?: () => void;
|
|
5
5
|
};
|
|
6
|
-
declare const Modal: ({ ref, children, heading, description, showCloseButton, primaryButtonText, secondaryButtonText, onPressPrimaryButton, onPressCloseButton, onPressSecondaryButton, closeOnPrimaryButtonPress, closeOnSecondaryButtonPress, loading, fullscreen, image, primaryButtonProps, secondaryButtonProps, closeButtonProps, inNavModal, stickyFooter, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare const Modal: ({ ref, children, heading, description, showCloseButton, primaryButtonText, secondaryButtonText, onPressPrimaryButton, onPressCloseButton, onPressSecondaryButton, closeOnPrimaryButtonPress, closeOnSecondaryButtonPress, loading, loadingHeading, fullscreen, image, primaryButtonProps, secondaryButtonProps, closeButtonProps, inNavModal, stickyFooter, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default Modal;
|
|
@@ -13,7 +13,7 @@ import { Button } from '../Button';
|
|
|
13
13
|
import { Heading } from '../Heading';
|
|
14
14
|
import { Spinner } from '../Spinner';
|
|
15
15
|
import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
16
|
-
const Modal = ({ ref, children, heading, description, showCloseButton = true, primaryButtonText, secondaryButtonText, onPressPrimaryButton, onPressCloseButton, onPressSecondaryButton, closeOnPrimaryButtonPress = true, closeOnSecondaryButtonPress = true, loading, fullscreen = false, image, primaryButtonProps, secondaryButtonProps, closeButtonProps, inNavModal = false, stickyFooter = true, ...props }) => {
|
|
16
|
+
const Modal = ({ ref, children, heading, description, showCloseButton = true, primaryButtonText, secondaryButtonText, onPressPrimaryButton, onPressCloseButton, onPressSecondaryButton, closeOnPrimaryButtonPress = true, closeOnSecondaryButtonPress = true, loading, loadingHeading = 'Loading...', fullscreen = false, image, primaryButtonProps, secondaryButtonProps, closeButtonProps, inNavModal = false, stickyFooter = true, ...props }) => {
|
|
17
17
|
const bottomSheetModalRef = useRef(null);
|
|
18
18
|
const viewRef = useRef(null);
|
|
19
19
|
const scrollViewRef = useRef(null);
|
|
@@ -107,7 +107,7 @@ const Modal = ({ ref, children, heading, description, showCloseButton = true, pr
|
|
|
107
107
|
showHandle: props.showHandle,
|
|
108
108
|
});
|
|
109
109
|
const footer = (_jsxs(View, { style: styles.footer, children: [onPressPrimaryButton && primaryButtonText ? (_jsx(Button, { onPress: handlePrimaryButtonPress, text: primaryButtonText, ...primaryButtonProps, variant: primaryButtonProps?.variant ?? 'solid', colorScheme: primaryButtonProps?.colorScheme ?? 'highlight' })) : null, onPressSecondaryButton && secondaryButtonText ? (_jsx(Button, { onPress: handleSecondaryButtonPress, text: secondaryButtonText, ...secondaryButtonProps, variant: secondaryButtonProps?.variant ?? 'outline', colorScheme: secondaryButtonProps?.colorScheme ?? 'functional' })) : null] }));
|
|
110
|
-
const content = (_jsx(_Fragment, { children: loading ? (_jsxs(View, { style: styles.loadingContainer, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Loading' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsx(Spinner, { size: "lg" }), _jsx(Heading, { size: "lg", textAlign: "center", children:
|
|
110
|
+
const content = (_jsx(_Fragment, { children: loading ? (_jsxs(View, { style: styles.loadingContainer, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Loading' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsx(Spinner, { size: "lg" }), _jsx(Heading, { size: "lg", textAlign: "center", children: loadingHeading })] })) : (_jsxs(View, { style: styles.container, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Modal content' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsxs(View, { style: styles.header, children: [_jsxs(View, { style: styles.headerTextContent, children: [heading && !image ? (_jsx(Heading, { size: "lg", accessible: true, children: heading })) : null, description && !image ? _jsx(BodyText, { accessible: true, children: description }) : null] }), showCloseButton ? (_jsx(UnstyledIconButton, { icon: CloseMediumIcon, onPress: handleCloseButtonPress, accessibilityLabel: "Close modal", ...closeButtonProps })) : null] }), image ? (_jsxs(View, { style: styles.imageContainer, children: [image, _jsxs(View, { style: styles.textContent, children: [heading ? (_jsx(Heading, { size: "lg", textAlign: "center", accessible: true, children: heading })) : null, description ? (_jsx(BodyText, { textAlign: "center", accessible: true, children: description })) : null] })] })) : null, children, !stickyFooter && !noButtons ? footer : null] })) }));
|
|
111
111
|
const renderFooter = useCallback((props) => (_jsx(BottomSheetFooter, { ...props, children: _jsx(View, { style: styles.footerWrap, children: footer }) })), [
|
|
112
112
|
onPressPrimaryButton,
|
|
113
113
|
primaryButtonText,
|
|
@@ -3,5 +3,5 @@ import ModalProps from './Modal.props';
|
|
|
3
3
|
type Modal<T = any> = BottomSheetModalMethods<T> & {
|
|
4
4
|
triggerCloseAnimation?: () => void;
|
|
5
5
|
};
|
|
6
|
-
declare const Modal: ({ ref, children, heading, description, showCloseButton, primaryButtonText, secondaryButtonText, onPressPrimaryButton, onPressCloseButton, onPressSecondaryButton, closeOnPrimaryButtonPress, closeOnSecondaryButtonPress, loading, image, primaryButtonProps, secondaryButtonProps, closeButtonProps, inNavModal, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare const Modal: ({ ref, children, heading, description, showCloseButton, primaryButtonText, secondaryButtonText, onPressPrimaryButton, onPressCloseButton, onPressSecondaryButton, closeOnPrimaryButtonPress, closeOnSecondaryButtonPress, loading, loadingHeading, image, primaryButtonProps, secondaryButtonProps, closeButtonProps, inNavModal, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default Modal;
|
|
@@ -12,7 +12,7 @@ import { Button } from '../Button';
|
|
|
12
12
|
import { Heading } from '../Heading';
|
|
13
13
|
import { Spinner } from '../Spinner';
|
|
14
14
|
import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
15
|
-
const Modal = ({ ref, children, heading, description, showCloseButton = true, primaryButtonText, secondaryButtonText, onPressPrimaryButton, onPressCloseButton, onPressSecondaryButton, closeOnPrimaryButtonPress = true, closeOnSecondaryButtonPress = true, loading, image, primaryButtonProps, secondaryButtonProps, closeButtonProps, inNavModal = false, ...props }) => {
|
|
15
|
+
const Modal = ({ ref, children, heading, description, showCloseButton = true, primaryButtonText, secondaryButtonText, onPressPrimaryButton, onPressCloseButton, onPressSecondaryButton, closeOnPrimaryButtonPress = true, closeOnSecondaryButtonPress = true, loading, loadingHeading = 'Loading...', image, primaryButtonProps, secondaryButtonProps, closeButtonProps, inNavModal = false, ...props }) => {
|
|
16
16
|
const bottomSheetModalRef = useRef(null);
|
|
17
17
|
const viewRef = useRef(null);
|
|
18
18
|
const scrollViewRef = useRef(null);
|
|
@@ -97,7 +97,7 @@ const Modal = ({ ref, children, heading, description, showCloseButton = true, pr
|
|
|
97
97
|
bottomSheetModalRef.current?.dismiss();
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
const content = (_jsx(_Fragment, { children: loading ? (_jsxs(View, { style: styles.loadingContainer, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Loading' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsx(Spinner, { size: "lg" }), _jsx(Heading, { size: "lg", textAlign: "center", children:
|
|
100
|
+
const content = (_jsx(_Fragment, { children: loading ? (_jsxs(View, { style: styles.loadingContainer, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Loading' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsx(Spinner, { size: "lg" }), _jsx(Heading, { size: "lg", textAlign: "center", children: loadingHeading })] })) : (_jsxs(View, { style: styles.container, accessible: Platform.OS === 'android' ? true : undefined, accessibilityLabel: Platform.OS === 'android' ? 'Modal content' : undefined, screenReaderFocusable: true, ref: viewRef, children: [_jsxs(View, { style: styles.header, children: [_jsxs(View, { style: styles.headerTextContent, children: [heading && !image ? (_jsx(Heading, { size: "lg", accessible: true, children: heading })) : null, description && !image ? _jsx(BodyText, { accessible: true, children: description }) : null] }), showCloseButton ? (_jsx(UnstyledIconButton, { icon: CloseMediumIcon, onPress: handleCloseButtonPress, accessibilityLabel: "Close modal", ...closeButtonProps })) : null] }), image ? (_jsxs(View, { style: styles.imageContainer, children: [image, _jsxs(View, { style: styles.textContent, children: [heading ? (_jsx(Heading, { size: "lg", textAlign: "center", accessible: true, children: heading })) : null, description ? (_jsx(BodyText, { textAlign: "center", accessible: true, children: description })) : null] })] })) : null, children, _jsxs(View, { style: styles.footer, children: [onPressPrimaryButton && primaryButtonText ? (_jsx(Button, { onPress: handlePrimaryButtonPress, text: primaryButtonText, ...primaryButtonProps, variant: primaryButtonProps?.variant ?? 'solid', colorScheme: primaryButtonProps?.colorScheme ?? 'highlight' })) : null, onPressSecondaryButton && secondaryButtonText ? (_jsx(Button, { onPress: handleSecondaryButtonPress, text: secondaryButtonText, ...secondaryButtonProps, variant: secondaryButtonProps?.variant ?? 'outline', colorScheme: secondaryButtonProps?.colorScheme ?? 'functional' })) : null] })] })) }));
|
|
101
101
|
return inNavModal ? (_jsxs(View, { style: { flex: 1, backgroundColor: theme.color.background.primary }, children: [Platform.OS === 'android' ? (_jsx(Animated.View, { style: [styles.androidContainer, animatedBackgroundStyle], children: _jsx(Animated.View, { style: [styles.pretendContent, animatedPretendContentStyle] }) })) : null, _jsx(Animated.View, { style: [styles.inNavModalContainer, Platform.OS === 'android' && animatedInNavModalStyle], children: _jsx(View, { style: styles.inNavModalContent, children: content }) })] })) : (_jsx(BottomSheetModal, { ref: bottomSheetModalRef, enableDynamicSizing: true, snapPoints: image ? ['90%'] : props.snapPoints, showHandle: typeof loading !== 'undefined' && loading ? false : props.showHandle, accessible: false, ...props, onChange: handleChange, children: _jsx(BottomSheetScrollView, { contentContainerStyle: styles.container, ref: scrollViewRef, children: content }) }));
|
|
102
102
|
};
|
|
103
103
|
const styles = StyleSheet.create((theme, rt) => ({
|
|
@@ -109,7 +109,8 @@ const styles = StyleSheet.create(theme => ({
|
|
|
109
109
|
width: 24,
|
|
110
110
|
height: 24,
|
|
111
111
|
justifyContent: 'center',
|
|
112
|
-
|
|
112
|
+
alignSelf: 'flex-start',
|
|
113
|
+
alignItems: 'flex-start',
|
|
113
114
|
flexShrink: 0,
|
|
114
115
|
},
|
|
115
116
|
icon: {
|
|
@@ -125,6 +126,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
125
126
|
text: { flexShrink: 1 },
|
|
126
127
|
actions: {
|
|
127
128
|
flexShrink: 0,
|
|
129
|
+
alignSelf: 'flex-start',
|
|
128
130
|
},
|
|
129
131
|
}));
|
|
130
132
|
export default ToastItem;
|