@utilitywarehouse/hearth-react-native 0.5.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 +33 -7
- package/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +14 -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.d.ts +6 -0
- package/build/components/Container/Container.js +40 -0
- package/build/components/Container/Container.props.d.ts +85 -0
- package/build/components/Container/Container.props.js +1 -0
- package/build/components/Container/index.d.ts +2 -0
- package/build/components/Container/index.js +1 -0
- 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/ProgressStepper/ProgressStep.d.ts +1 -1
- package/build/components/ProgressStepper/ProgressStep.js +6 -6
- package/build/components/ProgressStepper/ProgressStepper.props.d.ts +3 -3
- package/build/components/ProgressStepper/index.d.ts +1 -1
- 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/ThemedImage/ThemedImage.d.ts +12 -0
- package/build/components/ThemedImage/ThemedImage.js +27 -0
- package/build/components/ThemedImage/ThemedImage.props.d.ts +13 -0
- package/build/components/ThemedImage/ThemedImage.props.js +1 -0
- package/build/components/ThemedImage/index.d.ts +2 -0
- package/build/components/ThemedImage/index.js +1 -0
- 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 +3 -1
- package/build/components/index.js +3 -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/hooks/useStyleProps.js +1 -1
- 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/AllComponents.web.tsx +38 -3
- package/docs/components/NextPrevPage.tsx +5 -5
- package/docs/components/VariantTitle.tsx +17 -7
- package/docs/layout-components.docs.mdx +30 -0
- package/package.json +18 -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.docs.mdx +168 -0
- package/src/components/Container/Container.props.ts +89 -0
- package/src/components/Container/Container.stories.tsx +274 -0
- package/src/components/Container/Container.tsx +52 -0
- package/src/components/Container/index.tsx +2 -0
- 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/ProgressStepper/ProgressStep.tsx +8 -8
- package/src/components/ProgressStepper/ProgressStepper.docs.mdx +11 -11
- package/src/components/ProgressStepper/ProgressStepper.props.ts +3 -3
- package/src/components/ProgressStepper/ProgressStepper.stories.tsx +27 -27
- package/src/components/ProgressStepper/index.ts +1 -1
- 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/ThemedImage/ThemedImage.docs.mdx +208 -0
- package/src/components/ThemedImage/ThemedImage.props.ts +15 -0
- package/src/components/ThemedImage/ThemedImage.stories.tsx +175 -0
- package/src/components/ThemedImage/ThemedImage.tsx +34 -0
- package/src/components/ThemedImage/index.tsx +2 -0
- 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 +3 -9
- package/src/core/index.ts +14 -11
- package/src/hooks/useColorMode.ts +9 -12
- package/src/hooks/useStyleProps.ts +1 -1
- 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/src/vite-env.d.ts +6 -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,9 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { IconProps } from '../../Icon';
|
|
3
|
+
declare const CardActionTrailingIcon: {
|
|
4
|
+
({ children, ...props }: IconProps & {
|
|
5
|
+
as?: ComponentType;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
export default CardActionTrailingIcon;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
+
import { Icon } from '../../Icon';
|
|
5
|
+
const CardActionTrailingIcon = ({ children, ...props }) => {
|
|
6
|
+
return (_jsx(Icon, { ...props, style: Platform.OS === 'web'
|
|
7
|
+
? // @ts-expect-error - style prop type issue
|
|
8
|
+
{ ...styles.icon, ...props.style }
|
|
9
|
+
: [styles.icon, props.style], children: children }));
|
|
10
|
+
};
|
|
11
|
+
CardActionTrailingIcon.displayName = 'CardActionTrailingIcon';
|
|
12
|
+
const styles = StyleSheet.create(theme => ({
|
|
13
|
+
icon: {
|
|
14
|
+
color: theme.color.icon.primary,
|
|
15
|
+
minWidth: 20,
|
|
16
|
+
minHeight: 20,
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
export default CardActionTrailingIcon;
|
|
@@ -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 => ({
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
+
import { useStyleProps } from '../../hooks';
|
|
5
|
+
const Container = ({ style, children, space = 'md', ...props }) => {
|
|
6
|
+
const { computedStyles, remainingProps } = useStyleProps(props);
|
|
7
|
+
styles.useVariants({ space });
|
|
8
|
+
return (_jsx(View, { style: [styles.container(computedStyles), style], ...remainingProps, children: children }));
|
|
9
|
+
};
|
|
10
|
+
Container.displayName = 'Container';
|
|
11
|
+
const styles = StyleSheet.create(theme => ({
|
|
12
|
+
container: extra => ({
|
|
13
|
+
paddingTop: typeof extra.padding === 'undefined' && typeof extra.paddingVertical === 'undefined'
|
|
14
|
+
? {
|
|
15
|
+
base: theme.layout.mobile.container.paddingTop,
|
|
16
|
+
md: theme.layout.tablet.container.paddingTop,
|
|
17
|
+
lg: theme.layout.desktop.container.paddingTop,
|
|
18
|
+
}
|
|
19
|
+
: undefined,
|
|
20
|
+
paddingBottom: typeof extra.padding === 'undefined' && typeof extra.paddingVertical === 'undefined'
|
|
21
|
+
? {
|
|
22
|
+
base: theme.layout.mobile.container.paddingBottom,
|
|
23
|
+
md: theme.layout.tablet.container.paddingBottom,
|
|
24
|
+
lg: theme.layout.desktop.container.paddingBottom,
|
|
25
|
+
}
|
|
26
|
+
: undefined,
|
|
27
|
+
marginHorizontal: typeof extra.margin === 'undefined' && typeof extra.marginHorizontal === 'undefined'
|
|
28
|
+
? {
|
|
29
|
+
base: theme.layout.mobile.container.marginHorizontal,
|
|
30
|
+
md: theme.layout.tablet.container.marginHorizontal,
|
|
31
|
+
lg: theme.layout.desktop.container.marginHorizontal,
|
|
32
|
+
}
|
|
33
|
+
: undefined,
|
|
34
|
+
...extra,
|
|
35
|
+
variants: {
|
|
36
|
+
space: theme.globalStyle.variants.space,
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
}));
|
|
40
|
+
export default Container;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
import { SpaceValue, SpacingValues } from '../../types';
|
|
3
|
+
interface ContainerProps extends ViewProps {
|
|
4
|
+
/**
|
|
5
|
+
* The padding of the container.
|
|
6
|
+
*/
|
|
7
|
+
padding?: SpaceValue;
|
|
8
|
+
/**
|
|
9
|
+
* The horizontal padding of the container.
|
|
10
|
+
*/
|
|
11
|
+
paddingHorizontal?: SpaceValue;
|
|
12
|
+
/**
|
|
13
|
+
* The vertical padding of the container.
|
|
14
|
+
*/
|
|
15
|
+
paddingVertical?: SpaceValue;
|
|
16
|
+
/**
|
|
17
|
+
* The top padding of the container.
|
|
18
|
+
*/
|
|
19
|
+
paddingTop?: SpaceValue;
|
|
20
|
+
/**
|
|
21
|
+
* The bottom padding of the container.
|
|
22
|
+
*/
|
|
23
|
+
paddingBottom?: SpaceValue;
|
|
24
|
+
/**
|
|
25
|
+
* The left padding of the container.
|
|
26
|
+
*/
|
|
27
|
+
paddingLeft?: SpaceValue;
|
|
28
|
+
/**
|
|
29
|
+
* The right padding of the container.
|
|
30
|
+
*/
|
|
31
|
+
paddingRight?: SpaceValue;
|
|
32
|
+
/**
|
|
33
|
+
* The margin of the container.
|
|
34
|
+
*/
|
|
35
|
+
margin?: SpaceValue;
|
|
36
|
+
/**
|
|
37
|
+
* The horizontal margin of the container.
|
|
38
|
+
*/
|
|
39
|
+
marginHorizontal?: SpaceValue;
|
|
40
|
+
/**
|
|
41
|
+
* The vertical margin of the container.
|
|
42
|
+
*/
|
|
43
|
+
marginVertical?: SpaceValue;
|
|
44
|
+
/**
|
|
45
|
+
* The top margin of the container.
|
|
46
|
+
*/
|
|
47
|
+
marginTop?: SpaceValue;
|
|
48
|
+
/**
|
|
49
|
+
* The bottom margin of the container.
|
|
50
|
+
*/
|
|
51
|
+
marginBottom?: SpaceValue;
|
|
52
|
+
/**
|
|
53
|
+
* The left margin of the container.
|
|
54
|
+
*/
|
|
55
|
+
marginLeft?: SpaceValue;
|
|
56
|
+
/**
|
|
57
|
+
* The right margin of the container.
|
|
58
|
+
*/
|
|
59
|
+
marginRight?: SpaceValue;
|
|
60
|
+
p?: SpaceValue;
|
|
61
|
+
px?: SpaceValue;
|
|
62
|
+
py?: SpaceValue;
|
|
63
|
+
pt?: SpaceValue;
|
|
64
|
+
pb?: SpaceValue;
|
|
65
|
+
pl?: SpaceValue;
|
|
66
|
+
pr?: SpaceValue;
|
|
67
|
+
m?: SpaceValue;
|
|
68
|
+
mx?: SpaceValue;
|
|
69
|
+
my?: SpaceValue;
|
|
70
|
+
mt?: SpaceValue;
|
|
71
|
+
mb?: SpaceValue;
|
|
72
|
+
ml?: SpaceValue;
|
|
73
|
+
mr?: SpaceValue;
|
|
74
|
+
/**
|
|
75
|
+
* The space between child elements (gap).
|
|
76
|
+
*/
|
|
77
|
+
space?: SpacingValues;
|
|
78
|
+
/**
|
|
79
|
+
* The space between child elements.
|
|
80
|
+
*/
|
|
81
|
+
gap?: SpaceValue;
|
|
82
|
+
backgroundColor?: 'backgroundBrand' | 'backgroundPrimary' | 'backgroundSecondary' | 'transparent';
|
|
83
|
+
bg?: 'backgroundBrand' | 'backgroundPrimary' | 'backgroundSecondary' | 'transparent';
|
|
84
|
+
}
|
|
85
|
+
export default ContainerProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Container } from './Container';
|
|
@@ -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;
|
|
@@ -4,7 +4,7 @@ interface ProgressStepInternalProps extends ProgressStepProps {
|
|
|
4
4
|
isLast?: boolean;
|
|
5
5
|
}
|
|
6
6
|
declare const ProgressStep: {
|
|
7
|
-
({
|
|
7
|
+
({ status, index, isLast, ...rest }: ProgressStepInternalProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
displayName: string;
|
|
9
9
|
};
|
|
10
10
|
export default ProgressStep;
|