@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.
Files changed (213) hide show
  1. package/.storybook/main.ts +33 -7
  2. package/.turbo/turbo-build.log +1 -1
  3. package/.turbo/turbo-lint.log +1 -1
  4. package/CHANGELOG.md +14 -0
  5. package/build/components/BottomSheet/BottomSheetBackdrop.js +2 -2
  6. package/build/components/BottomSheet/BottomSheetFlatList.js +2 -2
  7. package/build/components/BottomSheet/BottomSheetHandle.js +2 -2
  8. package/build/components/Button/ButtonIcon.js +2 -1
  9. package/build/components/Button/ButtonRoot.js +2 -6
  10. package/build/components/Button/ButtonText.js +4 -1
  11. package/build/components/Card/Card.context.d.ts +7 -0
  12. package/build/components/Card/CardAction/CardAction.context.d.ts +9 -0
  13. package/build/components/Card/{CardAction.context.js → CardAction/CardAction.context.js} +7 -1
  14. package/build/components/Card/CardAction/CardAction.d.ts +18 -0
  15. package/build/components/Card/CardAction/CardAction.js +7 -0
  16. package/build/components/Card/CardAction/CardAction.props.d.ts +63 -0
  17. package/build/components/Card/CardAction/CardAction.props.js +1 -0
  18. package/build/components/Card/CardAction/CardActionContent.d.ts +6 -0
  19. package/build/components/Card/CardAction/CardActionContent.js +13 -0
  20. package/build/components/Card/CardAction/CardActionHelperText.d.ts +6 -0
  21. package/build/components/Card/CardAction/CardActionHelperText.js +13 -0
  22. package/build/components/Card/CardAction/CardActionIcon.d.ts +9 -0
  23. package/build/components/Card/CardAction/CardActionIcon.js +19 -0
  24. package/build/components/Card/CardAction/CardActionLeadingContent.d.ts +6 -0
  25. package/build/components/Card/CardAction/CardActionLeadingContent.js +5 -0
  26. package/build/components/Card/CardAction/CardActionRoot.d.ts +12 -0
  27. package/build/components/Card/CardAction/CardActionRoot.js +155 -0
  28. package/build/components/Card/CardAction/CardActionText.d.ts +6 -0
  29. package/build/components/Card/CardAction/CardActionText.js +9 -0
  30. package/build/components/Card/CardAction/CardActionTrailingContent.d.ts +6 -0
  31. package/build/components/Card/CardAction/CardActionTrailingContent.js +5 -0
  32. package/build/components/Card/CardAction/CardActionTrailingIcon.d.ts +9 -0
  33. package/build/components/Card/CardAction/CardActionTrailingIcon.js +19 -0
  34. package/build/components/Card/CardAction/index.d.ts +10 -0
  35. package/build/components/Card/CardAction/index.js +9 -0
  36. package/build/components/Card/CardContent.d.ts +6 -0
  37. package/build/components/Card/CardContent.js +33 -0
  38. package/build/components/Card/CardPressHandler.context.d.ts +6 -0
  39. package/build/components/Card/CardPressHandler.context.js +6 -0
  40. package/build/components/Card/{CardAction.d.ts → CardPressHandler.d.ts} +3 -3
  41. package/build/components/Card/CardPressHandler.js +13 -0
  42. package/build/components/Card/CardRoot.js +103 -11
  43. package/build/components/Card/index.d.ts +3 -2
  44. package/build/components/Card/index.js +3 -2
  45. package/build/components/Checkbox/CheckboxIcon.js +2 -1
  46. package/build/components/Container/Container.d.ts +6 -0
  47. package/build/components/Container/Container.js +40 -0
  48. package/build/components/Container/Container.props.d.ts +85 -0
  49. package/build/components/Container/Container.props.js +1 -0
  50. package/build/components/Container/index.d.ts +2 -0
  51. package/build/components/Container/index.js +1 -0
  52. package/build/components/CurrencyInput/CurrencyInput.js +1 -1
  53. package/build/components/Helper/HelperIcon.js +2 -1
  54. package/build/components/Icon/Icon.d.ts +2 -6
  55. package/build/components/IconButton/IconButtonIcon.js +2 -1
  56. package/build/components/IconContainer/IconContainer.d.ts +4 -3
  57. package/build/components/IconContainer/IconContainer.js +3 -3
  58. package/build/components/Input/InputField.js +4 -2
  59. package/build/components/Input/InputIcon.js +2 -1
  60. package/build/components/Link/LinkIcon.js +3 -2
  61. package/build/components/List/ListAction/ListActionTrailingIcon.js +2 -1
  62. package/build/components/List/ListItem/ListItemIcon.js +2 -1
  63. package/build/components/List/ListItem/ListItemTrailingIcon.js +2 -3
  64. package/build/components/ProgressStepper/ProgressStep.d.ts +1 -1
  65. package/build/components/ProgressStepper/ProgressStep.js +6 -6
  66. package/build/components/ProgressStepper/ProgressStepper.props.d.ts +3 -3
  67. package/build/components/ProgressStepper/index.d.ts +1 -1
  68. package/build/components/Radio/RadioIcon.js +7 -2
  69. package/build/components/RadioCard/RadioCardIcon.js +3 -2
  70. package/build/components/Spinner/Spinner.js +2 -0
  71. package/build/components/Spinner/Spinner.web.js +2 -0
  72. package/build/components/Switch/Switch.js +5 -3
  73. package/build/components/Switch/Switch.web.js +1 -0
  74. package/build/components/Tabs/TabsList.js +6 -1
  75. package/build/components/Textarea/TextareaField.js +1 -1
  76. package/build/components/ThemedImage/ThemedImage.d.ts +12 -0
  77. package/build/components/ThemedImage/ThemedImage.js +27 -0
  78. package/build/components/ThemedImage/ThemedImage.props.d.ts +13 -0
  79. package/build/components/ThemedImage/ThemedImage.props.js +1 -0
  80. package/build/components/ThemedImage/index.d.ts +2 -0
  81. package/build/components/ThemedImage/index.js +1 -0
  82. package/build/components/ToggleButton/ToggleButtonIcon.js +2 -1
  83. package/build/components/ToggleButton/ToggleButtonRoot.js +2 -2
  84. package/build/components/UnstyledIconButton/UnstyledIconButtonIcon.js +2 -1
  85. package/build/components/index.d.ts +3 -1
  86. package/build/components/index.js +3 -1
  87. package/build/core/index.d.ts +3 -3
  88. package/build/core/index.js +3 -3
  89. package/build/core/themes.d.ts +24 -12
  90. package/build/hooks/useColorMode.d.ts +1 -1
  91. package/build/hooks/useColorMode.js +7 -8
  92. package/build/hooks/useStyleProps.js +1 -1
  93. package/build/tokens/components/dark/banner.d.ts +19 -0
  94. package/build/tokens/components/dark/banner.js +19 -0
  95. package/build/tokens/components/dark/card-action.d.ts +11 -0
  96. package/build/tokens/components/dark/card-action.js +10 -0
  97. package/build/tokens/components/dark/card-content.d.ts +25 -0
  98. package/build/tokens/components/dark/card-content.js +24 -0
  99. package/build/tokens/components/dark/drawer.d.ts +29 -0
  100. package/build/tokens/components/dark/drawer.js +28 -0
  101. package/build/tokens/components/dark/illustrations.d.ts +0 -1
  102. package/build/tokens/components/dark/illustrations.js +0 -1
  103. package/build/tokens/components/dark/index.d.ts +3 -0
  104. package/build/tokens/components/dark/index.js +3 -0
  105. package/build/tokens/components/light/banner.d.ts +19 -0
  106. package/build/tokens/components/light/banner.js +19 -0
  107. package/build/tokens/components/light/card-action.d.ts +11 -0
  108. package/build/tokens/components/light/card-action.js +10 -0
  109. package/build/tokens/components/light/card-content.d.ts +25 -0
  110. package/build/tokens/components/light/card-content.js +24 -0
  111. package/build/tokens/components/light/drawer.d.ts +29 -0
  112. package/build/tokens/components/light/drawer.js +28 -0
  113. package/build/tokens/components/light/illustrations.d.ts +0 -1
  114. package/build/tokens/components/light/illustrations.js +0 -1
  115. package/build/tokens/components/light/index.d.ts +3 -0
  116. package/build/tokens/components/light/index.js +3 -0
  117. package/build/tokens/layout.d.ts +6 -6
  118. package/build/tokens/layout.js +3 -3
  119. package/build/tokens/typography.d.ts +6 -0
  120. package/build/tokens/typography.js +3 -0
  121. package/docs/components/AllComponents.web.tsx +38 -3
  122. package/docs/components/NextPrevPage.tsx +5 -5
  123. package/docs/components/VariantTitle.tsx +17 -7
  124. package/docs/layout-components.docs.mdx +30 -0
  125. package/package.json +18 -14
  126. package/src/components/BottomSheet/BottomSheetBackdrop.tsx +2 -2
  127. package/src/components/BottomSheet/BottomSheetFlatList.tsx +2 -3
  128. package/src/components/BottomSheet/BottomSheetHandle.tsx +1 -1
  129. package/src/components/Button/ButtonIcon.tsx +2 -1
  130. package/src/components/Button/ButtonRoot.tsx +2 -6
  131. package/src/components/Button/ButtonText.tsx +4 -1
  132. package/src/components/Card/Card.context.ts +7 -0
  133. package/src/components/Card/Card.docs.mdx +212 -14
  134. package/src/components/Card/Card.stories.tsx +50 -3
  135. package/src/components/Card/CardAction/CardAction.context.ts +22 -0
  136. package/src/components/Card/CardAction/CardAction.props.ts +87 -0
  137. package/src/components/Card/CardAction/CardAction.stories.tsx +265 -0
  138. package/src/components/Card/CardAction/CardAction.tsx +10 -0
  139. package/src/components/Card/CardAction/CardActionContent.tsx +20 -0
  140. package/src/components/Card/CardAction/CardActionHelperText.tsx +21 -0
  141. package/src/components/Card/CardAction/CardActionIcon.tsx +32 -0
  142. package/src/components/Card/CardAction/CardActionLeadingContent.tsx +9 -0
  143. package/src/components/Card/CardAction/CardActionRoot.tsx +258 -0
  144. package/src/components/Card/CardAction/CardActionText.tsx +17 -0
  145. package/src/components/Card/CardAction/CardActionTrailingContent.tsx +9 -0
  146. package/src/components/Card/CardAction/CardActionTrailingIcon.tsx +32 -0
  147. package/src/components/Card/CardAction/index.ts +10 -0
  148. package/src/components/Card/CardContent.tsx +40 -0
  149. package/src/components/Card/CardPressHandler.context.ts +12 -0
  150. package/src/components/Card/CardPressHandler.tsx +20 -0
  151. package/src/components/Card/CardRoot.tsx +128 -13
  152. package/src/components/Card/index.ts +3 -2
  153. package/src/components/Checkbox/CheckboxIcon.tsx +2 -1
  154. package/src/components/Container/Container.docs.mdx +168 -0
  155. package/src/components/Container/Container.props.ts +89 -0
  156. package/src/components/Container/Container.stories.tsx +274 -0
  157. package/src/components/Container/Container.tsx +52 -0
  158. package/src/components/Container/index.tsx +2 -0
  159. package/src/components/CurrencyInput/CurrencyInput.tsx +1 -1
  160. package/src/components/Helper/HelperIcon.tsx +2 -1
  161. package/src/components/Icon/Icon.tsx +4 -3
  162. package/src/components/IconButton/IconButtonIcon.tsx +2 -1
  163. package/src/components/IconContainer/IconContainer.tsx +17 -19
  164. package/src/components/Input/InputField.tsx +2 -1
  165. package/src/components/Input/InputIcon.tsx +2 -1
  166. package/src/components/Link/LinkIcon.tsx +3 -2
  167. package/src/components/List/ListAction/ListActionTrailingIcon.tsx +2 -1
  168. package/src/components/List/ListItem/ListItemIcon.tsx +2 -1
  169. package/src/components/List/ListItem/ListItemTrailingIcon.tsx +2 -3
  170. package/src/components/ProgressStepper/ProgressStep.tsx +8 -8
  171. package/src/components/ProgressStepper/ProgressStepper.docs.mdx +11 -11
  172. package/src/components/ProgressStepper/ProgressStepper.props.ts +3 -3
  173. package/src/components/ProgressStepper/ProgressStepper.stories.tsx +27 -27
  174. package/src/components/ProgressStepper/index.ts +1 -1
  175. package/src/components/Radio/RadioIcon.tsx +8 -3
  176. package/src/components/RadioCard/RadioCardIcon.tsx +4 -3
  177. package/src/components/Spinner/Spinner.tsx +2 -0
  178. package/src/components/Spinner/Spinner.web.tsx +2 -0
  179. package/src/components/Switch/Switch.tsx +10 -5
  180. package/src/components/Switch/Switch.web.tsx +5 -0
  181. package/src/components/Tabs/TabsList.tsx +2 -0
  182. package/src/components/Textarea/TextareaField.tsx +1 -1
  183. package/src/components/ThemedImage/ThemedImage.docs.mdx +208 -0
  184. package/src/components/ThemedImage/ThemedImage.props.ts +15 -0
  185. package/src/components/ThemedImage/ThemedImage.stories.tsx +175 -0
  186. package/src/components/ThemedImage/ThemedImage.tsx +34 -0
  187. package/src/components/ThemedImage/index.tsx +2 -0
  188. package/src/components/ToggleButton/ToggleButtonIcon.tsx +2 -1
  189. package/src/components/ToggleButton/ToggleButtonRoot.tsx +2 -2
  190. package/src/components/UnstyledIconButton/UnstyledIconButtonIcon.tsx +2 -1
  191. package/src/components/index.ts +3 -9
  192. package/src/core/index.ts +14 -11
  193. package/src/hooks/useColorMode.ts +9 -12
  194. package/src/hooks/useStyleProps.ts +1 -1
  195. package/src/tokens/components/dark/banner.ts +19 -0
  196. package/src/tokens/components/dark/card-action.ts +11 -0
  197. package/src/tokens/components/dark/card-content.ts +25 -0
  198. package/src/tokens/components/dark/drawer.ts +29 -0
  199. package/src/tokens/components/dark/illustrations.ts +0 -1
  200. package/src/tokens/components/dark/index.ts +3 -0
  201. package/src/tokens/components/light/banner.ts +19 -0
  202. package/src/tokens/components/light/card-action.ts +11 -0
  203. package/src/tokens/components/light/card-content.ts +25 -0
  204. package/src/tokens/components/light/drawer.ts +29 -0
  205. package/src/tokens/components/light/illustrations.ts +0 -1
  206. package/src/tokens/components/light/index.ts +3 -0
  207. package/src/tokens/layout.ts +3 -3
  208. package/src/tokens/typography.ts +3 -0
  209. package/src/vite-env.d.ts +6 -0
  210. package/build/components/Card/CardAction.context.d.ts +0 -6
  211. package/build/components/Card/CardAction.js +0 -13
  212. package/src/components/Card/CardAction.context.ts +0 -12
  213. package/src/components/Card/CardAction.tsx +0 -18
@@ -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
- '@chromatic-com/storybook',
17
+ getAbsolutePath("@chromatic-com/storybook"),
15
18
  {
16
- name: '@storybook/addon-docs',
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
- '@storybook/addon-a11y',
26
- '@storybook/addon-vitest',
28
+ getAbsolutePath("@storybook/addon-a11y"),
29
+ getAbsolutePath("@storybook/addon-vitest"),
27
30
  ],
28
31
  framework: {
29
- name: '@storybook/react-native-web-vite',
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-reanimated/plugin',
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
+ }
@@ -1,4 +1,4 @@
1
1
 
2
- > @utilitywarehouse/hearth-react-native@0.5.0 build /home/runner/work/hearth/hearth/packages/react-native
2
+ > @utilitywarehouse/hearth-react-native@0.7.0 build /home/runner/work/hearth/hearth/packages/react-native
3
3
  > tsc
4
4
 
@@ -1,5 +1,5 @@
1
1
 
2
- > @utilitywarehouse/hearth-react-native@0.5.0 lint /home/runner/work/hearth/hearth/packages/react-native
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 unistyles error
9
+ // @ts-expect-error - style prop type issue
10
10
  , {
11
- // @ts-expect-error - style unistyles error
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
- ? StyleSheet.compose(styles.icon, props.style)
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 { useCardActionContext } from '../Card';
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 } = useCardActionContext();
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,
@@ -15,7 +15,10 @@ const styles = StyleSheet.create(theme => ({
15
15
  emphasis: {},
16
16
  solid: {},
17
17
  outline: {},
18
- ghost: {},
18
+ ghost: {
19
+ textDecorationStyle: 'solid',
20
+ textDecorationLine: 'underline',
21
+ },
19
22
  },
20
23
  colorScheme: {
21
24
  highlight: {},
@@ -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,7 @@
1
+ import { createPressable } from '@gluestack-ui/pressable';
2
+ import CardActionRoot from './CardActionRoot';
3
+ const CardAction = createPressable({
4
+ Root: CardActionRoot,
5
+ });
6
+ CardAction.displayName = 'CardAction';
7
+ 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,6 @@
1
+ import { type ViewProps } from 'react-native';
2
+ declare const CardActionContent: {
3
+ ({ children, ...props }: ViewProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default CardActionContent;
@@ -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,6 @@
1
+ import { TextProps } from 'react-native';
2
+ declare const CardActionHelperText: {
3
+ ({ children, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default CardActionHelperText;
@@ -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,6 @@
1
+ import { type ViewProps } from 'react-native';
2
+ declare const CardActionLeadingContent: {
3
+ ({ children, ...props }: ViewProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default CardActionLeadingContent;
@@ -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,6 @@
1
+ import { TextProps } from 'react-native';
2
+ declare const CardActionText: {
3
+ ({ children, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default CardActionText;
@@ -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,6 @@
1
+ import { type ViewProps } from 'react-native';
2
+ declare const CardActionTrailingContent: {
3
+ ({ children, ...props }: ViewProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default CardActionTrailingContent;
@@ -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;