@utilitywarehouse/hearth-react-native 0.6.0 → 0.7.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/.storybook/main.ts +12 -6
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +6 -0
- package/build/components/BottomSheet/BottomSheetBackdrop.js +2 -2
- package/build/components/BottomSheet/BottomSheetFlatList.js +2 -2
- package/build/components/BottomSheet/BottomSheetHandle.js +2 -2
- package/build/components/Button/ButtonIcon.js +2 -1
- package/build/components/Button/ButtonRoot.js +2 -6
- package/build/components/Button/ButtonText.js +4 -1
- package/build/components/Card/Card.context.d.ts +7 -0
- package/build/components/Card/CardAction/CardAction.context.d.ts +9 -0
- package/build/components/Card/{CardAction.context.js → CardAction/CardAction.context.js} +7 -1
- package/build/components/Card/CardAction/CardAction.d.ts +18 -0
- package/build/components/Card/CardAction/CardAction.js +7 -0
- package/build/components/Card/CardAction/CardAction.props.d.ts +63 -0
- package/build/components/Card/CardAction/CardAction.props.js +1 -0
- package/build/components/Card/CardAction/CardActionContent.d.ts +6 -0
- package/build/components/Card/CardAction/CardActionContent.js +13 -0
- package/build/components/Card/CardAction/CardActionHelperText.d.ts +6 -0
- package/build/components/Card/CardAction/CardActionHelperText.js +13 -0
- package/build/components/Card/CardAction/CardActionIcon.d.ts +9 -0
- package/build/components/Card/CardAction/CardActionIcon.js +19 -0
- package/build/components/Card/CardAction/CardActionLeadingContent.d.ts +6 -0
- package/build/components/Card/CardAction/CardActionLeadingContent.js +5 -0
- package/build/components/Card/CardAction/CardActionRoot.d.ts +12 -0
- package/build/components/Card/CardAction/CardActionRoot.js +155 -0
- package/build/components/Card/CardAction/CardActionText.d.ts +6 -0
- package/build/components/Card/CardAction/CardActionText.js +9 -0
- package/build/components/Card/CardAction/CardActionTrailingContent.d.ts +6 -0
- package/build/components/Card/CardAction/CardActionTrailingContent.js +5 -0
- package/build/components/Card/CardAction/CardActionTrailingIcon.d.ts +9 -0
- package/build/components/Card/CardAction/CardActionTrailingIcon.js +19 -0
- package/build/components/Card/CardAction/index.d.ts +10 -0
- package/build/components/Card/CardAction/index.js +9 -0
- package/build/components/Card/CardContent.d.ts +6 -0
- package/build/components/Card/CardContent.js +33 -0
- package/build/components/Card/CardPressHandler.context.d.ts +6 -0
- package/build/components/Card/CardPressHandler.context.js +6 -0
- package/build/components/Card/{CardAction.d.ts → CardPressHandler.d.ts} +3 -3
- package/build/components/Card/CardPressHandler.js +13 -0
- package/build/components/Card/CardRoot.js +103 -11
- package/build/components/Card/index.d.ts +3 -2
- package/build/components/Card/index.js +3 -2
- package/build/components/Checkbox/CheckboxIcon.js +2 -1
- package/build/components/Container/Container.js +3 -3
- package/build/components/CurrencyInput/CurrencyInput.js +1 -1
- package/build/components/Helper/HelperIcon.js +2 -1
- package/build/components/Icon/Icon.d.ts +2 -6
- package/build/components/IconButton/IconButtonIcon.js +2 -1
- package/build/components/IconContainer/IconContainer.d.ts +4 -3
- package/build/components/IconContainer/IconContainer.js +3 -3
- package/build/components/Input/InputField.js +4 -2
- package/build/components/Input/InputIcon.js +2 -1
- package/build/components/Link/LinkIcon.js +3 -2
- package/build/components/List/ListAction/ListActionTrailingIcon.js +2 -1
- package/build/components/List/ListItem/ListItemIcon.js +2 -1
- package/build/components/List/ListItem/ListItemTrailingIcon.js +2 -3
- package/build/components/Radio/RadioIcon.js +7 -2
- package/build/components/RadioCard/RadioCardIcon.js +3 -2
- package/build/components/Spinner/Spinner.js +2 -0
- package/build/components/Spinner/Spinner.web.js +2 -0
- package/build/components/Switch/Switch.js +5 -3
- package/build/components/Switch/Switch.web.js +1 -0
- package/build/components/Tabs/TabsList.js +6 -1
- package/build/components/Textarea/TextareaField.js +1 -1
- package/build/components/ToggleButton/ToggleButtonIcon.js +2 -1
- package/build/components/ToggleButton/ToggleButtonRoot.js +2 -2
- package/build/components/UnstyledIconButton/UnstyledIconButtonIcon.js +2 -1
- package/build/components/index.d.ts +1 -1
- package/build/components/index.js +1 -1
- package/build/core/index.d.ts +3 -3
- package/build/core/index.js +3 -3
- package/build/core/themes.d.ts +24 -12
- package/build/hooks/useColorMode.d.ts +1 -1
- package/build/hooks/useColorMode.js +7 -8
- package/build/tokens/components/dark/banner.d.ts +19 -0
- package/build/tokens/components/dark/banner.js +19 -0
- package/build/tokens/components/dark/card-action.d.ts +11 -0
- package/build/tokens/components/dark/card-action.js +10 -0
- package/build/tokens/components/dark/card-content.d.ts +25 -0
- package/build/tokens/components/dark/card-content.js +24 -0
- package/build/tokens/components/dark/drawer.d.ts +29 -0
- package/build/tokens/components/dark/drawer.js +28 -0
- package/build/tokens/components/dark/illustrations.d.ts +0 -1
- package/build/tokens/components/dark/illustrations.js +0 -1
- package/build/tokens/components/dark/index.d.ts +3 -0
- package/build/tokens/components/dark/index.js +3 -0
- package/build/tokens/components/light/banner.d.ts +19 -0
- package/build/tokens/components/light/banner.js +19 -0
- package/build/tokens/components/light/card-action.d.ts +11 -0
- package/build/tokens/components/light/card-action.js +10 -0
- package/build/tokens/components/light/card-content.d.ts +25 -0
- package/build/tokens/components/light/card-content.js +24 -0
- package/build/tokens/components/light/drawer.d.ts +29 -0
- package/build/tokens/components/light/drawer.js +28 -0
- package/build/tokens/components/light/illustrations.d.ts +0 -1
- package/build/tokens/components/light/illustrations.js +0 -1
- package/build/tokens/components/light/index.d.ts +3 -0
- package/build/tokens/components/light/index.js +3 -0
- package/build/tokens/layout.d.ts +6 -6
- package/build/tokens/layout.js +3 -3
- package/build/tokens/typography.d.ts +6 -0
- package/build/tokens/typography.js +3 -0
- package/docs/components/NextPrevPage.tsx +5 -5
- package/docs/components/VariantTitle.tsx +17 -7
- package/package.json +16 -14
- package/src/components/BottomSheet/BottomSheetBackdrop.tsx +2 -2
- package/src/components/BottomSheet/BottomSheetFlatList.tsx +2 -3
- package/src/components/BottomSheet/BottomSheetHandle.tsx +1 -1
- package/src/components/Button/ButtonIcon.tsx +2 -1
- package/src/components/Button/ButtonRoot.tsx +2 -6
- package/src/components/Button/ButtonText.tsx +4 -1
- package/src/components/Card/Card.context.ts +7 -0
- package/src/components/Card/Card.docs.mdx +212 -14
- package/src/components/Card/Card.stories.tsx +50 -3
- package/src/components/Card/CardAction/CardAction.context.ts +22 -0
- package/src/components/Card/CardAction/CardAction.props.ts +87 -0
- package/src/components/Card/CardAction/CardAction.stories.tsx +265 -0
- package/src/components/Card/CardAction/CardAction.tsx +10 -0
- package/src/components/Card/CardAction/CardActionContent.tsx +20 -0
- package/src/components/Card/CardAction/CardActionHelperText.tsx +21 -0
- package/src/components/Card/CardAction/CardActionIcon.tsx +32 -0
- package/src/components/Card/CardAction/CardActionLeadingContent.tsx +9 -0
- package/src/components/Card/CardAction/CardActionRoot.tsx +258 -0
- package/src/components/Card/CardAction/CardActionText.tsx +17 -0
- package/src/components/Card/CardAction/CardActionTrailingContent.tsx +9 -0
- package/src/components/Card/CardAction/CardActionTrailingIcon.tsx +32 -0
- package/src/components/Card/CardAction/index.ts +10 -0
- package/src/components/Card/CardContent.tsx +40 -0
- package/src/components/Card/CardPressHandler.context.ts +12 -0
- package/src/components/Card/CardPressHandler.tsx +20 -0
- package/src/components/Card/CardRoot.tsx +128 -13
- package/src/components/Card/index.ts +3 -2
- package/src/components/Checkbox/CheckboxIcon.tsx +2 -1
- package/src/components/Container/Container.tsx +3 -3
- package/src/components/CurrencyInput/CurrencyInput.tsx +1 -1
- package/src/components/Helper/HelperIcon.tsx +2 -1
- package/src/components/Icon/Icon.tsx +4 -3
- package/src/components/IconButton/IconButtonIcon.tsx +2 -1
- package/src/components/IconContainer/IconContainer.tsx +17 -19
- package/src/components/Input/InputField.tsx +2 -1
- package/src/components/Input/InputIcon.tsx +2 -1
- package/src/components/Link/LinkIcon.tsx +3 -2
- package/src/components/List/ListAction/ListActionTrailingIcon.tsx +2 -1
- package/src/components/List/ListItem/ListItemIcon.tsx +2 -1
- package/src/components/List/ListItem/ListItemTrailingIcon.tsx +2 -3
- package/src/components/Radio/RadioIcon.tsx +8 -3
- package/src/components/RadioCard/RadioCardIcon.tsx +4 -3
- package/src/components/Spinner/Spinner.tsx +2 -0
- package/src/components/Spinner/Spinner.web.tsx +2 -0
- package/src/components/Switch/Switch.tsx +10 -5
- package/src/components/Switch/Switch.web.tsx +5 -0
- package/src/components/Tabs/TabsList.tsx +2 -0
- package/src/components/Textarea/TextareaField.tsx +1 -1
- package/src/components/ToggleButton/ToggleButtonIcon.tsx +2 -1
- package/src/components/ToggleButton/ToggleButtonRoot.tsx +2 -2
- package/src/components/UnstyledIconButton/UnstyledIconButtonIcon.tsx +2 -1
- package/src/components/index.ts +1 -9
- package/src/core/index.ts +14 -11
- package/src/hooks/useColorMode.ts +9 -12
- package/src/tokens/components/dark/banner.ts +19 -0
- package/src/tokens/components/dark/card-action.ts +11 -0
- package/src/tokens/components/dark/card-content.ts +25 -0
- package/src/tokens/components/dark/drawer.ts +29 -0
- package/src/tokens/components/dark/illustrations.ts +0 -1
- package/src/tokens/components/dark/index.ts +3 -0
- package/src/tokens/components/light/banner.ts +19 -0
- package/src/tokens/components/light/card-action.ts +11 -0
- package/src/tokens/components/light/card-content.ts +25 -0
- package/src/tokens/components/light/drawer.ts +29 -0
- package/src/tokens/components/light/illustrations.ts +0 -1
- package/src/tokens/components/light/index.ts +3 -0
- package/src/tokens/layout.ts +3 -3
- package/src/tokens/typography.ts +3 -0
- package/build/components/Card/CardAction.context.d.ts +0 -6
- package/build/components/Card/CardAction.js +0 -13
- package/src/components/Card/CardAction.context.ts +0 -12
- package/src/components/Card/CardAction.tsx +0 -18
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as CardAction } from './CardAction';
|
|
2
|
+
export { useCardActionContext } from './CardAction.context';
|
|
3
|
+
export type { default as CardActionProps } from './CardAction.props';
|
|
4
|
+
export { default as CardActionContent } from './CardActionContent';
|
|
5
|
+
export { default as CardActionHelperText } from './CardActionHelperText';
|
|
6
|
+
export { default as CardActionIcon } from './CardActionIcon';
|
|
7
|
+
export { default as CardActionLeadingContent } from './CardActionLeadingContent';
|
|
8
|
+
export { default as CardActionText } from './CardActionText';
|
|
9
|
+
export { default as CardActionTrailingContent } from './CardActionTrailingContent';
|
|
10
|
+
export { default as CardActionTrailingIcon } from './CardActionTrailingIcon';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as CardAction } from './CardAction';
|
|
2
|
+
export { useCardActionContext } from './CardAction.context';
|
|
3
|
+
export { default as CardActionContent } from './CardActionContent';
|
|
4
|
+
export { default as CardActionHelperText } from './CardActionHelperText';
|
|
5
|
+
export { default as CardActionIcon } from './CardActionIcon';
|
|
6
|
+
export { default as CardActionLeadingContent } from './CardActionLeadingContent';
|
|
7
|
+
export { default as CardActionText } from './CardActionText';
|
|
8
|
+
export { default as CardActionTrailingContent } from './CardActionTrailingContent';
|
|
9
|
+
export { default as CardActionTrailingIcon } from './CardActionTrailingIcon';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
+
import { useCardContext } from './Card.context';
|
|
5
|
+
const CardContent = ({ children, style, ...props }) => {
|
|
6
|
+
const { noPadding, space } = useCardContext();
|
|
7
|
+
styles.useVariants({
|
|
8
|
+
noPadding,
|
|
9
|
+
space,
|
|
10
|
+
});
|
|
11
|
+
return (_jsx(View, { style: [styles.container, style], ...props, children: children }));
|
|
12
|
+
};
|
|
13
|
+
CardContent.displayName = 'CardContent';
|
|
14
|
+
const styles = StyleSheet.create(theme => ({
|
|
15
|
+
container: {
|
|
16
|
+
variants: {
|
|
17
|
+
space: theme.globalStyle.variants.space,
|
|
18
|
+
noPadding: {
|
|
19
|
+
true: {
|
|
20
|
+
padding: theme.components.card.mobile.paddingNone,
|
|
21
|
+
},
|
|
22
|
+
false: {
|
|
23
|
+
padding: {
|
|
24
|
+
base: theme.components.card.mobile.padding,
|
|
25
|
+
md: theme.components.card.tablet.padding,
|
|
26
|
+
lg: theme.components.card.desktop.padding,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
export default CardContent;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
declare const
|
|
2
|
+
declare const CardPressHandler: {
|
|
3
3
|
({ children }: PropsWithChildren<{
|
|
4
|
-
|
|
4
|
+
handlerToInherit?: string;
|
|
5
5
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
displayName: string;
|
|
7
7
|
};
|
|
8
|
-
export default
|
|
8
|
+
export default CardPressHandler;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useCardContext } from './Card.context';
|
|
4
|
+
import { CardPressHandlerContext } from './CardPressHandler.context';
|
|
5
|
+
const CardPressHandler = ({ children }) => {
|
|
6
|
+
const { pressed } = useCardContext();
|
|
7
|
+
const context = useMemo(() => ({
|
|
8
|
+
pressed,
|
|
9
|
+
}), [pressed]);
|
|
10
|
+
return (_jsx(CardPressHandlerContext.Provider, { value: context, children: children }));
|
|
11
|
+
};
|
|
12
|
+
CardPressHandler.displayName = 'CardPressHandler';
|
|
13
|
+
export default CardPressHandler;
|
|
@@ -1,21 +1,80 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import { Pressable } from 'react-native';
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
5
|
import { useStyleProps } from '../../hooks';
|
|
6
6
|
import { CardContext } from './Card.context';
|
|
7
|
+
import CardContent from './CardContent';
|
|
8
|
+
// Helper to check if children contain specific component types
|
|
9
|
+
const checkForComponentType = (children, displayName) => {
|
|
10
|
+
return React.Children.toArray(children).some(child => {
|
|
11
|
+
if (React.isValidElement(child)) {
|
|
12
|
+
// @ts-expect-error - type
|
|
13
|
+
if (child.type.displayName === displayName) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
const childProps = child.props;
|
|
17
|
+
if (childProps.children) {
|
|
18
|
+
return checkForComponentType(childProps.children, displayName);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
// Helper to filter out specific component types from children
|
|
25
|
+
const filterChildren = (children, excludeDisplayName) => {
|
|
26
|
+
return React.Children.map(children, child => {
|
|
27
|
+
if (React.isValidElement(child)) {
|
|
28
|
+
// @ts-expect-error - type
|
|
29
|
+
if (child.type.displayName === excludeDisplayName) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const childProps = child.props;
|
|
33
|
+
if (childProps.children) {
|
|
34
|
+
return React.cloneElement(child, {
|
|
35
|
+
...childProps,
|
|
36
|
+
children: filterChildren(childProps.children, excludeDisplayName),
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return child;
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
// Helper to extract specific component types from children
|
|
44
|
+
const extractChildren = (children, includeDisplayName, markFirst = false) => {
|
|
45
|
+
let isFirstFound = false;
|
|
46
|
+
return React.Children.map(children, child => {
|
|
47
|
+
if (React.isValidElement(child)) {
|
|
48
|
+
// @ts-expect-error - type
|
|
49
|
+
if (child.type.displayName === includeDisplayName) {
|
|
50
|
+
const isFirst = markFirst && !isFirstFound;
|
|
51
|
+
if (isFirst) {
|
|
52
|
+
isFirstFound = true;
|
|
53
|
+
}
|
|
54
|
+
return markFirst
|
|
55
|
+
? React.cloneElement(child, { ...(child.props || {}), isFirst })
|
|
56
|
+
: child;
|
|
57
|
+
}
|
|
58
|
+
const childProps = child.props;
|
|
59
|
+
if (childProps.children) {
|
|
60
|
+
return extractChildren(childProps.children, includeDisplayName, markFirst);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
});
|
|
65
|
+
};
|
|
7
66
|
// Helper that recursively collects onPress or other defined handlers from descendants
|
|
8
67
|
const collectChildActionHandlers = (children) => React.Children.toArray(children).reduce((handlers, child) => {
|
|
9
68
|
if (React.isValidElement(child)) {
|
|
10
69
|
const childProps = child.props;
|
|
11
70
|
// @ts-expect-error - type
|
|
12
|
-
if (child.type.displayName === '
|
|
71
|
+
if (child.type.displayName === 'CardPressHandler') {
|
|
13
72
|
const actionChildren = React.Children.toArray(childProps.children);
|
|
14
|
-
const
|
|
73
|
+
const handlerToInherit = childProps['handlerToInherit'] || 'onPress';
|
|
15
74
|
const firstChild = actionChildren[0];
|
|
16
75
|
if (React.isValidElement(firstChild) &&
|
|
17
|
-
typeof firstChild.props[
|
|
18
|
-
handlers.push(firstChild.props[
|
|
76
|
+
typeof firstChild.props[handlerToInherit] === 'function') {
|
|
77
|
+
handlers.push(firstChild.props[handlerToInherit]);
|
|
19
78
|
}
|
|
20
79
|
}
|
|
21
80
|
if (childProps.children) {
|
|
@@ -27,6 +86,8 @@ const collectChildActionHandlers = (children) => React.Children.toArray(children
|
|
|
27
86
|
const Card = ({ children, variant = 'subtle', colorScheme = 'neutralStrong', noPadding = false, style, states, space, disabled = false, onPress, ...rest }) => {
|
|
28
87
|
const { active } = states || { active: false };
|
|
29
88
|
const childActionHandlers = collectChildActionHandlers(children);
|
|
89
|
+
const hasActions = checkForComponentType(children, 'CardAction');
|
|
90
|
+
const hasContent = checkForComponentType(children, 'CardContent');
|
|
30
91
|
// Extract style props using our custom hook
|
|
31
92
|
const { computedStyles, remainingProps } = useStyleProps(rest);
|
|
32
93
|
const handlePress = (e) => {
|
|
@@ -37,19 +98,50 @@ const Card = ({ children, variant = 'subtle', colorScheme = 'neutralStrong', noP
|
|
|
37
98
|
};
|
|
38
99
|
const inheritChildAction = childActionHandlers.length > 0;
|
|
39
100
|
const showPressed = inheritChildAction || !!onPress;
|
|
101
|
+
const filteredChildren = !hasContent && hasActions ? filterChildren(children, 'CardAction') : null;
|
|
102
|
+
// Check if there's any content besides CardActions
|
|
103
|
+
const hasOnlyActions = hasActions &&
|
|
104
|
+
!hasContent &&
|
|
105
|
+
React.Children.toArray(filteredChildren).filter(child => child != null).length === 0;
|
|
106
|
+
const filteredCardActions = !hasContent && hasActions
|
|
107
|
+
? extractChildren(children, 'CardAction', hasOnlyActions)
|
|
108
|
+
: null;
|
|
109
|
+
const context = useMemo(() => ({
|
|
110
|
+
pressed: showPressed && active,
|
|
111
|
+
noPadding,
|
|
112
|
+
hasActions,
|
|
113
|
+
hasContent,
|
|
114
|
+
hasOnlyActions,
|
|
115
|
+
space,
|
|
116
|
+
variant,
|
|
117
|
+
}), [showPressed, active, hasActions, hasContent, hasOnlyActions, noPadding, space, variant]);
|
|
40
118
|
styles.useVariants({
|
|
41
119
|
variant,
|
|
42
120
|
colorScheme,
|
|
43
|
-
noPadding,
|
|
121
|
+
noPadding: noPadding || hasActions || hasContent,
|
|
44
122
|
active,
|
|
45
123
|
showPressed,
|
|
46
124
|
disabled,
|
|
47
|
-
space,
|
|
125
|
+
space: hasActions || hasContent ? 'none' : space,
|
|
48
126
|
});
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
127
|
+
const renderChildren = () => {
|
|
128
|
+
// Default: render children as-is
|
|
129
|
+
if (hasContent || !hasActions) {
|
|
130
|
+
return children;
|
|
131
|
+
}
|
|
132
|
+
// Card has actions but no explicit CardContent
|
|
133
|
+
if (hasOnlyActions) {
|
|
134
|
+
// Only CardActions, no other content - render actions directly
|
|
135
|
+
return filteredCardActions;
|
|
136
|
+
}
|
|
137
|
+
if (filteredChildren) {
|
|
138
|
+
// Has both actions and other content - wrap content and render actions below
|
|
139
|
+
return (_jsxs(_Fragment, { children: [_jsx(CardContent, { children: filteredChildren }), filteredCardActions] }));
|
|
140
|
+
}
|
|
141
|
+
// Fallback
|
|
142
|
+
return children;
|
|
143
|
+
};
|
|
144
|
+
return (_jsx(CardContext.Provider, { value: context, children: _jsx(Pressable, { ...remainingProps, disabled: disabled, style: [styles.card, computedStyles, style], onPress: handlePress, accessible: showPressed, importantForAccessibility: showPressed ? 'yes' : 'no', children: renderChildren() }) }));
|
|
53
145
|
};
|
|
54
146
|
Card.displayName = 'Card';
|
|
55
147
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Card } from './Card';
|
|
2
2
|
export { useCardContext } from './Card.context';
|
|
3
|
-
export
|
|
4
|
-
export { default as
|
|
3
|
+
export * from './CardAction';
|
|
4
|
+
export { default as CardPressHandler } from './CardPressHandler';
|
|
5
|
+
export { useCardPressHandlerContext } from './CardPressHandler.context';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as Card } from './Card';
|
|
2
2
|
export { useCardContext } from './Card.context';
|
|
3
|
-
export
|
|
4
|
-
export { default as
|
|
3
|
+
export * from './CardAction';
|
|
4
|
+
export { default as CardPressHandler } from './CardPressHandler';
|
|
5
|
+
export { useCardPressHandlerContext } from './CardPressHandler.context';
|
|
@@ -5,7 +5,8 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
5
5
|
import { Icon } from '../Icon';
|
|
6
6
|
const CheckboxIcon = ({ style, ...props }) => {
|
|
7
7
|
return (_jsx(Icon, { as: TickSmallIcon, ...props, style: Platform.OS === 'web'
|
|
8
|
-
?
|
|
8
|
+
? // @ts-expect-error - style prop type issue
|
|
9
|
+
{ ...styles.icon, ...props.style }
|
|
9
10
|
: [styles.icon, style] }));
|
|
10
11
|
};
|
|
11
12
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -26,9 +26,9 @@ const styles = StyleSheet.create(theme => ({
|
|
|
26
26
|
: undefined,
|
|
27
27
|
marginHorizontal: typeof extra.margin === 'undefined' && typeof extra.marginHorizontal === 'undefined'
|
|
28
28
|
? {
|
|
29
|
-
base: theme.layout.mobile.container.
|
|
30
|
-
md: theme.layout.tablet.container.
|
|
31
|
-
lg: theme.layout.desktop.container.
|
|
29
|
+
base: theme.layout.mobile.container.marginHorizontal,
|
|
30
|
+
md: theme.layout.tablet.container.marginHorizontal,
|
|
31
|
+
lg: theme.layout.desktop.container.marginHorizontal,
|
|
32
32
|
}
|
|
33
33
|
: undefined,
|
|
34
34
|
...extra,
|
|
@@ -38,7 +38,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
38
38
|
input: {
|
|
39
39
|
fontSize: theme.typography.mobile.detailText['4xl'].fontSize,
|
|
40
40
|
fontFamily: theme.typography.mobile.detailText.fontFamily,
|
|
41
|
-
fontWeight: theme.typography.mobile.detailText.fontWeight
|
|
41
|
+
fontWeight: `${theme.typography.mobile.detailText.fontWeight}`,
|
|
42
42
|
paddingTop: 0,
|
|
43
43
|
paddingBottom: 0,
|
|
44
44
|
paddingLeft: 0,
|
|
@@ -7,7 +7,8 @@ const HelperIcon = (props) => {
|
|
|
7
7
|
const { validationStatus } = useHelperContext();
|
|
8
8
|
styles.useVariants({ validationStatus });
|
|
9
9
|
return (_jsx(Icon, { style: Platform.OS === 'web'
|
|
10
|
-
?
|
|
10
|
+
? // @ts-expect-error - style prop type issue
|
|
11
|
+
{ ...styles.icon, ...props.style }
|
|
11
12
|
: [styles.icon, props.style], ...props }));
|
|
12
13
|
};
|
|
13
14
|
HelperIcon.displayName = 'HelperIcon';
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
+
import type React from 'react';
|
|
1
2
|
import type IconProps from './Icon.props';
|
|
2
|
-
export declare const Icon:
|
|
3
|
-
uniProps?: import("react-native-unistyles/lib/typescript/src/core/withUnistyles/types").Mappings<IconProps> | undefined;
|
|
4
|
-
} & import("react").RefAttributes<never>) | {
|
|
5
|
-
fill?: import("react-native").ColorValue | undefined;
|
|
6
|
-
stroke?: import("react-native").ColorValue | undefined;
|
|
7
|
-
}>;
|
|
3
|
+
export declare const Icon: React.ForwardRefExoticComponent<IconProps>;
|
|
8
4
|
export default Icon;
|
|
@@ -13,7 +13,8 @@ const IconButtonIcon = (props) => {
|
|
|
13
13
|
size,
|
|
14
14
|
});
|
|
15
15
|
return (_jsx(Icon, { ...props, style: Platform.OS === 'web'
|
|
16
|
-
?
|
|
16
|
+
? // @ts-expect-error - style prop type issue
|
|
17
|
+
{ ...styles.icon, ...props.style }
|
|
17
18
|
: [styles.icon, props.style], children: props.children }));
|
|
18
19
|
};
|
|
19
20
|
IconButtonIcon.displayName = 'IconButtonIcon';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type IconContainerProps from './IconContainer.props';
|
|
2
|
-
declare const IconContainer:
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
declare const IconContainer: {
|
|
3
|
+
({ icon: IconComp, size, radiusNone, variant, color, style, ...props }: IconContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
5
6
|
export default IconContainer;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { StyleSheet
|
|
3
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
4
|
import { Icon } from '../Icon';
|
|
5
|
-
const IconContainer =
|
|
5
|
+
const IconContainer = ({ icon: IconComp, size = 'md', radiusNone = false, variant = 'subtle', color = 'pig', style, ...props }) => {
|
|
6
6
|
styles.useVariants({ size, radiusNone, variant, color });
|
|
7
7
|
return (_jsx(View, { style: [styles.container, style], ...props, children: IconComp ? _jsx(Icon, { as: IconComp, style: styles.icon }) : null }));
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
IconContainer.displayName = 'IconContainer';
|
|
10
10
|
const styles = StyleSheet.create(theme => ({
|
|
11
11
|
container: {
|
|
@@ -9,7 +9,9 @@ const InputField = ({ style, inBottomSheet = false, ...props }) => {
|
|
|
9
9
|
styles.useVariants({ focused, type });
|
|
10
10
|
const { color } = useTheme();
|
|
11
11
|
if (inBottomSheet) {
|
|
12
|
-
return (
|
|
12
|
+
return (
|
|
13
|
+
// @ts-expect-error - BottomSheetTextInput type issue
|
|
14
|
+
_jsx(BottomSheetTextInput, { placeholderTextColor: color.text.secondary, selectionColor: color.purple[700], cursorColor: color.purple[700], verticalAlign: "middle", "aria-disabled": disabled, ...props, style: [styles.input, style] }));
|
|
13
15
|
}
|
|
14
16
|
return (_jsx(RNTextInput, { placeholderTextColor: color.text.secondary, selectionColor: color.purple[700], cursorColor: color.purple[700], verticalAlign: "middle", "aria-disabled": disabled, ...props, style: [styles.input, style] }));
|
|
15
17
|
};
|
|
@@ -24,7 +26,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
24
26
|
color: theme.color.text.primary,
|
|
25
27
|
fontSize: theme.typography.mobile.bodyText.md.fontSize,
|
|
26
28
|
fontFamily: theme.typography.mobile.bodyText.fontFamily,
|
|
27
|
-
fontWeight: theme.typography.mobile.bodyText.fontWeight
|
|
29
|
+
fontWeight: `${theme.typography.mobile.bodyText.fontWeight}`,
|
|
28
30
|
borderWidth: 0,
|
|
29
31
|
variants: {
|
|
30
32
|
focused: {
|
|
@@ -4,7 +4,8 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
4
4
|
import { Icon } from '../Icon';
|
|
5
5
|
const InputIcon = ({ children, ...props }) => {
|
|
6
6
|
return (_jsx(Icon, { ...props, style: Platform.OS === 'web'
|
|
7
|
-
?
|
|
7
|
+
? // @ts-expect-error - style prop type issue
|
|
8
|
+
{ ...styles.icon, ...props.style }
|
|
8
9
|
: [styles.icon, props.style], children: children }));
|
|
9
10
|
};
|
|
10
11
|
InputIcon.displayName = 'InputIcon';
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
|
-
import { useLinkContext } from './Link.context';
|
|
4
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
4
|
import { Icon } from '../Icon';
|
|
5
|
+
import { useLinkContext } from './Link.context';
|
|
6
6
|
const LinkIcon = ({ children, ...props }) => {
|
|
7
7
|
const { active, inverted, disabled } = useLinkContext();
|
|
8
8
|
styles.useVariants({ active, inverted, disabled });
|
|
9
9
|
return (_jsx(Icon, { ...props, style: Platform.OS === 'web'
|
|
10
|
-
?
|
|
10
|
+
? // @ts-expect-error - style prop type issue
|
|
11
|
+
{ ...styles.icon, ...props.style }
|
|
11
12
|
: [styles.icon, props.style], children: children }));
|
|
12
13
|
};
|
|
13
14
|
LinkIcon.displayName = 'LinkIcon';
|
|
@@ -4,7 +4,8 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
4
4
|
import { Icon } from '../../Icon';
|
|
5
5
|
const ListActionTrailingIcon = ({ children, ...props }) => {
|
|
6
6
|
return (_jsx(Icon, { ...props, style: Platform.OS === 'web'
|
|
7
|
-
?
|
|
7
|
+
? // @ts-expect-error - style prop type issue
|
|
8
|
+
{ ...styles.icon, ...props.style }
|
|
8
9
|
: [styles.icon, props.style], children: children }));
|
|
9
10
|
};
|
|
10
11
|
ListActionTrailingIcon.displayName = 'ListActionTrailingIcon';
|
|
@@ -4,7 +4,8 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
4
4
|
import { Icon } from '../../Icon';
|
|
5
5
|
const ListItemIcon = ({ children, ...props }) => {
|
|
6
6
|
return (_jsx(Icon, { ...props, style: Platform.OS === 'web'
|
|
7
|
-
?
|
|
7
|
+
? // @ts-expect-error - style prop type issue
|
|
8
|
+
{ ...styles.icon, ...props.style }
|
|
8
9
|
: [styles.icon, props.style], children: children }));
|
|
9
10
|
};
|
|
10
11
|
ListItemIcon.displayName = 'ListItemIcon';
|
|
@@ -4,15 +4,14 @@ import { StyleSheet } from 'react-native-unistyles';
|
|
|
4
4
|
import { Icon } from '../../Icon';
|
|
5
5
|
const ListItemTrailingIcon = ({ children, ...props }) => {
|
|
6
6
|
return (_jsx(Icon, { ...props, style: Platform.OS === 'web'
|
|
7
|
-
?
|
|
7
|
+
? // @ts-expect-error - style prop type issue
|
|
8
|
+
{ ...styles.icon, ...props.style }
|
|
8
9
|
: [styles.icon, props.style], children: children }));
|
|
9
10
|
};
|
|
10
11
|
ListItemTrailingIcon.displayName = 'ListItemTrailingIcon';
|
|
11
12
|
const styles = StyleSheet.create(theme => ({
|
|
12
13
|
icon: {
|
|
13
14
|
color: theme.color.icon.primary,
|
|
14
|
-
width: 24,
|
|
15
|
-
height: 24,
|
|
16
15
|
},
|
|
17
16
|
}));
|
|
18
17
|
export default ListItemTrailingIcon;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Platform } from 'react-native';
|
|
2
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
4
|
import { Icon } from '../Icon';
|
|
4
5
|
import { CircleIcon } from '../Icons';
|
|
5
|
-
import { Platform } from 'react-native';
|
|
6
6
|
const RadioIcon = ({ style, ...props }) => {
|
|
7
7
|
return (_jsx(Icon, { as: CircleIcon, ...props, style: Platform.OS === 'web'
|
|
8
|
-
?
|
|
8
|
+
? {
|
|
9
|
+
// @ts-expect-error - style prop type issue
|
|
10
|
+
...styles.container,
|
|
11
|
+
// @ts-expect-error - style prop type issue
|
|
12
|
+
...props.style,
|
|
13
|
+
}
|
|
9
14
|
: [styles.container, style] }));
|
|
10
15
|
};
|
|
11
16
|
RadioIcon.displayName = 'RadioIcon';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Platform } from 'react-native';
|
|
2
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
4
|
import { Icon } from '../Icon';
|
|
4
5
|
import { CircleIcon } from '../Icons';
|
|
5
|
-
import { Platform } from 'react-native';
|
|
6
6
|
const RadioCardIcon = ({ style, ...props }) => {
|
|
7
7
|
return (_jsx(Icon, { as: CircleIcon, ...props, style: Platform.OS === 'web'
|
|
8
|
-
?
|
|
8
|
+
? // @ts-expect-error - style prop type issue
|
|
9
|
+
{ ...styles.container, ...props.style }
|
|
9
10
|
: [styles.container, style] }));
|
|
10
11
|
};
|
|
11
12
|
RadioCardIcon.displayName = 'RadioCardIcon';
|
|
@@ -7,7 +7,9 @@ import { Circle, G, Svg } from 'react-native-svg';
|
|
|
7
7
|
import { StyleSheet } from 'react-native-unistyles';
|
|
8
8
|
import { useTheme } from '../../hooks';
|
|
9
9
|
import { getFlattenedColorValue } from '../../utils';
|
|
10
|
+
// @ts-expect-error - Animated.View type issue
|
|
10
11
|
const AnimatedSvg = Animated.createAnimatedComponent(Svg);
|
|
12
|
+
// @ts-expect-error - Animated.View type issue
|
|
11
13
|
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
12
14
|
const SpinnerRoot = ({ size = 'md', color, ...props }) => {
|
|
13
15
|
const { components } = useTheme();
|
|
@@ -8,7 +8,9 @@ import { Circle, G, Svg } from 'react-native-svg';
|
|
|
8
8
|
import { StyleSheet } from 'react-native-unistyles';
|
|
9
9
|
import { useTheme } from '../../hooks';
|
|
10
10
|
import { getFlattenedColorValue } from '../../utils';
|
|
11
|
+
// @ts-expect-error - Animated.View type issue
|
|
11
12
|
const AnimatedSvg = Animated.createAnimatedComponent(Svg);
|
|
13
|
+
// @ts-expect-error - Animated.View type issue
|
|
12
14
|
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
13
15
|
const SpinnerRoot = ({ size = 'md', color, ...props }) => {
|
|
14
16
|
const { components } = useTheme();
|
|
@@ -4,10 +4,12 @@ import { useEffect } from 'react';
|
|
|
4
4
|
import { Pressable } from 'react-native';
|
|
5
5
|
import Animated, { Easing, interpolateColor, useAnimatedStyle, useReducedMotion, useSharedValue, withSpring, withTiming, } from 'react-native-reanimated';
|
|
6
6
|
import { StyleSheet } from 'react-native-unistyles';
|
|
7
|
+
import { useAnimatedTheme } from 'react-native-unistyles/reanimated';
|
|
7
8
|
import { useTheme } from '../../hooks';
|
|
8
9
|
import { Icon } from '../Icon';
|
|
9
10
|
const CustomSwitch = ({ value = false, onValueChange, disabled = false, size = 'medium', ...accessibilityProps }) => {
|
|
10
11
|
const { components, color } = useTheme();
|
|
12
|
+
const theme = useAnimatedTheme();
|
|
11
13
|
const SWITCH_WIDTH = size === 'medium' ? components.switch.md.width : components.switch.sm.width;
|
|
12
14
|
const THUMB_SIZE = size === 'medium' ? components.switch.md.circle.size : components.switch.sm.circle.size;
|
|
13
15
|
const PADDING = components.switch.padding;
|
|
@@ -17,11 +19,11 @@ const CustomSwitch = ({ value = false, onValueChange, disabled = false, size = '
|
|
|
17
19
|
const progress = useSharedValue(value ? 1 : 0);
|
|
18
20
|
const animatedThumbStyle = useAnimatedStyle(() => ({
|
|
19
21
|
transform: [{ translateX: offset.value }],
|
|
20
|
-
}));
|
|
22
|
+
}), [offset]);
|
|
21
23
|
const animatedSwitchBackgroundStyle = useAnimatedStyle(() => {
|
|
22
24
|
const backgroundColor = interpolateColor(progress.value, [0, 1], [
|
|
23
|
-
color.interactive.functional.surface.strong.default,
|
|
24
|
-
color.interactive.brand.surface.strong.default,
|
|
25
|
+
theme.value.color.interactive.functional.surface.strong.default,
|
|
26
|
+
theme.value.color.interactive.brand.surface.strong.default,
|
|
25
27
|
]);
|
|
26
28
|
return { backgroundColor };
|
|
27
29
|
});
|
|
@@ -6,6 +6,7 @@ import Animated, { Easing, interpolateColor, useAnimatedStyle, useReducedMotion,
|
|
|
6
6
|
import { StyleSheet } from 'react-native-unistyles';
|
|
7
7
|
import { useTheme } from '../../hooks';
|
|
8
8
|
import { Icon } from '../Icon';
|
|
9
|
+
// @ts-expect-error - Animated.View type issue
|
|
9
10
|
const AnimatedView = Animated.createAnimatedComponent(View);
|
|
10
11
|
const CustomSwitch = ({ value = false, onValueChange, disabled = false, size = 'medium', ...accessibilityProps }) => {
|
|
11
12
|
const { components, color } = useTheme();
|
|
@@ -6,6 +6,7 @@ import Animated, { runOnJS, useAnimatedScrollHandler, useAnimatedStyle, useShare
|
|
|
6
6
|
import { StyleSheet } from 'react-native-unistyles';
|
|
7
7
|
import { UnstyledIconButton } from '../UnstyledIconButton';
|
|
8
8
|
import { useTabsContext } from './Tabs.context';
|
|
9
|
+
// @ts-expect-error - Animated.View type issue
|
|
9
10
|
const Indicator = Animated.createAnimatedComponent(View);
|
|
10
11
|
const SCROLL_STEP_RATIO = 0.6;
|
|
11
12
|
const SCROLL_BUTTON_HITSLOP = { top: 10, bottom: 10, left: 10, right: 10 };
|
|
@@ -59,7 +60,11 @@ const TabsList = ({ children, style, ...rest }) => {
|
|
|
59
60
|
}
|
|
60
61
|
return;
|
|
61
62
|
}, [updateScrollState]);
|
|
62
|
-
return (_jsxs(View, { style: [styles.wrapper, style], ...rest, accessibilityRole: "tablist", children: [canScrollLeft && (_jsx(View, { style: [styles.iconButtonWrap, styles.scrollButtonLeft], accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", ...(Platform.OS === 'web' ? { 'aria-hidden': true } : {}), children: _jsx(UnstyledIconButton, { accessibilityLabel: undefined, icon: ChevronLeftSmallIcon, onPress: () => scrollBy(-1), style: styles.iconButton, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", hitSlop: SCROLL_BUTTON_HITSLOP, ...(Platform.OS === 'web' ? { 'aria-hidden': true, tabIndex: -1 } : {}) }) })), _jsx(Animated.ScrollView, { ref: scrollRef, horizontal: true, showsHorizontalScrollIndicator: false, onLayout: onLayoutContainer, onContentSizeChange: onContentSizeChange, onScroll: onScrollHandler, scrollEventThrottle: 16, bounces: false, contentContainerStyle: styles.scrollContent, children: _jsxs(View, { style: styles.container, children: [children, _jsx(Indicator
|
|
63
|
+
return (_jsxs(View, { style: [styles.wrapper, style], ...rest, accessibilityRole: "tablist", children: [canScrollLeft && (_jsx(View, { style: [styles.iconButtonWrap, styles.scrollButtonLeft], accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", ...(Platform.OS === 'web' ? { 'aria-hidden': true } : {}), children: _jsx(UnstyledIconButton, { accessibilityLabel: undefined, icon: ChevronLeftSmallIcon, onPress: () => scrollBy(-1), style: styles.iconButton, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", hitSlop: SCROLL_BUTTON_HITSLOP, ...(Platform.OS === 'web' ? { 'aria-hidden': true, tabIndex: -1 } : {}) }) })), _jsx(Animated.ScrollView, { ref: scrollRef, horizontal: true, showsHorizontalScrollIndicator: false, onLayout: onLayoutContainer, onContentSizeChange: onContentSizeChange, onScroll: onScrollHandler, scrollEventThrottle: 16, bounces: false, contentContainerStyle: styles.scrollContent, children: _jsxs(View, { style: styles.container, children: [children, _jsx(Indicator
|
|
64
|
+
// @ts-expect-error - Animated.View type issue
|
|
65
|
+
, {
|
|
66
|
+
// @ts-expect-error - Animated.View type issue
|
|
67
|
+
accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.indicator, indicatorStyle] })] }) }), canScrollRight && (_jsx(View, { style: [styles.iconButtonWrap, styles.scrollButtonRight], accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", ...(Platform.OS === 'web' ? { 'aria-hidden': true } : {}), children: _jsx(UnstyledIconButton, { accessibilityLabel: undefined, icon: ChevronRightSmallIcon, onPress: () => scrollBy(1), style: styles.iconButton, accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", hitSlop: SCROLL_BUTTON_HITSLOP, ...(Platform.OS === 'web' ? { 'aria-hidden': true, tabIndex: -1 } : {}) }) }))] }));
|
|
63
68
|
};
|
|
64
69
|
TabsList.displayName = 'TabsList';
|
|
65
70
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -20,7 +20,7 @@ const styles = StyleSheet.create(theme => ({
|
|
|
20
20
|
color: theme.color.text.primary,
|
|
21
21
|
fontSize: theme.typography.mobile.bodyText.md.fontSize,
|
|
22
22
|
fontFamily: theme.typography.mobile.bodyText.fontFamily,
|
|
23
|
-
fontWeight: theme.typography.mobile.bodyText.fontWeight
|
|
23
|
+
fontWeight: `${theme.typography.mobile.bodyText.fontWeight}`,
|
|
24
24
|
borderWidth: 0,
|
|
25
25
|
outlineWidth: 0,
|
|
26
26
|
_web: {
|
|
@@ -7,7 +7,8 @@ const ButtonIcon = ({ children, toggled, as = TickSmallIcon, ...props }) => {
|
|
|
7
7
|
styles.useVariants({ toggled });
|
|
8
8
|
const IconAny = Icon;
|
|
9
9
|
return (_jsx(IconAny, { as: as, ...props, style: Platform.OS === 'web'
|
|
10
|
-
?
|
|
10
|
+
? // @ts-ignore
|
|
11
|
+
{ ...styles.icon, ...props.style }
|
|
11
12
|
: [styles.icon, props.style], children: children }));
|
|
12
13
|
};
|
|
13
14
|
ButtonIcon.displayName = 'ButtonIcon';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Pressable } from 'react-native';
|
|
3
3
|
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
-
import {
|
|
4
|
+
import { useCardPressHandlerContext } from '../Card';
|
|
5
5
|
const ButtonRoot = ({ children, onToggle, toggled, states, onPress, ...props }) => {
|
|
6
6
|
const { active } = states || {};
|
|
7
|
-
const { pressed } =
|
|
7
|
+
const { pressed } = useCardPressHandlerContext();
|
|
8
8
|
styles.useVariants({
|
|
9
9
|
toggled,
|
|
10
10
|
active: active || pressed,
|