@utilitywarehouse/hearth-react-native 0.29.1 → 0.30.0
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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +13 -13
- package/CHANGELOG.md +82 -0
- package/build/components/BottomSheet/BottomSheet.context.d.ts +1 -0
- package/build/components/BottomSheet/BottomSheet.context.js +3 -1
- package/build/components/BottomSheet/BottomSheet.js +5 -1
- package/build/components/BottomSheet/BottomSheetFlatList.js +16 -2
- package/build/components/BottomSheet/BottomSheetModal.js +5 -1
- package/build/components/BottomSheet/BottomSheetModalProvider.d.ts +9 -0
- package/build/components/BottomSheet/BottomSheetModalProvider.js +14 -0
- package/build/components/BottomSheet/BottomSheetScrollView.js +16 -2
- package/build/components/BottomSheet/BottomSheetView.js +16 -2
- package/build/components/BottomSheet/index.d.ts +3 -1
- package/build/components/BottomSheet/index.js +2 -1
- package/build/components/Combobox/Combobox.js +3 -1
- package/build/components/DescriptionList/DescriptionListItem.js +1 -2
- package/build/components/ExpandableCard/ExpandableCardTriggerRoot.js +2 -2
- package/build/components/Heading/Heading.js +1 -1
- package/build/components/List/List.js +2 -2
- package/build/components/List/ListAction/ListAction.js +1 -1
- package/build/components/List/ListItem/ListItemRoot.js +2 -2
- package/build/components/Modal/Modal.d.ts +1 -1
- package/build/components/Modal/Modal.js +56 -10
- package/build/components/Modal/Modal.shared.types.d.ts +1 -0
- package/build/components/NavModal/NavModal.d.ts +1 -1
- package/build/components/NavModal/NavModal.js +2 -2
- package/build/components/Select/Select.js +3 -1
- package/docs/changelog.mdx +86 -0
- package/package.json +3 -3
- package/src/components/BottomSheet/BottomSheet.context.ts +4 -1
- package/src/components/BottomSheet/BottomSheet.docs.mdx +20 -0
- package/src/components/BottomSheet/BottomSheet.tsx +8 -1
- package/src/components/BottomSheet/BottomSheetFlatList.tsx +16 -2
- package/src/components/BottomSheet/BottomSheetModal.tsx +8 -1
- package/src/components/BottomSheet/BottomSheetModalProvider.tsx +33 -0
- package/src/components/BottomSheet/BottomSheetScrollView.tsx +16 -2
- package/src/components/BottomSheet/BottomSheetView.tsx +17 -2
- package/src/components/BottomSheet/index.ts +2 -1
- package/src/components/Combobox/Combobox.tsx +3 -1
- package/src/components/DescriptionList/DescriptionListItem.tsx +1 -2
- package/src/components/ExpandableCard/ExpandableCardTriggerRoot.tsx +4 -4
- package/src/components/Heading/Heading.docs.mdx +12 -3
- package/src/components/Heading/Heading.tsx +1 -0
- package/src/components/List/List.docs.mdx +2 -2
- package/src/components/List/List.stories.tsx +6 -5
- package/src/components/List/List.tsx +14 -2
- package/src/components/List/ListAction/ListAction.tsx +1 -0
- package/src/components/List/ListItem/ListItemRoot.tsx +3 -3
- package/src/components/Modal/Modal.docs.mdx +36 -21
- package/src/components/Modal/Modal.shared.types.ts +1 -0
- package/src/components/Modal/Modal.tsx +60 -9
- package/src/components/NavModal/NavModal.docs.mdx +1 -0
- package/src/components/NavModal/NavModal.tsx +10 -1
- package/src/components/Select/Select.tsx +3 -1
package/.turbo/turbo-build.log
CHANGED
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @utilitywarehouse/hearth-react-native@0.
|
|
2
|
+
> @utilitywarehouse/hearth-react-native@0.30.0 lint /home/runner/work/hearth/hearth/packages/react-native
|
|
3
3
|
> TIMING=1 eslint .
|
|
4
4
|
|
|
5
5
|
|
|
@@ -51,15 +51,15 @@
|
|
|
51
51
|
|
|
52
52
|
✖ 22 problems (0 errors, 22 warnings)
|
|
53
53
|
|
|
54
|
-
Rule
|
|
55
|
-
|
|
56
|
-
@typescript-eslint/no-unused-vars
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
no-
|
|
63
|
-
no-
|
|
64
|
-
@typescript-eslint/
|
|
65
|
-
no-
|
|
54
|
+
Rule | Time (ms) | Relative
|
|
55
|
+
:---------------------------------|----------:|--------:
|
|
56
|
+
@typescript-eslint/no-unused-vars | 1641.469 | 60.9%
|
|
57
|
+
no-global-assign | 98.820 | 3.7%
|
|
58
|
+
react-hooks/exhaustive-deps | 93.179 | 3.5%
|
|
59
|
+
no-unexpected-multiline | 70.646 | 2.6%
|
|
60
|
+
react-hooks/rules-of-hooks | 65.259 | 2.4%
|
|
61
|
+
@typescript-eslint/ban-ts-comment | 45.783 | 1.7%
|
|
62
|
+
no-misleading-character-class | 45.630 | 1.7%
|
|
63
|
+
no-loss-of-precision | 43.137 | 1.6%
|
|
64
|
+
@typescript-eslint/no-this-alias | 38.127 | 1.4%
|
|
65
|
+
no-control-regex | 32.544 | 1.2%
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,87 @@
|
|
|
1
1
|
# @utilitywarehouse/hearth-react-native
|
|
2
2
|
|
|
3
|
+
## 0.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1072](https://github.com/utilitywarehouse/hearth/pull/1072) [`55f0095`](https://github.com/utilitywarehouse/hearth/commit/55f009576ba55081de358bccc21691861ddd7c33) Thanks [@jordmccord](https://github.com/jordmccord)! - 🌟 [FEATURE]: Add `loadingDescription` support to `Modal` and `NavModal`
|
|
8
|
+
|
|
9
|
+
`Modal` and `NavModal` now accept a `loadingDescription` prop to render supporting text beneath the spinner while `loading` is true. This makes it easier to give users more context during loading states without building custom loading content.
|
|
10
|
+
|
|
11
|
+
**Components affected**:
|
|
12
|
+
- `Modal`
|
|
13
|
+
- `NavModal`
|
|
14
|
+
|
|
15
|
+
**Developer changes**:
|
|
16
|
+
|
|
17
|
+
No changes are required for existing usage. To show supporting text in a loading state, pass `loadingDescription` alongside `loading` and, if needed, `loadingHeading`.
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#1070](https://github.com/utilitywarehouse/hearth/pull/1070) [`93c042c`](https://github.com/utilitywarehouse/hearth/commit/93c042c7772ab298e2ea4888a9777e8176453098) Thanks [@jordmccord](https://github.com/jordmccord)! - 🐛 [FIX]: Standardise numeric value typography across list-based components.
|
|
22
|
+
|
|
23
|
+
Numeric values in `DescriptionListItem`, `ExpandableCard`, and `ListItem` now render with semibold `BodyText` instead of `DetailText`, aligning them with the updated content hierarchy used elsewhere in the library.
|
|
24
|
+
|
|
25
|
+
**Components affected**:
|
|
26
|
+
- `DescriptionListItem`
|
|
27
|
+
- `ExpandableCard`
|
|
28
|
+
- `ListItem`
|
|
29
|
+
|
|
30
|
+
**Developer changes**:
|
|
31
|
+
|
|
32
|
+
No changes are required.
|
|
33
|
+
|
|
34
|
+
- [#1073](https://github.com/utilitywarehouse/hearth/pull/1073) [`9759622`](https://github.com/utilitywarehouse/hearth/commit/975962229137dd196e5f72a04037a8f181907818) Thanks [@jordmccord](https://github.com/jordmccord)! - 🐛 [FIX]: Announce `Heading` as a header for assistive technologies.
|
|
35
|
+
|
|
36
|
+
`Heading` now sets `accessibilityRole="header"` automatically so VoiceOver and TalkBack can identify headings as part of the screen structure.
|
|
37
|
+
|
|
38
|
+
**Components affected**:
|
|
39
|
+
- `Heading`
|
|
40
|
+
|
|
41
|
+
**Developer changes**:
|
|
42
|
+
|
|
43
|
+
No changes are required.
|
|
44
|
+
|
|
45
|
+
- [#1074](https://github.com/utilitywarehouse/hearth/pull/1074) [`95fe19e`](https://github.com/utilitywarehouse/hearth/commit/95fe19e6328bf652ff3ac1b2c723e1389fc59936) Thanks [@jordmccord](https://github.com/jordmccord)! - 🐛 [FIX]: Improve accessibility roles for `List`, `ListItem`, and `ListAction`
|
|
46
|
+
|
|
47
|
+
`List` now defaults to `accessibilityRole="list"`, `ListAction` now defaults to `accessibilityRole="button"`, and `ListItem` respects an explicitly provided `accessibilityRole` instead of always forcing button semantics when `onPress` is set.
|
|
48
|
+
|
|
49
|
+
**Components affected**:
|
|
50
|
+
- `List`
|
|
51
|
+
- `ListItem`
|
|
52
|
+
- `ListAction`
|
|
53
|
+
|
|
54
|
+
**Developer changes**:
|
|
55
|
+
|
|
56
|
+
No changes are required unless you want a tappable `ListItem` to be announced as something other than a button. In that case, pass `accessibilityRole` explicitly.
|
|
57
|
+
|
|
58
|
+
## 0.29.2
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- [#1067](https://github.com/utilitywarehouse/hearth/pull/1067) [`893cbfd`](https://github.com/utilitywarehouse/hearth/commit/893cbfd1bf090b8b75df6f58f2babaf8ba1e0033) Thanks [@jordmccord](https://github.com/jordmccord)! - 🌟 [FEATURE]: Add a `useSafeAreaInsets` prop to `BottomSheetModalProvider` to control Hearth's bottom-sheet safe-area spacing.
|
|
63
|
+
|
|
64
|
+
Bottom-sheet wrappers such as `BottomSheetView`, `BottomSheetScrollView`, `BottomSheetFlatList`, and components that render `SafeAreaView` inside a bottom sheet now respect `BottomSheetModalProvider` configuration.
|
|
65
|
+
|
|
66
|
+
**Components affected**:
|
|
67
|
+
- `BottomSheetModalProvider`
|
|
68
|
+
- `BottomSheetView`
|
|
69
|
+
- `BottomSheetScrollView`
|
|
70
|
+
- `BottomSheetFlatList`
|
|
71
|
+
- `Modal`
|
|
72
|
+
- `Select`
|
|
73
|
+
- `Combobox`
|
|
74
|
+
|
|
75
|
+
**Developer changes**:
|
|
76
|
+
|
|
77
|
+
No changes are required if you want the current behaviour. If your app already applies its own safe-area padding around bottom-sheet content, opt out like this:
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<BottomSheetModalProvider useSafeAreaInsets={false}>
|
|
81
|
+
{/* Your app content */}
|
|
82
|
+
</BottomSheetModalProvider>
|
|
83
|
+
```
|
|
84
|
+
|
|
3
85
|
## 0.29.1
|
|
4
86
|
|
|
5
87
|
### Patch Changes
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createContext, useContext } from 'react';
|
|
2
|
-
export const BottomSheetContext = createContext({
|
|
2
|
+
export const BottomSheetContext = createContext({
|
|
3
|
+
useSafeAreaInsets: true,
|
|
4
|
+
});
|
|
3
5
|
export const useBottomSheetContext = () => {
|
|
4
6
|
const context = useContext(BottomSheetContext);
|
|
5
7
|
return context;
|
|
@@ -7,6 +7,7 @@ import useBottomSheetLogic from './useBottomSheetLogic';
|
|
|
7
7
|
const StyledBottomSheetCore = withUnistyles(BottomSheetCore);
|
|
8
8
|
const BottomSheet = ({ children, containerStyle, handleStyle, backdrop = true, showHandle = true, ref, ...rest }) => {
|
|
9
9
|
const bottomSheetRef = React.useRef(null);
|
|
10
|
+
const parentContext = React.useContext(BottomSheetContext);
|
|
10
11
|
const { renderBackdrop, renderHandle } = useBottomSheetLogic({
|
|
11
12
|
ref,
|
|
12
13
|
bottomSheetRef,
|
|
@@ -14,7 +15,10 @@ const BottomSheet = ({ children, containerStyle, handleStyle, backdrop = true, s
|
|
|
14
15
|
showHandle,
|
|
15
16
|
handleStyle,
|
|
16
17
|
});
|
|
17
|
-
const value = useMemo(() => ({
|
|
18
|
+
const value = useMemo(() => ({
|
|
19
|
+
...parentContext,
|
|
20
|
+
handle: showHandle,
|
|
21
|
+
}), [parentContext, showHandle]);
|
|
18
22
|
return (_jsx(StyledBottomSheetCore, { ref: bottomSheetRef, index: -1, backdropComponent: renderBackdrop, handleComponent: renderHandle, style: [styles.container, containerStyle], backgroundStyle: styles.background, ...rest, children: _jsx(BottomSheetContext.Provider, { value: value, children: children }) }));
|
|
19
23
|
};
|
|
20
24
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -4,10 +4,11 @@ import { StyleSheet, withUnistyles } from 'react-native-unistyles';
|
|
|
4
4
|
import { useBottomSheetContext } from './BottomSheet.context';
|
|
5
5
|
const StyledBottomSheetFlatList = withUnistyles(FlatList);
|
|
6
6
|
const BottomSheetFlatList = ({ style, contentContainerStyle, isModal = true, ...props }) => {
|
|
7
|
-
const { handle } = useBottomSheetContext();
|
|
7
|
+
const { handle, useSafeAreaInsets } = useBottomSheetContext();
|
|
8
8
|
styles.useVariants({
|
|
9
9
|
isModal,
|
|
10
10
|
handle,
|
|
11
|
+
useSafeAreaInsets,
|
|
11
12
|
});
|
|
12
13
|
return (_jsx(StyledBottomSheetFlatList, { style: [styles.container, style], contentContainerStyle: [styles.contentContainer, contentContainerStyle], ...props }));
|
|
13
14
|
};
|
|
@@ -19,7 +20,7 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
19
20
|
variants: {
|
|
20
21
|
isModal: {
|
|
21
22
|
true: {
|
|
22
|
-
paddingBottom: theme.components.bottomSheet.padding
|
|
23
|
+
paddingBottom: theme.components.bottomSheet.padding,
|
|
23
24
|
},
|
|
24
25
|
},
|
|
25
26
|
handle: {
|
|
@@ -27,7 +28,20 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
27
28
|
paddingTop: theme.components.bottomSheet.padding,
|
|
28
29
|
},
|
|
29
30
|
},
|
|
31
|
+
useSafeAreaInsets: {
|
|
32
|
+
true: {},
|
|
33
|
+
false: {},
|
|
34
|
+
},
|
|
30
35
|
},
|
|
36
|
+
compoundVariants: [
|
|
37
|
+
{
|
|
38
|
+
isModal: true,
|
|
39
|
+
useSafeAreaInsets: true,
|
|
40
|
+
styles: {
|
|
41
|
+
paddingBottom: theme.components.bottomSheet.padding + rt.insets.bottom,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
31
45
|
},
|
|
32
46
|
}));
|
|
33
47
|
BottomSheetFlatList.displayName = 'BottomSheetFlatList';
|
|
@@ -7,6 +7,7 @@ import useBottomSheetLogic from './useBottomSheetLogic';
|
|
|
7
7
|
const StyledBottomSheetModalCore = withUnistyles(BottomSheetModalCore);
|
|
8
8
|
const BottomSheetModal = ({ children, containerStyle, handleStyle, backdrop = true, showHandle = true, ref, ...rest }) => {
|
|
9
9
|
const bottomSheetRef = React.useRef(null);
|
|
10
|
+
const parentContext = React.useContext(BottomSheetContext);
|
|
10
11
|
const { renderBackdrop, renderHandle } = useBottomSheetLogic({
|
|
11
12
|
// @ts-expect-error - ref
|
|
12
13
|
ref,
|
|
@@ -15,7 +16,10 @@ const BottomSheetModal = ({ children, containerStyle, handleStyle, backdrop = tr
|
|
|
15
16
|
showHandle,
|
|
16
17
|
handleStyle,
|
|
17
18
|
});
|
|
18
|
-
const value = useMemo(() => ({
|
|
19
|
+
const value = useMemo(() => ({
|
|
20
|
+
...parentContext,
|
|
21
|
+
handle: showHandle,
|
|
22
|
+
}), [parentContext, showHandle]);
|
|
19
23
|
return (_jsx(StyledBottomSheetModalCore, { ref: bottomSheetRef, backdropComponent: renderBackdrop, handleComponent: renderHandle, style: [styles.container, containerStyle], backgroundStyle: styles.background, ...rest, children: _jsx(BottomSheetContext.Provider, { value: value, children: children }) }));
|
|
20
24
|
};
|
|
21
25
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BottomSheetModalProviderProps as GorhomBottomSheetModalProviderProps } from '@gorhom/bottom-sheet/lib/typescript/components/bottomSheetModalProvider/types';
|
|
2
|
+
export interface BottomSheetModalProviderProps extends GorhomBottomSheetModalProviderProps {
|
|
3
|
+
useSafeAreaInsets?: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare const BottomSheetModalProvider: {
|
|
6
|
+
({ children, useSafeAreaInsets, ...props }: BottomSheetModalProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
export default BottomSheetModalProvider;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { BottomSheetModalProvider as GorhomBottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { BottomSheetContext, useBottomSheetContext } from './BottomSheet.context';
|
|
5
|
+
const BottomSheetModalProvider = ({ children, useSafeAreaInsets = true, ...props }) => {
|
|
6
|
+
const parentContext = useBottomSheetContext();
|
|
7
|
+
const value = useMemo(() => ({
|
|
8
|
+
...parentContext,
|
|
9
|
+
useSafeAreaInsets,
|
|
10
|
+
}), [parentContext, useSafeAreaInsets]);
|
|
11
|
+
return (_jsx(GorhomBottomSheetModalProvider, { ...props, children: _jsx(BottomSheetContext.Provider, { value: value, children: children }) }));
|
|
12
|
+
};
|
|
13
|
+
BottomSheetModalProvider.displayName = 'BottomSheetModalProvider';
|
|
14
|
+
export default BottomSheetModalProvider;
|
|
@@ -4,10 +4,11 @@ import { StyleSheet, withUnistyles } from 'react-native-unistyles';
|
|
|
4
4
|
import { useBottomSheetContext } from './BottomSheet.context';
|
|
5
5
|
const StyledBottomSheetScrollView = withUnistyles(ScrollView);
|
|
6
6
|
const BottomSheetScrollView = ({ children, style, contentContainerStyle, isModal = true, ...props }) => {
|
|
7
|
-
const { handle } = useBottomSheetContext();
|
|
7
|
+
const { handle, useSafeAreaInsets } = useBottomSheetContext();
|
|
8
8
|
styles.useVariants({
|
|
9
9
|
isModal,
|
|
10
10
|
handle,
|
|
11
|
+
useSafeAreaInsets,
|
|
11
12
|
});
|
|
12
13
|
return (_jsx(StyledBottomSheetScrollView, { style: [styles.container, style], contentContainerStyle: [styles.contentContainer, contentContainerStyle], ...props, children: children }));
|
|
13
14
|
};
|
|
@@ -23,7 +24,7 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
23
24
|
variants: {
|
|
24
25
|
isModal: {
|
|
25
26
|
true: {
|
|
26
|
-
paddingBottom: theme.components.bottomSheet.padding
|
|
27
|
+
paddingBottom: theme.components.bottomSheet.padding,
|
|
27
28
|
},
|
|
28
29
|
},
|
|
29
30
|
handle: {
|
|
@@ -31,7 +32,20 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
31
32
|
paddingTop: theme.components.bottomSheet.padding,
|
|
32
33
|
},
|
|
33
34
|
},
|
|
35
|
+
useSafeAreaInsets: {
|
|
36
|
+
true: {},
|
|
37
|
+
false: {},
|
|
38
|
+
},
|
|
34
39
|
},
|
|
40
|
+
compoundVariants: [
|
|
41
|
+
{
|
|
42
|
+
isModal: true,
|
|
43
|
+
useSafeAreaInsets: true,
|
|
44
|
+
styles: {
|
|
45
|
+
paddingBottom: theme.components.bottomSheet.padding + rt.insets.bottom,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
35
49
|
},
|
|
36
50
|
}));
|
|
37
51
|
BottomSheetScrollView.displayName = 'BottomSheetScrollView';
|
|
@@ -4,10 +4,11 @@ import { StyleSheet, withUnistyles } from 'react-native-unistyles';
|
|
|
4
4
|
import { useBottomSheetContext } from './BottomSheet.context';
|
|
5
5
|
const StyledBottomSheetView = withUnistyles(View);
|
|
6
6
|
const BottomSheetView = ({ children, style, isModal = true, ...props }) => {
|
|
7
|
-
const { handle } = useBottomSheetContext();
|
|
7
|
+
const { handle, useSafeAreaInsets } = useBottomSheetContext();
|
|
8
8
|
styles.useVariants({
|
|
9
9
|
isModal,
|
|
10
10
|
handle,
|
|
11
|
+
useSafeAreaInsets,
|
|
11
12
|
});
|
|
12
13
|
return (_jsx(StyledBottomSheetView, { style: [styles.contentContainer, style], ...props, children: children }));
|
|
13
14
|
};
|
|
@@ -21,7 +22,7 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
21
22
|
variants: {
|
|
22
23
|
isModal: {
|
|
23
24
|
true: {
|
|
24
|
-
paddingBottom: theme.components.bottomSheet.padding
|
|
25
|
+
paddingBottom: theme.components.bottomSheet.padding,
|
|
25
26
|
},
|
|
26
27
|
},
|
|
27
28
|
handle: {
|
|
@@ -29,7 +30,20 @@ const styles = StyleSheet.create((theme, rt) => ({
|
|
|
29
30
|
paddingTop: theme.components.bottomSheet.padding,
|
|
30
31
|
},
|
|
31
32
|
},
|
|
33
|
+
useSafeAreaInsets: {
|
|
34
|
+
true: {},
|
|
35
|
+
false: {},
|
|
36
|
+
},
|
|
32
37
|
},
|
|
38
|
+
compoundVariants: [
|
|
39
|
+
{
|
|
40
|
+
isModal: true,
|
|
41
|
+
useSafeAreaInsets: true,
|
|
42
|
+
styles: {
|
|
43
|
+
paddingBottom: theme.components.bottomSheet.padding + rt.insets.bottom,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
33
47
|
},
|
|
34
48
|
}));
|
|
35
49
|
BottomSheetView.displayName = 'BottomSheetView';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export { BottomSheetFlashList, BottomSheetFooter,
|
|
1
|
+
export { BottomSheetFlashList, BottomSheetFooter, BottomSheetSectionList, BottomSheetVirtualizedList, useBottomSheet, useBottomSheetModal, type BottomSheetBackdropProps, type BottomSheetBackgroundProps, type BottomSheetHandleProps, type BottomSheetModalProps, } from '@gorhom/bottom-sheet';
|
|
2
2
|
export { default as BottomSheet } from './BottomSheet';
|
|
3
3
|
export type { default as BottomSheetProps } from './BottomSheet.props';
|
|
4
4
|
export { default as BottomSheetFlatList } from './BottomSheetFlatList';
|
|
5
5
|
export { default as BottomSheetModal } from './BottomSheetModal';
|
|
6
|
+
export { default as BottomSheetModalProvider } from './BottomSheetModalProvider';
|
|
7
|
+
export type { BottomSheetModalProviderProps } from './BottomSheetModalProvider';
|
|
6
8
|
export { default as BottomSheetScrollView } from './BottomSheetScrollView';
|
|
7
9
|
export { default as BottomSheetView } from './BottomSheetView';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { BottomSheetFlashList, BottomSheetFooter,
|
|
1
|
+
export { BottomSheetFlashList, BottomSheetFooter, BottomSheetSectionList, BottomSheetVirtualizedList, useBottomSheet, useBottomSheetModal, } from '@gorhom/bottom-sheet';
|
|
2
2
|
export { default as BottomSheet } from './BottomSheet';
|
|
3
3
|
export { default as BottomSheetFlatList } from './BottomSheetFlatList';
|
|
4
4
|
export { default as BottomSheetModal } from './BottomSheetModal';
|
|
5
|
+
export { default as BottomSheetModalProvider } from './BottomSheetModalProvider';
|
|
5
6
|
export { default as BottomSheetScrollView } from './BottomSheetScrollView';
|
|
6
7
|
export { default as BottomSheetView } from './BottomSheetView';
|
|
@@ -7,6 +7,7 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
7
7
|
import { useTheme } from '../../hooks';
|
|
8
8
|
import { BodyText } from '../BodyText';
|
|
9
9
|
import { BottomSheetFlatList, BottomSheetModal, BottomSheetView } from '../BottomSheet';
|
|
10
|
+
import { useBottomSheetContext } from '../BottomSheet/BottomSheet.context';
|
|
10
11
|
import { DetailText } from '../DetailText';
|
|
11
12
|
import { FormField, useFormFieldContext } from '../FormField';
|
|
12
13
|
import { Icon } from '../Icon';
|
|
@@ -23,6 +24,7 @@ const Combobox = ({ options = [], value, onValueChange, inputValue, onInputValue
|
|
|
23
24
|
const isDisabled = formFieldContext?.disabled ?? disabled;
|
|
24
25
|
const isReadonly = formFieldContext?.readonly ?? readonly;
|
|
25
26
|
const { color } = useTheme();
|
|
27
|
+
const { useSafeAreaInsets } = useBottomSheetContext();
|
|
26
28
|
const bottomSheetModalRef = useRef(null);
|
|
27
29
|
const searchInputRef = useRef(null);
|
|
28
30
|
const focusTimeoutRef = useRef(null);
|
|
@@ -162,7 +164,7 @@ const Combobox = ({ options = [], value, onValueChange, inputValue, onInputValue
|
|
|
162
164
|
selectedValue: value,
|
|
163
165
|
selectOption,
|
|
164
166
|
setSearch,
|
|
165
|
-
}, children: [_jsxs(SafeAreaView, { edges: ['top'], children: [menuHeading && (_jsx(View, { style: styles.headingContainer, children: _jsx(DetailText, { size: "lg", children: menuHeading }) })), _jsx(View, { style: styles.searchContainer, children: _jsx(Input, { ref: searchInputRef, placeholder: searchPlaceholder, value: search, inBottomSheet: true, onChangeText: setSearch, type: "search", clearable: true, onClear: handleClear, loading: loading }) })] }), customContent || (_jsx(BottomSheetFlatList, { data: filteredOptions, keyExtractor: (option) => option.value, renderItem: renderSelectOption, ListEmptyComponent: renderEmptyComponent, ...listProps }))] }) })] }));
|
|
167
|
+
}, children: [_jsxs(SafeAreaView, { edges: useSafeAreaInsets ? ['top'] : [], children: [menuHeading && (_jsx(View, { style: styles.headingContainer, children: _jsx(DetailText, { size: "lg", children: menuHeading }) })), _jsx(View, { style: styles.searchContainer, children: _jsx(Input, { ref: searchInputRef, placeholder: searchPlaceholder, value: search, inBottomSheet: true, onChangeText: setSearch, type: "search", clearable: true, onClear: handleClear, loading: loading }) })] }), customContent || (_jsx(BottomSheetFlatList, { data: filteredOptions, keyExtractor: (option) => option.value, renderItem: renderSelectOption, ListEmptyComponent: renderEmptyComponent, ...listProps }))] }) })] }));
|
|
166
168
|
};
|
|
167
169
|
const styles = StyleSheet.create(theme => ({
|
|
168
170
|
container: {
|
|
@@ -4,7 +4,6 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { useTheme } from '../../hooks';
|
|
6
6
|
import { BodyText } from '../BodyText';
|
|
7
|
-
import { DetailText } from '../DetailText';
|
|
8
7
|
import Helper from '../Helper/Helper';
|
|
9
8
|
import { useDescriptionListContext } from './DescriptionList.context';
|
|
10
9
|
const DescriptionListItem = ({ heading, description, headingWidth, trailingContent, invalidText, numericValue, style, ...props }) => {
|
|
@@ -15,7 +14,7 @@ const DescriptionListItem = ({ heading, description, headingWidth, trailingConte
|
|
|
15
14
|
const descIsText = typeof description === 'string' || typeof description === 'number';
|
|
16
15
|
const combinedLabel = headingIsText && descIsText ? `${heading}: ${description}` : undefined;
|
|
17
16
|
const hideDescendants = !!combinedLabel;
|
|
18
|
-
return (_jsxs(View, { accessibilityRole: "text", accessible: !!combinedLabel, accessibilityLabel: combinedLabel, ...props, style: [styles.item, style], children: [_jsxs(View, { style: styles.textWrap, importantForAccessibility: hideDescendants ? 'no-hide-descendants' : undefined, accessibilityElementsHidden: hideDescendants || undefined, children: [_jsx(View, { style: [direction === 'row' && { width: headingWidth || itemHeadingWidth }], children: headingIsText ? _jsx(BodyText, { style: styles.headingText, children: heading }) : heading }), _jsxs(View, { style: styles.descriptionWrapper, children: [descIsText ? _jsx(BodyText, { children: description }) : description, !!invalidText && (_jsx(Helper, { validationStatus: "invalid", showIcon: true, icon: ErrorCircleSmallIcon, text: invalidText || '' }))] }), numericValue ? (_jsx(View, { style: styles.descriptionWrapper, children: _jsx(
|
|
17
|
+
return (_jsxs(View, { accessibilityRole: "text", accessible: !!combinedLabel, accessibilityLabel: combinedLabel, ...props, style: [styles.item, style], children: [_jsxs(View, { style: styles.textWrap, importantForAccessibility: hideDescendants ? 'no-hide-descendants' : undefined, accessibilityElementsHidden: hideDescendants || undefined, children: [_jsx(View, { style: [direction === 'row' && { width: headingWidth || itemHeadingWidth }], children: headingIsText ? _jsx(BodyText, { style: styles.headingText, children: heading }) : heading }), _jsxs(View, { style: styles.descriptionWrapper, children: [descIsText ? _jsx(BodyText, { children: description }) : description, !!invalidText && (_jsx(Helper, { validationStatus: "invalid", showIcon: true, icon: ErrorCircleSmallIcon, text: invalidText || '' }))] }), numericValue ? (_jsx(View, { style: styles.descriptionWrapper, children: _jsx(BodyText, { weight: "semibold", children: numericValue }) })) : null] }), trailingContent ? trailingContent : null] }));
|
|
19
18
|
};
|
|
20
19
|
DescriptionListItem.displayName = 'DescriptionListItem';
|
|
21
20
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { ChevronDownSmallIcon, ChevronUpSmallIcon, } from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
3
|
import { Pressable } from 'react-native';
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
-
import {
|
|
5
|
+
import { BodyText } from '../BodyText';
|
|
6
6
|
import ExpandableCardContent from './ExpandableCardContent';
|
|
7
7
|
import ExpandableCardHelperText from './ExpandableCardHelperText';
|
|
8
8
|
import ExpandableCardIcon from './ExpandableCardIcon';
|
|
@@ -26,7 +26,7 @@ const ExpandableCardTriggerRoot = ({ heading, helperText, leadingIcon, leadingCo
|
|
|
26
26
|
}
|
|
27
27
|
return null;
|
|
28
28
|
};
|
|
29
|
-
const renderDefaultContent = () => (_jsxs(_Fragment, { children: [renderLeadingContent(), _jsxs(ExpandableCardContent, { children: [badgePosition === 'top' ? badge : null, _jsx(ExpandableCardText, { children: heading }), helperText && _jsx(ExpandableCardHelperText, { children: helperText }), badgePosition === 'bottom' ? badge : null] }), numericValue && (_jsx(
|
|
29
|
+
const renderDefaultContent = () => (_jsxs(_Fragment, { children: [renderLeadingContent(), _jsxs(ExpandableCardContent, { children: [badgePosition === 'top' ? badge : null, _jsx(ExpandableCardText, { children: heading }), helperText && _jsx(ExpandableCardHelperText, { children: helperText }), badgePosition === 'bottom' ? badge : null] }), !!numericValue && (_jsx(BodyText, { weight: "semibold", style: styles.numericValue, children: numericValue })), _jsx(ExpandableCardTrailingContent, { style: styles.chevron, children: _jsx(ExpandableCardTrailingIcon, { as: isExpanded ? ChevronUpSmallIcon : ChevronDownSmallIcon }) })] }));
|
|
30
30
|
return (_jsx(Pressable, { ...props, testID: testID, style: [styles.container, props.style], disabled: disabled, accessibilityRole: "button", accessibilityState: { expanded: isExpanded, disabled }, accessibilityLabel: `${heading}${helperText ? `, ${helperText}` : ''}`, children: children || renderDefaultContent() }));
|
|
31
31
|
};
|
|
32
32
|
ExpandableCardTriggerRoot.displayName = 'ExpandableCardTriggerRoot';
|
|
@@ -12,7 +12,7 @@ const Heading = ({ children, color, size = 'lg', truncated, underline, strikeThr
|
|
|
12
12
|
strikeThrough,
|
|
13
13
|
inverted,
|
|
14
14
|
});
|
|
15
|
-
return (_jsx(Text, { ...remainingProps, ...(truncated
|
|
15
|
+
return (_jsx(Text, { accessibilityRole: "header", ...remainingProps, ...(truncated
|
|
16
16
|
? {
|
|
17
17
|
numberOfLines: 1,
|
|
18
18
|
ellipsizeMode: 'tail',
|
|
@@ -6,7 +6,7 @@ import { Card } from '../Card';
|
|
|
6
6
|
import { SectionHeader } from '../SectionHeader';
|
|
7
7
|
import { ListContext } from './List.context';
|
|
8
8
|
const List = ({ children, heading, helperText, headerTrailingContent, invalidText, ...props }) => {
|
|
9
|
-
const { loading, disabled, container = 'none', testID, style, ...rest } = props;
|
|
9
|
+
const { loading, disabled, container = 'none', testID, style, accessibilityRole, ...rest } = props;
|
|
10
10
|
const orderRef = useRef([]);
|
|
11
11
|
const [firstItemId, setFirstItemId] = useState(undefined);
|
|
12
12
|
const containerToCard = {
|
|
@@ -35,7 +35,7 @@ const List = ({ children, heading, helperText, headerTrailingContent, invalidTex
|
|
|
35
35
|
registerItem,
|
|
36
36
|
};
|
|
37
37
|
styles.useVariants({ disabled });
|
|
38
|
-
return (_jsx(ListContext.Provider, { value: value, children: _jsxs(View, { ...rest, style: [styles.container, style], children: [heading ? (_jsx(SectionHeader, { heading: heading, helperText: helperText, trailingContent: headerTrailingContent, invalidText: invalidText })) : null, container === 'none' ? (_jsx(View, { testID: testID, children: children })) : (React.Children.count(children) > 0 && (_jsx(Card, { ...containerToCard, noPadding: true, style: styles.card, testID: testID, children: _jsx(_Fragment, { children: children }) })))] }) }));
|
|
38
|
+
return (_jsx(ListContext.Provider, { value: value, children: _jsxs(View, { ...rest, accessibilityRole: accessibilityRole ?? 'list', style: [styles.container, style], children: [heading ? (_jsx(SectionHeader, { heading: heading, helperText: helperText, trailingContent: headerTrailingContent, invalidText: invalidText })) : null, container === 'none' ? (_jsx(View, { testID: testID, children: children })) : (React.Children.count(children) > 0 && (_jsx(Card, { ...containerToCard, noPadding: true, style: styles.card, testID: testID, children: _jsx(_Fragment, { children: children }) })))] }) }));
|
|
39
39
|
};
|
|
40
40
|
List.displayName = 'List';
|
|
41
41
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -43,7 +43,7 @@ const ListActionRoot = ({ heading, disabled, variant = 'subtle', loading, ...pro
|
|
|
43
43
|
isFirstChild,
|
|
44
44
|
container: listContext?.container,
|
|
45
45
|
});
|
|
46
|
-
return (_jsx(Pressable, { ...props, testID: testID, style: [styles.container, props.style], disabled: isDisabled || !onPress, children: loading ? (_jsxs(View, { style: styles.loadingWrap, children: [_jsx(Skeleton, { style: { flex: 1, maxWidth: 166 }, width: "auto", height: 24, borderRadius: "sm" }), _jsx(Skeleton, { width: 24, height: 24, borderRadius: "sm" })] })) : (_jsxs(_Fragment, { children: [_jsx(ListActionContent, { children: _jsx(ListActionText, { children: heading }) }), _jsx(ListActionTrailingContent, { style: styles.centeredTrailingIcon, children: _jsx(ListActionTrailingIcon, { as: ChevronRightSmallIcon }) })] })) }));
|
|
46
|
+
return (_jsx(Pressable, { ...props, accessibilityRole: props.accessibilityRole ?? 'button', testID: testID, style: [styles.container, props.style], disabled: isDisabled || !onPress, children: loading ? (_jsxs(View, { style: styles.loadingWrap, children: [_jsx(Skeleton, { style: { flex: 1, maxWidth: 166 }, width: "auto", height: 24, borderRadius: "sm" }), _jsx(Skeleton, { width: 24, height: 24, borderRadius: "sm" })] })) : (_jsxs(_Fragment, { children: [_jsx(ListActionContent, { children: _jsx(ListActionText, { children: heading }) }), _jsx(ListActionTrailingContent, { style: styles.centeredTrailingIcon, children: _jsx(ListActionTrailingIcon, { as: ChevronRightSmallIcon }) })] })) }));
|
|
47
47
|
};
|
|
48
48
|
const ListAction = createPressable({
|
|
49
49
|
Root: ListActionRoot,
|
|
@@ -3,7 +3,7 @@ import { ChevronRightSmallIcon } from '@utilitywarehouse/hearth-react-native-ico
|
|
|
3
3
|
import { useId, useLayoutEffect, useMemo } from 'react';
|
|
4
4
|
import { Pressable } from 'react-native';
|
|
5
5
|
import { StyleSheet } from 'react-native-unistyles';
|
|
6
|
-
import {
|
|
6
|
+
import { BodyText } from '../../BodyText';
|
|
7
7
|
import { Skeleton } from '../../Skeleton';
|
|
8
8
|
import { useListContext } from '../List.context';
|
|
9
9
|
import { ListItemContext } from './ListItem.context';
|
|
@@ -61,7 +61,7 @@ const ListItemRoot = ({ heading, helperText, leadingContent, trailingContent, di
|
|
|
61
61
|
if (loading || listContext?.loading) {
|
|
62
62
|
return (_jsxs(Pressable, { ...props, testID: loadingTestID, style: [styles.container, props.style], disabled: isDisabled, children: [leadingContent ? _jsx(Skeleton, { width: 24, height: 24 }) : null, _jsxs(ListItemContent, { children: [_jsx(Skeleton, { width: "80%", height: 20 }), _jsx(Skeleton, { width: "100%", height: 16 })] }), onPress || trailingContent ? _jsx(Skeleton, { width: 24, height: 24 }) : null] }));
|
|
63
63
|
}
|
|
64
|
-
return (_jsx(ListItemContext.Provider, { value: value, children: _jsx(Pressable, { ...props, testID: testID, style: [styles.container, props.style], disabled: isDisabled, accessibilityRole: onPress ? 'button' : undefined, children: children ? (children) : (_jsxs(_Fragment, { children: [leadingContent ? (_jsx(ListItemLeadingContent, { children: leadingContent })) : null, _jsxs(ListItemContent, { children: [badgePosition === 'top' && badge ? badge : null, _jsx(ListItemHeading, { truncated: truncateHeading, children: heading }), helperText ? (_jsx(ListItemHelperText, { truncated: truncateHelperText, children: helperText })) : null, badgePosition === 'bottom' && badge ? badge : null] }), !!numericValue && _jsx(
|
|
64
|
+
return (_jsx(ListItemContext.Provider, { value: value, children: _jsx(Pressable, { ...props, testID: testID, style: [styles.container, props.style], disabled: isDisabled, accessibilityRole: props.accessibilityRole ?? (onPress ? 'button' : undefined), children: children ? (children) : (_jsxs(_Fragment, { children: [leadingContent ? (_jsx(ListItemLeadingContent, { children: leadingContent })) : null, _jsxs(ListItemContent, { children: [badgePosition === 'top' && badge ? badge : null, _jsx(ListItemHeading, { truncated: truncateHeading, children: heading }), helperText ? (_jsx(ListItemHelperText, { truncated: truncateHelperText, children: helperText })) : null, badgePosition === 'bottom' && badge ? badge : null] }), !!numericValue && _jsx(BodyText, { weight: "semibold", children: numericValue }), trailingContent ? (_jsx(ListItemTrailingContent, { children: trailingContent })) : onPress ? (_jsx(ListItemTrailingContent, { style: styles.centeredTrailingIcon, children: _jsx(ListItemTrailingIcon, { as: ChevronRightSmallIcon }) })) : null] })) }) }));
|
|
65
65
|
};
|
|
66
66
|
ListItemRoot.displayName = 'ListItemRoot';
|
|
67
67
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -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, loadingHeading, fullscreen, image, primaryButtonProps, secondaryButtonProps, closeButtonProps, 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, loadingDescription, fullscreen, image, primaryButtonProps, secondaryButtonProps, closeButtonProps, stickyFooter, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default Modal;
|