@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
package/.storybook/main.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { dirname } from "node:path";
|
|
1
3
|
import remarkGfm from 'remark-gfm';
|
|
4
|
+
import svgr from 'vite-plugin-svgr';
|
|
2
5
|
|
|
3
6
|
const unistylesPluginOptions = {
|
|
4
7
|
autoProcessImports: ['@utilitywarehouse/hearth-react-native'],
|
|
@@ -11,9 +14,9 @@ const unistylesPluginOptions = {
|
|
|
11
14
|
const config = {
|
|
12
15
|
stories: ['../**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
|
13
16
|
addons: [
|
|
14
|
-
|
|
17
|
+
getAbsolutePath("@chromatic-com/storybook"),
|
|
15
18
|
{
|
|
16
|
-
name:
|
|
19
|
+
name: getAbsolutePath("@storybook/addon-docs"),
|
|
17
20
|
options: {
|
|
18
21
|
mdxPluginOptions: {
|
|
19
22
|
mdxCompileOptions: {
|
|
@@ -22,24 +25,39 @@ const config = {
|
|
|
22
25
|
},
|
|
23
26
|
},
|
|
24
27
|
},
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
getAbsolutePath("@storybook/addon-a11y"),
|
|
29
|
+
getAbsolutePath("@storybook/addon-vitest"),
|
|
27
30
|
],
|
|
28
31
|
framework: {
|
|
29
|
-
name:
|
|
32
|
+
name: getAbsolutePath("@storybook/react-native-web-vite"),
|
|
30
33
|
options: {
|
|
31
34
|
pluginReactOptions: {
|
|
32
35
|
babel: {
|
|
33
36
|
plugins: [
|
|
34
37
|
['react-native-unistyles/plugin', unistylesPluginOptions],
|
|
35
38
|
'@babel/plugin-proposal-export-namespace-from',
|
|
36
|
-
'react-native-
|
|
39
|
+
'react-native-worklets/plugin',
|
|
37
40
|
],
|
|
38
41
|
},
|
|
39
42
|
},
|
|
40
43
|
},
|
|
41
44
|
},
|
|
42
|
-
viteFinal: config => {
|
|
45
|
+
viteFinal: async (config: any) => {
|
|
46
|
+
// Add SVGR plugin for web SVG imports as React components
|
|
47
|
+
config.plugins = [
|
|
48
|
+
...(config.plugins || []),
|
|
49
|
+
svgr({
|
|
50
|
+
include: '**/*.svg',
|
|
51
|
+
svgrOptions: {
|
|
52
|
+
exportType: 'default',
|
|
53
|
+
ref: true,
|
|
54
|
+
svgo: false,
|
|
55
|
+
titleProp: true,
|
|
56
|
+
icon: true,
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
];
|
|
60
|
+
|
|
43
61
|
return {
|
|
44
62
|
...config,
|
|
45
63
|
resolve: {
|
|
@@ -49,7 +67,15 @@ const config = {
|
|
|
49
67
|
'@utilitywarehouse/hearth-react-native-icons': '@utilitywarehouse/hearth-react-icons',
|
|
50
68
|
},
|
|
51
69
|
},
|
|
70
|
+
optimizeDeps: {
|
|
71
|
+
...config.optimizeDeps,
|
|
72
|
+
exclude: [...(config.optimizeDeps?.exclude || []), '@utilitywarehouse/hearth-svg-assets'],
|
|
73
|
+
},
|
|
52
74
|
};
|
|
53
75
|
},
|
|
54
76
|
};
|
|
55
77
|
export default config;
|
|
78
|
+
|
|
79
|
+
function getAbsolutePath(value: string): any {
|
|
80
|
+
return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`)));
|
|
81
|
+
}
|
package/.turbo/turbo-build.log
CHANGED
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @utilitywarehouse/hearth-react-native@0.
|
|
2
|
+
> @utilitywarehouse/hearth-react-native@0.7.0 lint /home/runner/work/hearth/hearth/packages/react-native
|
|
3
3
|
> TIMING=1 eslint --max-warnings 0
|
|
4
4
|
|
|
5
5
|
Rule | Time (ms) | Relative
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @utilitywarehouse/hearth-react-native
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#613](https://github.com/utilitywarehouse/hearth/pull/613) [`0bdfbe4`](https://github.com/utilitywarehouse/hearth/commit/0bdfbe41ed8b30e5abf49de6ea4cb3a12194921e) Thanks [@jordmccord](https://github.com/jordmccord)! - Adds `CardAction` component
|
|
8
|
+
|
|
9
|
+
## 0.6.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#603](https://github.com/utilitywarehouse/hearth/pull/603) [`3f292e9`](https://github.com/utilitywarehouse/hearth/commit/3f292e9960dc708dd6932cff04671dd7ef375c1a) Thanks [@jordmccord](https://github.com/jordmccord)! - Adds `Container` component
|
|
14
|
+
|
|
15
|
+
- [#605](https://github.com/utilitywarehouse/hearth/pull/605) [`f52e0f5`](https://github.com/utilitywarehouse/hearth/commit/f52e0f57eff5f1cfa36dacc45576c08771ca12df) Thanks [@jordmccord](https://github.com/jordmccord)! - Adds `ThemedImage` component
|
|
16
|
+
|
|
3
17
|
## 0.5.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -6,9 +6,9 @@ const StyledBottomSheetBackdrop = withUnistyles(Backdrop);
|
|
|
6
6
|
const BottomSheetBackdrop = ({ style, ...props }) => {
|
|
7
7
|
const theme = useTheme();
|
|
8
8
|
return (_jsx(StyledBottomSheetBackdrop
|
|
9
|
-
// @ts-expect-error - style
|
|
9
|
+
// @ts-expect-error - style prop type issue
|
|
10
10
|
, {
|
|
11
|
-
// @ts-expect-error - style
|
|
11
|
+
// @ts-expect-error - style prop type issue
|
|
12
12
|
style: [styles.backdrop, style], opacity: theme.components.overlay.opacity / 100, appearsOnIndex: 0, disappearsOnIndex: -1, ...props }));
|
|
13
13
|
};
|
|
14
14
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -10,9 +10,9 @@ const BottomSheetFlatList = ({ style, contentContainerStyle, isModal = true, ...
|
|
|
10
10
|
handle,
|
|
11
11
|
});
|
|
12
12
|
return (_jsx(StyledBottomSheetFlatList
|
|
13
|
-
// @ts-expect-error - style
|
|
13
|
+
// @ts-expect-error - style prop type issue
|
|
14
14
|
, {
|
|
15
|
-
// @ts-expect-error - style
|
|
15
|
+
// @ts-expect-error - style prop type issue
|
|
16
16
|
style: [styles.container, style], contentContainerStyle: [styles.contentContainer, contentContainerStyle], ...props }));
|
|
17
17
|
};
|
|
18
18
|
const styles = StyleSheet.create((theme, rt) => ({
|
|
@@ -4,9 +4,9 @@ import { StyleSheet, withUnistyles } from 'react-native-unistyles';
|
|
|
4
4
|
const StyledBottomSheetHandle = withUnistyles(Handle);
|
|
5
5
|
const BottomSheetHandle = ({ style, indicatorStyle, ...props }) => {
|
|
6
6
|
return (_jsx(StyledBottomSheetHandle
|
|
7
|
-
// @ts-expect-error - style
|
|
7
|
+
// @ts-expect-error - style prop type issue
|
|
8
8
|
, {
|
|
9
|
-
// @ts-expect-error - style
|
|
9
|
+
// @ts-expect-error - style prop type issue
|
|
10
10
|
style: [styles.handle, style], indicatorStyle: [styles.indicator, indicatorStyle], ...props }));
|
|
11
11
|
};
|
|
12
12
|
const styles = StyleSheet.create(theme => ({
|
|
@@ -7,7 +7,8 @@ const ButtonIcon = ({ children, ...props }) => {
|
|
|
7
7
|
const { colorScheme, variant, inverted, disabled } = useButtonContext();
|
|
8
8
|
styles.useVariants({ colorScheme, variant, 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
|
ButtonIcon.displayName = 'ButtonIcon';
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { Pressable } from 'react-native';
|
|
4
4
|
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
-
import {
|
|
5
|
+
import { useCardPressHandlerContext } from '../Card';
|
|
6
6
|
import { ButtonContext } from './Button.context';
|
|
7
7
|
const ButtonRoot = ({ children, colorScheme = 'highlight', variant = 'solid', size = 'md', inverted = false, states, onPress, paddingNone = false, ...props }) => {
|
|
8
8
|
const { active, disabled = false } = states || {};
|
|
9
|
-
const { pressed } =
|
|
9
|
+
const { pressed } = useCardPressHandlerContext();
|
|
10
10
|
styles.useVariants({
|
|
11
11
|
variant,
|
|
12
12
|
size,
|
|
@@ -79,7 +79,6 @@ const styles = StyleSheet.create(theme => ({
|
|
|
79
79
|
ghost: {
|
|
80
80
|
backgroundColor: 'transparent',
|
|
81
81
|
borderWidth: 0,
|
|
82
|
-
textDecoration: 'underline',
|
|
83
82
|
},
|
|
84
83
|
},
|
|
85
84
|
size: {
|
|
@@ -325,7 +324,6 @@ const styles = StyleSheet.create(theme => ({
|
|
|
325
324
|
variant: 'ghost',
|
|
326
325
|
colorScheme: 'functional',
|
|
327
326
|
styles: {
|
|
328
|
-
textDecorationColor: theme.color.interactive.functional.foreground.subtle,
|
|
329
327
|
_web: {
|
|
330
328
|
_hover: {
|
|
331
329
|
backgroundColor: theme.color.interactive.functional.surface.subtle.hover,
|
|
@@ -373,7 +371,6 @@ const styles = StyleSheet.create(theme => ({
|
|
|
373
371
|
variant: 'ghost',
|
|
374
372
|
colorScheme: 'affirmative',
|
|
375
373
|
styles: {
|
|
376
|
-
textDecorationColor: theme.color.interactive.affirmative.foreground.subtle,
|
|
377
374
|
_web: {
|
|
378
375
|
_hover: {
|
|
379
376
|
backgroundColor: theme.color.interactive.affirmative.surface.subtle.hover,
|
|
@@ -397,7 +394,6 @@ const styles = StyleSheet.create(theme => ({
|
|
|
397
394
|
variant: 'ghost',
|
|
398
395
|
colorScheme: 'destructive',
|
|
399
396
|
styles: {
|
|
400
|
-
textDecorationColor: theme.color.interactive.destructive.foreground.subtle,
|
|
401
397
|
_web: {
|
|
402
398
|
_hover: {
|
|
403
399
|
backgroundColor: theme.color.interactive.destructive.surface.subtle.hover,
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import CardProps from './Card.props';
|
|
1
2
|
interface CardContextProps {
|
|
2
3
|
pressed?: boolean;
|
|
4
|
+
noPadding?: boolean;
|
|
5
|
+
hasActions?: boolean;
|
|
6
|
+
hasContent?: boolean;
|
|
7
|
+
hasOnlyActions?: boolean;
|
|
8
|
+
space?: CardProps['space'];
|
|
9
|
+
variant?: CardProps['variant'];
|
|
3
10
|
}
|
|
4
11
|
export declare const CardContext: import("react").Context<CardContextProps>;
|
|
5
12
|
export declare const useCardContext: () => CardContextProps;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ICardActionContext {
|
|
2
|
+
showPressed: boolean;
|
|
3
|
+
active?: boolean;
|
|
4
|
+
loading: boolean;
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
size: 'md' | 'lg';
|
|
7
|
+
}
|
|
8
|
+
export declare const CardActionContext: import("react").Context<ICardActionContext>;
|
|
9
|
+
export declare const useCardActionContext: () => ICardActionContext;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { createContext, useContext } from 'react';
|
|
2
|
-
export const CardActionContext = createContext({
|
|
2
|
+
export const CardActionContext = createContext({
|
|
3
|
+
showPressed: false,
|
|
4
|
+
active: false,
|
|
5
|
+
loading: false,
|
|
6
|
+
disabled: false,
|
|
7
|
+
size: 'md',
|
|
8
|
+
});
|
|
3
9
|
export const useCardActionContext = () => {
|
|
4
10
|
const context = useContext(CardActionContext);
|
|
5
11
|
return context;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const CardAction: import("react").ForwardRefExoticComponent<(((import("./CardAction.props").default & {
|
|
2
|
+
states?: {
|
|
3
|
+
active?: boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
isFirst?: boolean;
|
|
7
|
+
}) & Omit<import("react-native").PressableProps, "children">) & {
|
|
8
|
+
tabIndex?: 0 | -1 | undefined;
|
|
9
|
+
} & {
|
|
10
|
+
children?: import("react").ReactNode | (({ hovered, pressed, focused, focusVisible, disabled, }: {
|
|
11
|
+
hovered?: boolean | undefined;
|
|
12
|
+
pressed?: boolean | undefined;
|
|
13
|
+
focused?: boolean | undefined;
|
|
14
|
+
focusVisible?: boolean | undefined;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
}) => import("react").ReactNode);
|
|
17
|
+
}) & import("react").RefAttributes<unknown>>;
|
|
18
|
+
export default CardAction;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import type { PressableProps, ViewProps } from 'react-native';
|
|
3
|
+
import BadgeProps from '../../Badge/Badge.props';
|
|
4
|
+
import { IconContainerProps } from '../../IconContainer';
|
|
5
|
+
interface CardActionBaseProps extends Omit<PressableProps, 'children'> {
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
size?: 'md' | 'lg';
|
|
9
|
+
}
|
|
10
|
+
interface CardActionContentProps {
|
|
11
|
+
heading: string;
|
|
12
|
+
helperText?: string;
|
|
13
|
+
badge?: BadgeProps;
|
|
14
|
+
badgePosition?: 'bottom' | 'middle' | 'right' | 'top';
|
|
15
|
+
iconContainer?: boolean;
|
|
16
|
+
iconContainerVariant?: IconContainerProps['variant'];
|
|
17
|
+
iconContainerColor?: IconContainerProps['color'];
|
|
18
|
+
}
|
|
19
|
+
export interface CardActionWithChildren extends CardActionBaseProps {
|
|
20
|
+
children: ViewProps['children'];
|
|
21
|
+
heading?: never;
|
|
22
|
+
helperText?: never;
|
|
23
|
+
leadingContent?: never;
|
|
24
|
+
leadingIcon?: never;
|
|
25
|
+
trailingContent?: never;
|
|
26
|
+
trailingIcon?: never;
|
|
27
|
+
badge?: never;
|
|
28
|
+
badgePosition?: never;
|
|
29
|
+
iconContainer?: never;
|
|
30
|
+
iconContainerVariant?: never;
|
|
31
|
+
iconContainerColor?: never;
|
|
32
|
+
}
|
|
33
|
+
type CardActionWithLeadingContent = CardActionBaseProps & CardActionContentProps & {
|
|
34
|
+
children?: never;
|
|
35
|
+
leadingContent: ViewProps['children'];
|
|
36
|
+
leadingIcon?: never;
|
|
37
|
+
};
|
|
38
|
+
type CardActionWithLeadingIcon = CardActionBaseProps & CardActionContentProps & {
|
|
39
|
+
children?: never;
|
|
40
|
+
leadingContent?: never;
|
|
41
|
+
leadingIcon: ComponentType;
|
|
42
|
+
};
|
|
43
|
+
type CardActionWithNoLeading = CardActionBaseProps & CardActionContentProps & {
|
|
44
|
+
children?: never;
|
|
45
|
+
leadingContent?: never;
|
|
46
|
+
leadingIcon?: never;
|
|
47
|
+
};
|
|
48
|
+
type CardActionLeadingVariants = CardActionWithLeadingContent | CardActionWithLeadingIcon | CardActionWithNoLeading;
|
|
49
|
+
type CardActionWithTrailingContent = CardActionLeadingVariants & {
|
|
50
|
+
trailingContent: ViewProps['children'];
|
|
51
|
+
trailingIcon?: never;
|
|
52
|
+
};
|
|
53
|
+
type CardActionWithTrailingIcon = CardActionLeadingVariants & {
|
|
54
|
+
trailingContent?: never;
|
|
55
|
+
trailingIcon: ComponentType;
|
|
56
|
+
};
|
|
57
|
+
type CardActionWithNoTrailing = CardActionLeadingVariants & {
|
|
58
|
+
trailingContent?: never;
|
|
59
|
+
trailingIcon?: never;
|
|
60
|
+
};
|
|
61
|
+
type CardActionWithoutChildren = CardActionWithTrailingContent | CardActionWithTrailingIcon | CardActionWithNoTrailing;
|
|
62
|
+
type CardActionProps = CardActionWithChildren | CardActionWithoutChildren;
|
|
63
|
+
export default CardActionProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
4
|
+
const CardActionContent = ({ children, ...props }) => {
|
|
5
|
+
return (_jsx(View, { ...props, style: [styles.container, props.style], children: children }));
|
|
6
|
+
};
|
|
7
|
+
CardActionContent.displayName = 'CardActionContent';
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
flex: 1,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
export default CardActionContent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
3
|
+
import { BodyText } from '../../BodyText';
|
|
4
|
+
const CardActionHelperText = ({ children, ...props }) => {
|
|
5
|
+
return (_jsx(BodyText, { size: "md", ...props, style: [styles.text, props.style], children: children }));
|
|
6
|
+
};
|
|
7
|
+
CardActionHelperText.displayName = 'CardActionHelperText';
|
|
8
|
+
const styles = StyleSheet.create(theme => ({
|
|
9
|
+
text: {
|
|
10
|
+
color: theme.color.text.secondary,
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
export default CardActionHelperText;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { IconProps } from '../../Icon';
|
|
3
|
+
declare const CardActionIcon: {
|
|
4
|
+
({ children, ...props }: IconProps & {
|
|
5
|
+
as?: ComponentType;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
export default CardActionIcon;
|
|
@@ -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 CardActionIcon = ({ 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
|
+
CardActionIcon.displayName = 'CardActionIcon';
|
|
12
|
+
const styles = StyleSheet.create(theme => ({
|
|
13
|
+
icon: {
|
|
14
|
+
color: theme.color.icon.primary,
|
|
15
|
+
width: 24,
|
|
16
|
+
height: 24,
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
export default CardActionIcon;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
const CardActionLeadingContent = ({ children, ...props }) => (_jsx(View, { ...props, children: children }));
|
|
4
|
+
CardActionLeadingContent.displayName = 'CardActionLeadingContent';
|
|
5
|
+
export default CardActionLeadingContent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type CardActionProps from './CardAction.props';
|
|
2
|
+
declare const CardActionRoot: {
|
|
3
|
+
({ heading, helperText, leadingContent, trailingContent, disabled, loading, children, states, badge, badgePosition, iconContainer, iconContainerColor, iconContainerVariant, leadingIcon, trailingIcon, size, ...props }: CardActionProps & {
|
|
4
|
+
states?: {
|
|
5
|
+
active?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
isFirst?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default CardActionRoot;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRightSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { Pressable, View } from 'react-native';
|
|
5
|
+
import { StyleSheet } from 'react-native-unistyles';
|
|
6
|
+
import { Badge } from '../../Badge';
|
|
7
|
+
import { IconContainer } from '../../IconContainer';
|
|
8
|
+
import { Skeleton } from '../../Skeleton';
|
|
9
|
+
import { useCardContext } from '../Card.context';
|
|
10
|
+
import { CardActionContext } from './CardAction.context';
|
|
11
|
+
import CardActionContent from './CardActionContent';
|
|
12
|
+
import CardActionHelperText from './CardActionHelperText';
|
|
13
|
+
import CardActionIcon from './CardActionIcon';
|
|
14
|
+
import CardActionLeadingContent from './CardActionLeadingContent';
|
|
15
|
+
import CardActionText from './CardActionText';
|
|
16
|
+
import CardActionTrailingContent from './CardActionTrailingContent';
|
|
17
|
+
import CardActionTrailingIcon from './CardActionTrailingIcon';
|
|
18
|
+
const CardActionRoot = ({ heading, helperText, leadingContent, trailingContent, disabled, loading, children, states, badge, badgePosition = 'bottom', iconContainer = true, iconContainerColor, iconContainerVariant, leadingIcon, trailingIcon = ChevronRightSmallIcon, size = 'md', ...props }) => {
|
|
19
|
+
const { onPress } = props;
|
|
20
|
+
const { active } = states || { active: false };
|
|
21
|
+
const isLoading = loading;
|
|
22
|
+
const showPressed = isLoading ? false : !!onPress;
|
|
23
|
+
const isDisabled = disabled || false;
|
|
24
|
+
const testID = props.testID || 'card-action';
|
|
25
|
+
const loadingTestID = isLoading ? `${testID}-loading` : testID;
|
|
26
|
+
const { variant, hasOnlyActions } = useCardContext();
|
|
27
|
+
const isFirst = props.isFirst;
|
|
28
|
+
styles.useVariants({
|
|
29
|
+
showPressed,
|
|
30
|
+
active,
|
|
31
|
+
disabled: isDisabled || isLoading,
|
|
32
|
+
showDisabled: disabled,
|
|
33
|
+
hasIconContainer: !loading && iconContainer,
|
|
34
|
+
variant,
|
|
35
|
+
isFirst: hasOnlyActions && isFirst,
|
|
36
|
+
});
|
|
37
|
+
const value = useMemo(() => {
|
|
38
|
+
return {
|
|
39
|
+
showPressed,
|
|
40
|
+
active: active || false,
|
|
41
|
+
loading: isLoading || false,
|
|
42
|
+
disabled: isDisabled,
|
|
43
|
+
size,
|
|
44
|
+
};
|
|
45
|
+
}, [active, showPressed, isLoading, isDisabled, size]);
|
|
46
|
+
if (loading) {
|
|
47
|
+
return (_jsxs(Pressable, { ...props, testID: loadingTestID, style: [styles.container, styles.alignCenter, props.style], disabled: isDisabled, children: [leadingContent || leadingIcon ? (_jsx(Skeleton, { width: 24, height: 24, style: styles.alignCenter })) : null, _jsxs(CardActionContent, { children: [_jsx(Skeleton, { width: "80%", height: 24, borderRadius: "xs" }), _jsx(Skeleton, { width: "100%", height: 24, borderRadius: "xs" })] }), trailingIcon || trailingContent ? (_jsx(Skeleton, { width: 24, height: 24, borderRadius: "xs", style: styles.alignCenter })) : null] }));
|
|
48
|
+
}
|
|
49
|
+
return (_jsx(CardActionContext.Provider, { value: value, children: _jsx(Pressable, { ...props, testID: testID, style: [styles.container, props.style], disabled: isDisabled, accessibilityRole: onPress ? 'button' : undefined, children: children ? (children) : (_jsxs(_Fragment, { children: [leadingIcon && iconContainer ? (_jsx(View, { style: styles.iconContainerWrap, children: _jsx(IconContainer, { style: styles.iconContainer, icon: leadingIcon, variant: iconContainerVariant, color: iconContainerColor, radiusNone: true }) })) : null, _jsxs(View, { style: styles.withIconContainer, children: [leadingContent ? (_jsx(CardActionLeadingContent, { children: leadingContent })) : null, leadingIcon && !iconContainer && !leadingContent ? (_jsx(CardActionLeadingContent, { children: _jsx(CardActionIcon, { as: leadingIcon }) })) : null, _jsxs(CardActionContent, { children: [badgePosition === 'top' && badge ? _jsx(Badge, { ...badge }) : null, _jsx(CardActionText, { children: heading }), badgePosition === 'middle' && badge ? _jsx(Badge, { ...badge }) : null, helperText ? _jsx(CardActionHelperText, { children: helperText }) : null, badgePosition === 'bottom' && badge ? _jsx(Badge, { ...badge }) : null] }), badgePosition === 'right' && badge ? (_jsx(Badge, { ...badge, style: [badge.style, styles.alignCenter] })) : null, trailingContent ? (_jsx(CardActionTrailingContent, { children: trailingContent })) : null, trailingIcon && !trailingContent ? (_jsx(CardActionTrailingContent, { children: _jsx(CardActionTrailingIcon, { as: trailingIcon }) })) : null] })] })) }) }));
|
|
50
|
+
};
|
|
51
|
+
CardActionRoot.displayName = 'CardActionRoot';
|
|
52
|
+
const styles = StyleSheet.create(theme => ({
|
|
53
|
+
container: {
|
|
54
|
+
paddingVertical: theme.components.cardAction.content.paddingVertical,
|
|
55
|
+
paddingHorizontal: theme.components.cardAction.content.paddingHorizontal,
|
|
56
|
+
flexDirection: 'row',
|
|
57
|
+
gap: theme.components.cardAction.content.gap,
|
|
58
|
+
borderTopWidth: theme.borderWidth[1],
|
|
59
|
+
borderColor: theme.color.border.strong,
|
|
60
|
+
width: '100%',
|
|
61
|
+
variants: {
|
|
62
|
+
isFirst: {
|
|
63
|
+
true: {
|
|
64
|
+
borderTopWidth: 0,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
disabled: {
|
|
68
|
+
true: {
|
|
69
|
+
cursor: 'auto',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
variant: {
|
|
73
|
+
subtle: {
|
|
74
|
+
borderColor: theme.color.border.subtle,
|
|
75
|
+
},
|
|
76
|
+
emphasis: {
|
|
77
|
+
borderColor: theme.color.border.strong,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
hasIconContainer: {
|
|
81
|
+
true: {
|
|
82
|
+
paddingHorizontal: 0,
|
|
83
|
+
paddingVertical: 0,
|
|
84
|
+
gap: 0,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
showDisabled: {
|
|
88
|
+
true: {
|
|
89
|
+
opacity: theme.opacity.disabled,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
showPressed: {
|
|
93
|
+
true: {
|
|
94
|
+
_web: {
|
|
95
|
+
_hover: {
|
|
96
|
+
backgroundColor: theme.color.interactive.neutral.surface.subtle.hover,
|
|
97
|
+
},
|
|
98
|
+
_active: {
|
|
99
|
+
backgroundColor: theme.color.interactive.neutral.surface.subtle.active,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
false: {
|
|
104
|
+
cursor: 'auto',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
active: {
|
|
108
|
+
true: {},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
compoundVariants: [
|
|
112
|
+
{
|
|
113
|
+
showPressed: true,
|
|
114
|
+
active: true,
|
|
115
|
+
styles: {
|
|
116
|
+
backgroundColor: theme.color.interactive.neutral.surface.subtle.active,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
withIconContainer: {
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
flexDirection: 'row',
|
|
124
|
+
paddingVertical: theme.components.list.item.functional.padding,
|
|
125
|
+
paddingHorizontal: theme.components.list.item.functional.padding,
|
|
126
|
+
gap: theme.components.list.item.gap,
|
|
127
|
+
flex: 1,
|
|
128
|
+
variants: {
|
|
129
|
+
hasIconContainer: {
|
|
130
|
+
true: {},
|
|
131
|
+
false: {
|
|
132
|
+
flex: 1,
|
|
133
|
+
paddingHorizontal: 0,
|
|
134
|
+
paddingVertical: 0,
|
|
135
|
+
alignItems: 'center',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
alignCenter: {
|
|
141
|
+
alignSelf: 'center',
|
|
142
|
+
alignItems: 'center',
|
|
143
|
+
},
|
|
144
|
+
iconContainer: {
|
|
145
|
+
flex: 1,
|
|
146
|
+
_web: {
|
|
147
|
+
overflow: 'visible',
|
|
148
|
+
height: '100%',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
iconContainerWrap: {
|
|
152
|
+
flexDirection: 'column',
|
|
153
|
+
},
|
|
154
|
+
}));
|
|
155
|
+
export default CardActionRoot;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { BodyText } from '../../BodyText';
|
|
3
|
+
import { useCardActionContext } from './CardAction.context';
|
|
4
|
+
const CardActionText = ({ children, ...props }) => {
|
|
5
|
+
const { size } = useCardActionContext();
|
|
6
|
+
return (_jsx(BodyText, { size: size, weight: "semibold", ...props, children: children }));
|
|
7
|
+
};
|
|
8
|
+
CardActionText.displayName = 'CardActionText';
|
|
9
|
+
export default CardActionText;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
const CardActionTrailingContent = ({ children, ...props }) => (_jsx(View, { ...props, children: children }));
|
|
4
|
+
CardActionTrailingContent.displayName = 'CardActionTrailingContent';
|
|
5
|
+
export default CardActionTrailingContent;
|