@utilitywarehouse/hearth-react-native 0.16.2 → 0.18.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 +14 -14
- package/CHANGELOG.md +174 -0
- package/build/components/BodyText/BodyText.js +2 -2
- package/build/components/Card/CardAction/CardActionRoot.js +12 -2
- package/build/components/Card/CardActions.context.d.ts +6 -0
- package/build/components/Card/CardActions.context.js +5 -0
- package/build/components/Card/CardActions.d.ts +7 -0
- package/build/components/Card/CardActions.js +29 -0
- package/build/components/Card/CardRoot.js +16 -104
- package/build/components/Card/helpers.d.ts +8 -0
- package/build/components/Card/helpers.js +146 -0
- package/build/components/Card/index.d.ts +2 -0
- package/build/components/Card/index.js +2 -0
- package/build/components/ExpandableCard/ExpandableCardGroup.d.ts +1 -1
- package/build/components/ExpandableCard/ExpandableCardGroup.js +2 -2
- package/build/components/ExpandableCard/ExpandableCardGroup.props.d.ts +4 -0
- package/build/components/IconButton/IconButton.props.d.ts +19 -0
- package/build/components/IconButton/IconButtonRoot.d.ts +1 -1
- package/build/components/IconButton/IconButtonRoot.js +43 -2
- package/build/components/Input/Input.js +4 -3
- package/build/components/Input/Input.props.d.ts +9 -0
- package/build/components/List/List.context.d.ts +4 -2
- package/build/components/List/List.context.js +0 -2
- package/build/components/List/List.d.ts +1 -1
- package/build/components/List/List.js +25 -38
- package/build/components/List/List.props.d.ts +1 -0
- package/build/components/List/ListAction/ListAction.js +24 -7
- package/build/components/List/ListAction/ListAction.props.d.ts +1 -0
- package/build/components/List/ListItem/ListItemHelperText.d.ts +1 -1
- package/build/components/List/ListItem/ListItemHelperText.js +2 -2
- package/build/components/List/ListItem/ListItemRoot.js +12 -4
- package/build/utils/isThemedImageProps.d.ts +1 -1
- package/package.json +2 -2
- package/src/components/BodyText/BodyText.tsx +2 -2
- package/src/components/Card/Card.docs.mdx +224 -66
- package/src/components/Card/Card.stories.tsx +29 -25
- package/src/components/Card/CardAction/CardAction.stories.tsx +239 -93
- package/src/components/Card/CardAction/CardActionRoot.tsx +15 -2
- package/src/components/Card/CardActions.context.ts +12 -0
- package/src/components/Card/CardActions.tsx +40 -0
- package/src/components/Card/CardRoot.tsx +27 -132
- package/src/components/Card/helpers.tsx +195 -0
- package/src/components/Card/index.ts +2 -0
- package/src/components/ExpandableCard/ExpandableCard.figma.tsx +33 -38
- package/src/components/ExpandableCard/ExpandableCardGroup.figma.tsx +34 -17
- package/src/components/ExpandableCard/ExpandableCardGroup.props.ts +5 -0
- package/src/components/ExpandableCard/ExpandableCardGroup.tsx +2 -0
- package/src/components/HighlightBanner/HighlightBanner.figma.tsx +46 -0
- package/src/components/IconButton/IconButton.docs.mdx +91 -9
- package/src/components/IconButton/IconButton.figma.tsx +20 -30
- package/src/components/IconButton/IconButton.props.ts +19 -0
- package/src/components/IconButton/IconButton.stories.tsx +56 -0
- package/src/components/IconButton/IconButtonRoot.tsx +54 -1
- package/src/components/IconContainer/IconContainer.figma.tsx +7 -13
- package/src/components/IndicatorIconButton/IndicatorIconButton.figma.tsx +16 -0
- package/src/components/Input/Input.docs.mdx +55 -15
- package/src/components/Input/Input.figma.tsx +106 -40
- package/src/components/Input/Input.props.ts +9 -0
- package/src/components/Input/Input.tsx +21 -0
- package/src/components/Link/Link.figma.tsx +31 -38
- package/src/components/List/List.context.ts +2 -4
- package/src/components/List/List.docs.mdx +10 -5
- package/src/components/List/List.figma.tsx +42 -28
- package/src/components/List/List.props.ts +1 -0
- package/src/components/List/List.stories.tsx +43 -0
- package/src/components/List/List.tsx +38 -51
- package/src/components/List/ListAction/ListAction.figma.tsx +5 -13
- package/src/components/List/ListAction/ListAction.props.ts +1 -0
- package/src/components/List/ListAction/ListAction.tsx +40 -10
- package/src/components/List/ListItem/ListItem.figma.tsx +43 -27
- package/src/components/List/ListItem/ListItemHelperText.tsx +2 -2
- package/src/components/List/ListItem/ListItemRoot.tsx +15 -4
- package/src/utils/isThemedImageProps.ts +1 -1
- package/src/components/InlineLink/InlineLink.figma.tsx +0 -33
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createPressable } from '@gluestack-ui/pressable';
|
|
2
2
|
import { ChevronRightSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
|
-
import {
|
|
3
|
+
import { useId, useLayoutEffect } from 'react';
|
|
4
|
+
import { Pressable, View, ViewStyle } from 'react-native';
|
|
4
5
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
-
import {
|
|
6
|
+
import { Skeleton } from '../../Skeleton';
|
|
7
|
+
import { useListContext } from '../List.context';
|
|
6
8
|
import type ListActionProps from './ListAction.props';
|
|
7
9
|
import ListActionContent from './ListActionContent';
|
|
8
10
|
import ListActionText from './ListActionText';
|
|
@@ -13,11 +15,12 @@ const ListActionRoot = ({
|
|
|
13
15
|
heading,
|
|
14
16
|
disabled,
|
|
15
17
|
variant = 'subtle',
|
|
18
|
+
loading,
|
|
16
19
|
...props
|
|
17
20
|
}: ListActionProps & { states?: { active?: boolean; disabled?: boolean } }) => {
|
|
18
21
|
const { onPress } = props;
|
|
19
22
|
const listContext = useListContext();
|
|
20
|
-
const
|
|
23
|
+
const { registerItem, firstItemId } = listContext;
|
|
21
24
|
|
|
22
25
|
const { active } = props.states || { active: false };
|
|
23
26
|
|
|
@@ -33,6 +36,17 @@ const ListActionRoot = ({
|
|
|
33
36
|
|
|
34
37
|
const isDisabled = disabled || listContext?.disabled || false;
|
|
35
38
|
const listItemVariant = getListContainer() || variant;
|
|
39
|
+
const actionId = useId();
|
|
40
|
+
|
|
41
|
+
useLayoutEffect(() => {
|
|
42
|
+
if (!registerItem) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return registerItem(actionId);
|
|
47
|
+
}, [actionId, registerItem]);
|
|
48
|
+
|
|
49
|
+
const isFirstChild = firstItemId === actionId;
|
|
36
50
|
|
|
37
51
|
const testID = props.testID || 'list-action';
|
|
38
52
|
|
|
@@ -41,7 +55,7 @@ const ListActionRoot = ({
|
|
|
41
55
|
disabled: isDisabled,
|
|
42
56
|
active,
|
|
43
57
|
showDisabled: !listContext?.disabled && disabled,
|
|
44
|
-
isFirstChild
|
|
58
|
+
isFirstChild,
|
|
45
59
|
container: listContext?.container,
|
|
46
60
|
});
|
|
47
61
|
|
|
@@ -52,12 +66,21 @@ const ListActionRoot = ({
|
|
|
52
66
|
style={[styles.container, props.style as ViewStyle]}
|
|
53
67
|
disabled={isDisabled || !onPress}
|
|
54
68
|
>
|
|
55
|
-
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
{loading ? (
|
|
70
|
+
<View style={styles.loadingWrap}>
|
|
71
|
+
<Skeleton style={{ flex: 1, maxWidth: 166 }} width="auto" height={24} borderRadius="sm" />
|
|
72
|
+
<Skeleton width={24} height={24} borderRadius="sm" />
|
|
73
|
+
</View>
|
|
74
|
+
) : (
|
|
75
|
+
<>
|
|
76
|
+
<ListActionContent>
|
|
77
|
+
<ListActionText>{heading}</ListActionText>
|
|
78
|
+
</ListActionContent>
|
|
79
|
+
<ListActionTrailingContent style={styles.centeredTrailingIcon}>
|
|
80
|
+
<ListActionTrailingIcon as={ChevronRightSmallIcon} />
|
|
81
|
+
</ListActionTrailingContent>
|
|
82
|
+
</>
|
|
83
|
+
)}
|
|
61
84
|
</Pressable>
|
|
62
85
|
);
|
|
63
86
|
};
|
|
@@ -129,6 +152,13 @@ const styles = StyleSheet.create(theme => ({
|
|
|
129
152
|
centeredTrailingIcon: {
|
|
130
153
|
justifyContent: 'center',
|
|
131
154
|
},
|
|
155
|
+
loadingWrap: {
|
|
156
|
+
flexDirection: 'row',
|
|
157
|
+
justifyContent: 'space-between',
|
|
158
|
+
alignItems: 'center',
|
|
159
|
+
width: '100%',
|
|
160
|
+
gap: theme.space['200'],
|
|
161
|
+
},
|
|
132
162
|
}));
|
|
133
163
|
|
|
134
164
|
export default ListAction;
|
|
@@ -1,40 +1,56 @@
|
|
|
1
1
|
import figma from '@figma/code-connect';
|
|
2
|
-
import ListItem from '
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* -- This file was auto-generated by Code Connect --
|
|
6
|
-
* `props` includes a mapping from your code props to Figma properties.
|
|
7
|
-
* You should check this is correct, and update the `example` function
|
|
8
|
-
* to return the code example you'd like to see in Figma
|
|
9
|
-
*/
|
|
2
|
+
import { ListItem } from '../';
|
|
10
3
|
|
|
11
4
|
figma.connect(ListItem, 'https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=2421%3A1628', {
|
|
12
5
|
props: {
|
|
13
|
-
// These props were automatically mapped based on your linked code:
|
|
14
6
|
loading: figma.enum('State', {
|
|
15
7
|
Loading: true,
|
|
16
8
|
}),
|
|
17
9
|
disabled: figma.enum('State', {
|
|
18
10
|
Disabled: true,
|
|
19
11
|
}),
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
leadingContent: figma.boolean('Leading content?', {
|
|
13
|
+
true: figma.nestedProps('Leading content', {
|
|
14
|
+
variant: figma.enum('Variant', {
|
|
15
|
+
Icon: figma.instance('Icon-24'),
|
|
16
|
+
'Icon Container': figma.children('Icon Container'),
|
|
17
|
+
Avatar: figma.children('Avatar'),
|
|
18
|
+
Indicator: figma.children('Indicator'),
|
|
19
|
+
}),
|
|
20
|
+
}),
|
|
21
|
+
}),
|
|
22
|
+
trailingContent: figma.boolean('Trailing Content?', {
|
|
23
|
+
true: figma.nestedProps('Trailing content', {
|
|
24
|
+
variant: figma.enum('Variant', {
|
|
25
|
+
Icon: figma.instance('Icon-20'),
|
|
26
|
+
Link: figma.children('Link'),
|
|
27
|
+
Button: figma.children('Button'),
|
|
28
|
+
Switch: figma.children('Switch'),
|
|
29
|
+
Transaction: figma.children('Transaction'),
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
32
|
+
}),
|
|
33
|
+
heading: figma.string('List heading'),
|
|
34
|
+
helperText: figma.boolean('Helper text?', {
|
|
35
|
+
true: figma.string('Helper text'),
|
|
36
|
+
}),
|
|
37
|
+
badge: figma.boolean('Badge?', {
|
|
38
|
+
true: figma.children('Badge'),
|
|
39
|
+
}),
|
|
40
|
+
numericValue: figma.boolean('Numerical value?', {
|
|
41
|
+
true: figma.string('Numerical value'),
|
|
22
42
|
}),
|
|
23
|
-
// No matching props could be found for these Figma properties:
|
|
24
|
-
// "listHeading": figma.string('List heading'),
|
|
25
|
-
// "helperText": figma.boolean('Helper text?'),
|
|
26
|
-
// "helperText": figma.string('Helper text'),
|
|
27
|
-
// "customContent": figma.instance('Custom content'),
|
|
28
|
-
// "badge": figma.boolean('Badge?'),
|
|
29
|
-
// "leadingContent": figma.boolean('Leading content?'),
|
|
30
|
-
// "trailingContent": figma.boolean('Trailing Content?'),
|
|
31
|
-
// "numericalValue": figma.boolean('Numerical value?'),
|
|
32
|
-
// "numericalValue": figma.string('Numerical value'),
|
|
33
|
-
// "variant": figma.enum('Variant', {
|
|
34
|
-
// "Default": "default",
|
|
35
|
-
// "Custom": "custom"
|
|
36
|
-
// }),
|
|
37
|
-
// "paddingNone": figma.boolean('Padding None?')
|
|
38
43
|
},
|
|
39
|
-
example: props =>
|
|
44
|
+
example: props => (
|
|
45
|
+
<ListItem
|
|
46
|
+
heading={props.heading}
|
|
47
|
+
helperText={props.helperText}
|
|
48
|
+
badge={props.badge}
|
|
49
|
+
numericValue={props.numericValue}
|
|
50
|
+
loading={props.loading}
|
|
51
|
+
disabled={props.disabled}
|
|
52
|
+
leadingContent={props.leadingContent?.variant}
|
|
53
|
+
trailingContent={props.trailingContent?.variant}
|
|
54
|
+
/>
|
|
55
|
+
),
|
|
40
56
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
import { BodyText, BodyTextProps } from '../../BodyText';
|
|
3
3
|
|
|
4
|
-
const ListItemHelperText = ({ children, ...props }: BodyTextProps) => {
|
|
4
|
+
const ListItemHelperText = ({ children, style, ...props }: BodyTextProps) => {
|
|
5
5
|
return (
|
|
6
|
-
<BodyText size="md"
|
|
6
|
+
<BodyText size="md" style={[styles.text, style]} {...props}>
|
|
7
7
|
{children}
|
|
8
8
|
</BodyText>
|
|
9
9
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ChevronRightSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
2
|
-
import { useMemo } from 'react';
|
|
2
|
+
import { useId, useLayoutEffect, useMemo } from 'react';
|
|
3
3
|
import { Pressable, ViewStyle } from 'react-native';
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { DetailText } from '../../DetailText';
|
|
6
6
|
import { Skeleton } from '../../Skeleton';
|
|
7
|
-
import { useListContext
|
|
7
|
+
import { useListContext } from '../List.context';
|
|
8
8
|
import { IListItemContext, ListItemContext } from './ListItem.context';
|
|
9
9
|
import type ListItemProps from './ListItem.props';
|
|
10
10
|
import ListItemContent from './ListItemContent';
|
|
@@ -33,8 +33,19 @@ const ListItemRoot = ({
|
|
|
33
33
|
}: ListItemProps & { states?: { active?: boolean; disabled?: boolean } }) => {
|
|
34
34
|
const { onPress } = props;
|
|
35
35
|
const listContext = useListContext();
|
|
36
|
-
const
|
|
36
|
+
const { registerItem, firstItemId } = listContext;
|
|
37
37
|
const { active } = states || { active: false };
|
|
38
|
+
const itemId = useId();
|
|
39
|
+
|
|
40
|
+
useLayoutEffect(() => {
|
|
41
|
+
if (!registerItem) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return registerItem(itemId);
|
|
46
|
+
}, [itemId, registerItem]);
|
|
47
|
+
|
|
48
|
+
const isFirstChild = firstItemId === itemId;
|
|
38
49
|
|
|
39
50
|
const getListContainer = (): ListItemProps['variant'] => {
|
|
40
51
|
if (listContext?.container?.includes('subtle')) {
|
|
@@ -60,7 +71,7 @@ const ListItemRoot = ({
|
|
|
60
71
|
active,
|
|
61
72
|
disabled: isDisabled || isLoading,
|
|
62
73
|
showDisabled: !listContext.disabled && disabled,
|
|
63
|
-
isFirstChild
|
|
74
|
+
isFirstChild,
|
|
64
75
|
container: listContext?.container,
|
|
65
76
|
});
|
|
66
77
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ImageProps } from 'react-native';
|
|
2
|
-
import { ThemedImageProps } from '
|
|
2
|
+
import { ThemedImageProps } from '../components';
|
|
3
3
|
|
|
4
4
|
const isThemedImageProps = (props: ThemedImageProps | ImageProps): props is ThemedImageProps => {
|
|
5
5
|
return 'light' in props && 'dark' in props;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import InlineLink from "./InlineLink"
|
|
3
|
-
import figma from "@figma/code-connect"
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* -- This file was auto-generated by Code Connect --
|
|
7
|
-
* `props` includes a mapping from your code props to Figma properties.
|
|
8
|
-
* You should check this is correct, and update the `example` function
|
|
9
|
-
* to return the code example you'd like to see in Figma
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
figma.connect(
|
|
13
|
-
InlineLink,
|
|
14
|
-
"https://www.figma.com/design/6NKZXZhFSExXrcbBgc6zTR?node-id=7051%3A25641",
|
|
15
|
-
{
|
|
16
|
-
props: {
|
|
17
|
-
// These props were automatically mapped based on your linked code:
|
|
18
|
-
inverted: figma.boolean("Inverted?"),
|
|
19
|
-
disabled: figma.enum("State", {
|
|
20
|
-
Active: true,
|
|
21
|
-
}),
|
|
22
|
-
// No matching props could be found for these Figma properties:
|
|
23
|
-
// "iconLeft": figma.boolean('Icon left?'),
|
|
24
|
-
// "iconRight": figma.boolean('Icon right?'),
|
|
25
|
-
// "iconRight": figma.instance('Icon Right'),
|
|
26
|
-
// "iconLeft": figma.instance('Icon Left'),
|
|
27
|
-
// "text": figma.string('Text')
|
|
28
|
-
},
|
|
29
|
-
example: (props) => (
|
|
30
|
-
<InlineLink inverted={props.inverted} disabled={props.disabled} />
|
|
31
|
-
),
|
|
32
|
-
},
|
|
33
|
-
)
|