@utilitywarehouse/hearth-react-native 0.10.0 → 0.12.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 (132) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/CHANGELOG.md +18 -0
  4. package/build/components/Avatar/Avatar.d.ts +6 -0
  5. package/build/components/Avatar/Avatar.js +80 -0
  6. package/build/components/Avatar/Avatar.props.d.ts +28 -0
  7. package/build/components/Avatar/Avatar.props.js +1 -0
  8. package/build/components/Avatar/index.d.ts +2 -0
  9. package/build/components/Avatar/index.js +1 -0
  10. package/build/components/Banner/Banner.context.d.ts +7 -0
  11. package/build/components/Banner/Banner.context.js +8 -0
  12. package/build/components/Banner/Banner.js +10 -40
  13. package/build/components/Banner/Banner.props.d.ts +3 -5
  14. package/build/components/Banner/BannerIllustration.d.ts +4 -0
  15. package/build/components/Banner/BannerIllustration.js +53 -0
  16. package/build/components/Banner/BannerImage.d.ts +4 -0
  17. package/build/components/Banner/BannerImage.js +53 -0
  18. package/build/components/Banner/index.d.ts +2 -0
  19. package/build/components/Banner/index.js +2 -0
  20. package/build/components/Card/CardAction/CardAction.props.d.ts +2 -3
  21. package/build/components/Card/CardAction/CardActionRoot.js +1 -2
  22. package/build/components/Checkbox/Checkbox.js +1 -2
  23. package/build/components/Checkbox/Checkbox.props.d.ts +3 -3
  24. package/build/components/Checkbox/CheckboxImage.d.ts +2 -1
  25. package/build/components/Checkbox/CheckboxImage.js +8 -1
  26. package/build/components/DateInput/DateInput.d.ts +6 -0
  27. package/build/components/DateInput/DateInput.js +19 -0
  28. package/build/components/DateInput/DateInput.props.d.ts +79 -0
  29. package/build/components/DateInput/DateInput.props.js +1 -0
  30. package/build/components/DateInput/DateInputSegment.d.ts +20 -0
  31. package/build/components/DateInput/DateInputSegment.js +31 -0
  32. package/build/components/DateInput/index.d.ts +2 -0
  33. package/build/components/DateInput/index.js +1 -0
  34. package/build/components/ExpandableCard/ExpandableCard.props.d.ts +1 -2
  35. package/build/components/ExpandableCard/ExpandableCardTrigger.props.d.ts +4 -5
  36. package/build/components/ExpandableCard/ExpandableCardTriggerRoot.js +1 -14
  37. package/build/components/HighlightBanner/HighlightBanner.js +2 -6
  38. package/build/components/HighlightBanner/HighlightBanner.props.d.ts +2 -3
  39. package/build/components/HighlightBanner/HighlightBannerImage.d.ts +4 -0
  40. package/build/components/HighlightBanner/HighlightBannerImage.js +18 -0
  41. package/build/components/HighlightBanner/index.d.ts +1 -0
  42. package/build/components/HighlightBanner/index.js +1 -0
  43. package/build/components/Input/Input.d.ts +5 -7
  44. package/build/components/Input/Input.js +11 -4
  45. package/build/components/Input/InputField.d.ts +4 -7
  46. package/build/components/Input/InputField.js +6 -5
  47. package/build/components/List/ListItem/ListItem.props.d.ts +2 -2
  48. package/build/components/List/ListItem/ListItemRoot.js +1 -2
  49. package/build/components/Modal/Modal.js +2 -6
  50. package/build/components/Modal/Modal.props.d.ts +3 -2
  51. package/build/components/Modal/Modal.web.js +2 -6
  52. package/build/components/Modal/ModalImage.d.ts +4 -0
  53. package/build/components/Modal/ModalImage.js +18 -0
  54. package/build/components/Modal/index.d.ts +1 -0
  55. package/build/components/Modal/index.js +1 -0
  56. package/build/components/Radio/Radio.js +1 -2
  57. package/build/components/Radio/Radio.props.d.ts +3 -3
  58. package/build/components/Radio/RadioImage.d.ts +2 -1
  59. package/build/components/Radio/RadioImage.js +8 -1
  60. package/build/components/index.d.ts +2 -0
  61. package/build/components/index.js +2 -0
  62. package/build/utils/getInitials.d.ts +1 -0
  63. package/build/utils/getInitials.js +8 -0
  64. package/build/utils/index.d.ts +2 -0
  65. package/build/utils/index.js +2 -0
  66. package/build/utils/isThemedImageProps.d.ts +4 -0
  67. package/build/utils/isThemedImageProps.js +4 -0
  68. package/docs/components/AllComponents.web.tsx +18 -1
  69. package/package.json +2 -2
  70. package/src/components/Avatar/Avatar.docs.mdx +105 -0
  71. package/src/components/Avatar/Avatar.props.ts +31 -0
  72. package/src/components/Avatar/Avatar.stories.tsx +77 -0
  73. package/src/components/Avatar/Avatar.tsx +136 -0
  74. package/src/components/Avatar/index.ts +2 -0
  75. package/src/components/Banner/Banner.context.ts +11 -0
  76. package/src/components/Banner/Banner.docs.mdx +55 -37
  77. package/src/components/Banner/Banner.props.ts +3 -5
  78. package/src/components/Banner/Banner.stories.tsx +86 -57
  79. package/src/components/Banner/Banner.tsx +24 -67
  80. package/src/components/Banner/BannerIllustration.tsx +63 -0
  81. package/src/components/Banner/BannerImage.tsx +63 -0
  82. package/src/components/Banner/index.ts +2 -0
  83. package/src/components/Card/Card.docs.mdx +4 -4
  84. package/src/components/Card/CardAction/CardAction.props.ts +2 -3
  85. package/src/components/Card/CardAction/CardAction.stories.tsx +4 -3
  86. package/src/components/Card/CardAction/CardActionRoot.tsx +4 -5
  87. package/src/components/Checkbox/Checkbox.docs.mdx +23 -4
  88. package/src/components/Checkbox/Checkbox.props.ts +3 -3
  89. package/src/components/Checkbox/Checkbox.stories.tsx +14 -8
  90. package/src/components/Checkbox/Checkbox.tsx +1 -2
  91. package/src/components/Checkbox/CheckboxImage.tsx +8 -3
  92. package/src/components/DateInput/DateInput.docs.mdx +163 -0
  93. package/src/components/DateInput/DateInput.props.ts +80 -0
  94. package/src/components/DateInput/DateInput.stories.tsx +269 -0
  95. package/src/components/DateInput/DateInput.tsx +117 -0
  96. package/src/components/DateInput/DateInputSegment.tsx +83 -0
  97. package/src/components/DateInput/index.ts +2 -0
  98. package/src/components/ExpandableCard/ExpandableCard.docs.mdx +2 -2
  99. package/src/components/ExpandableCard/ExpandableCard.props.ts +1 -2
  100. package/src/components/ExpandableCard/ExpandableCard.stories.tsx +3 -3
  101. package/src/components/ExpandableCard/ExpandableCardTrigger.props.ts +4 -5
  102. package/src/components/ExpandableCard/ExpandableCardTriggerRoot.tsx +2 -17
  103. package/src/components/HighlightBanner/HighlightBanner.docs.mdx +73 -42
  104. package/src/components/HighlightBanner/HighlightBanner.props.ts +2 -3
  105. package/src/components/HighlightBanner/HighlightBanner.stories.tsx +85 -60
  106. package/src/components/HighlightBanner/HighlightBanner.tsx +3 -10
  107. package/src/components/HighlightBanner/HighlightBannerImage.tsx +20 -0
  108. package/src/components/HighlightBanner/index.ts +1 -0
  109. package/src/components/Input/Input.stories.tsx +76 -3
  110. package/src/components/Input/Input.tsx +110 -98
  111. package/src/components/Input/InputField.tsx +27 -26
  112. package/src/components/List/List.docs.mdx +15 -9
  113. package/src/components/List/List.stories.tsx +2 -2
  114. package/src/components/List/ListItem/ListItem.props.ts +2 -2
  115. package/src/components/List/ListItem/ListItemRoot.tsx +2 -3
  116. package/src/components/Modal/Modal.docs.mdx +16 -4
  117. package/src/components/Modal/Modal.props.ts +3 -2
  118. package/src/components/Modal/Modal.stories.tsx +2 -5
  119. package/src/components/Modal/Modal.tsx +2 -6
  120. package/src/components/Modal/Modal.web.tsx +2 -6
  121. package/src/components/Modal/ModalImage.tsx +20 -0
  122. package/src/components/Modal/index.ts +1 -0
  123. package/src/components/PillGroup/PillGroup.stories.tsx +1 -1
  124. package/src/components/Radio/Radio.docs.mdx +21 -8
  125. package/src/components/Radio/Radio.props.ts +3 -3
  126. package/src/components/Radio/Radio.stories.tsx +15 -11
  127. package/src/components/Radio/Radio.tsx +1 -2
  128. package/src/components/Radio/RadioImage.tsx +8 -3
  129. package/src/components/index.ts +2 -0
  130. package/src/utils/getInitials.ts +7 -0
  131. package/src/utils/index.ts +2 -0
  132. package/src/utils/isThemedImageProps.ts +8 -0
@@ -1,4 +1,4 @@
1
1
 
2
- > @utilitywarehouse/hearth-react-native@0.10.0 build /home/runner/work/hearth/hearth/packages/react-native
2
+ > @utilitywarehouse/hearth-react-native@0.12.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.10.0 lint /home/runner/work/hearth/hearth/packages/react-native
2
+ > @utilitywarehouse/hearth-react-native@0.12.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,23 @@
1
1
  # @utilitywarehouse/hearth-react-native
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#685](https://github.com/utilitywarehouse/hearth/pull/685) [`10f5209`](https://github.com/utilitywarehouse/hearth/commit/10f52095e5f36e58f9821e3fec3fdf43f4578fbb) Thanks [@jordmccord](https://github.com/jordmccord)! - [BREAKING] Component props moved from objects to React Nodes
8
+
9
+ ### Patch Changes
10
+
11
+ - [#687](https://github.com/utilitywarehouse/hearth/pull/687) [`11e8176`](https://github.com/utilitywarehouse/hearth/commit/11e8176ced40b0a8b2d27e07c482ed10a7b7ce7a) Thanks [@jordmccord](https://github.com/jordmccord)! - Fixes `Input` refs
12
+
13
+ ## 0.11.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#674](https://github.com/utilitywarehouse/hearth/pull/674) [`c617257`](https://github.com/utilitywarehouse/hearth/commit/c617257974b11c39d706d6fd46712a284ff5fe10) Thanks [@jordmccord](https://github.com/jordmccord)! - Adds `DateInput` component
18
+
19
+ - [#663](https://github.com/utilitywarehouse/hearth/pull/663) [`8889a07`](https://github.com/utilitywarehouse/hearth/commit/8889a07e347e9289928e679cee495d7656a4e9aa) Thanks [@Utakato](https://github.com/Utakato)! - Add Avatar component
20
+
3
21
  ## 0.10.0
4
22
 
5
23
  ### Minor Changes
@@ -0,0 +1,6 @@
1
+ import AvatarProps from './Avatar.props';
2
+ declare const Avatar: {
3
+ ({ src, name, size, delayMs, onLoadingStatusChange, style, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default Avatar;
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { UserMediumIcon, UserSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
3
+ import { useEffect, useState } from 'react';
4
+ import { Image, View } from 'react-native';
5
+ import { StyleSheet } from 'react-native-unistyles';
6
+ import { useTheme } from '../../hooks';
7
+ import { getInitials } from '../../utils';
8
+ import BodyText from '../BodyText/BodyText';
9
+ const Avatar = ({ src, name, size = 'md', delayMs = 0, onLoadingStatusChange, style, ...props }) => {
10
+ const [status, setStatus] = useState('idle');
11
+ const [isDelayed, setIsDelayed] = useState(delayMs > 0);
12
+ const { components } = useTheme();
13
+ useEffect(() => {
14
+ if (!src) {
15
+ setStatus('idle');
16
+ return;
17
+ }
18
+ setStatus('loading');
19
+ }, [src]);
20
+ useEffect(() => {
21
+ onLoadingStatusChange?.(status);
22
+ }, [status, onLoadingStatusChange]);
23
+ useEffect(() => {
24
+ if (delayMs <= 0) {
25
+ setIsDelayed(false);
26
+ return;
27
+ }
28
+ const timerId = setTimeout(() => {
29
+ setIsDelayed(false);
30
+ }, delayMs);
31
+ return () => clearTimeout(timerId);
32
+ }, [delayMs]);
33
+ styles.useVariants({ size });
34
+ const initials = getInitials(name);
35
+ const handleLoad = () => setStatus('loaded');
36
+ const handleError = () => setStatus('error');
37
+ const showImage = src && status === 'loaded';
38
+ const showFallback = !showImage && !isDelayed;
39
+ const textSize = size === 'sm' ? 'md' : 'lg';
40
+ const FallbackIcon = size === 'sm' ? UserSmallIcon : UserMediumIcon;
41
+ return (_jsxs(View, { ...props, style: [styles.container, style], accessibilityRole: showImage && name ? 'image' : undefined, accessibilityLabel: showImage ? name : undefined, children: [src && (_jsx(Image, { source: src, style: styles.image, onLoad: handleLoad, onError: handleError, accessibilityElementsHidden: true })), showFallback && (_jsx(View, { style: styles.fallback, children: name ? (_jsx(BodyText, { size: textSize, weight: "semibold", textTransform: "uppercase", style: styles.text, children: initials })) : (_jsx(FallbackIcon, {})) }))] }));
42
+ };
43
+ Avatar.displayName = 'Avatar';
44
+ const styles = StyleSheet.create(theme => ({
45
+ container: {
46
+ justifyContent: 'center',
47
+ alignItems: 'center',
48
+ overflow: 'hidden',
49
+ backgroundColor: theme.color.surface.pig.subtle,
50
+ variants: {
51
+ size: {
52
+ sm: {
53
+ width: theme.components.avatar.sm.width,
54
+ height: theme.components.avatar.sm.height,
55
+ borderRadius: theme.components.avatar.sm.borderRadius,
56
+ },
57
+ md: {
58
+ width: theme.components.avatar.md.width,
59
+ height: theme.components.avatar.md.height,
60
+ borderRadius: theme.components.avatar.md.borderRadius,
61
+ },
62
+ },
63
+ },
64
+ },
65
+ image: {
66
+ width: '100%',
67
+ height: '100%',
68
+ position: 'absolute',
69
+ },
70
+ fallback: {
71
+ width: '100%',
72
+ height: '100%',
73
+ justifyContent: 'center',
74
+ alignItems: 'center',
75
+ },
76
+ text: {
77
+ color: theme.color.text.primary,
78
+ },
79
+ }));
80
+ export default Avatar;
@@ -0,0 +1,28 @@
1
+ import type { ImageSourcePropType, ViewProps } from 'react-native';
2
+ export type AvatarLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
3
+ interface AvatarProps extends ViewProps {
4
+ /**
5
+ * The image source to display.
6
+ */
7
+ src?: ImageSourcePropType;
8
+ /**
9
+ * The name associated with the avatar, used for creating initials and accessibility label.
10
+ */
11
+ name?: string;
12
+ /**
13
+ * Sets the avatar size.
14
+ * @default md
15
+ */
16
+ size?: 'sm' | 'md';
17
+ /**
18
+ * Delay in milliseconds before the image is rendered.
19
+ * Useful to prevent flickering when the image loads very quickly.
20
+ * @default 0
21
+ */
22
+ delayMs?: number;
23
+ /**
24
+ * Callback fired when the loading status of the image changes.
25
+ */
26
+ onLoadingStatusChange?: (status: AvatarLoadingStatus) => void;
27
+ }
28
+ export default AvatarProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as Avatar } from './Avatar';
2
+ export type { default as AvatarProps, AvatarLoadingStatus } from './Avatar.props';
@@ -0,0 +1 @@
1
+ export { default as Avatar } from './Avatar';
@@ -0,0 +1,7 @@
1
+ declare const BannerContext: import("react").Context<{
2
+ direction: "horizontal" | "vertical";
3
+ }>;
4
+ export declare const useBannerContext: () => {
5
+ direction: "horizontal" | "vertical";
6
+ };
7
+ export default BannerContext;
@@ -0,0 +1,8 @@
1
+ import { createContext, useContext } from 'react';
2
+ const BannerContext = createContext({
3
+ direction: 'horizontal',
4
+ });
5
+ export const useBannerContext = () => {
6
+ return useContext(BannerContext);
7
+ };
8
+ export default BannerContext;
@@ -1,34 +1,29 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChevronRightSmallIcon, CloseSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
3
- import { Image, Pressable, View } from 'react-native';
3
+ import { useMemo } from 'react';
4
+ import { Pressable, View } from 'react-native';
4
5
  import { StyleSheet } from 'react-native-unistyles';
5
6
  import { BodyText } from '../BodyText';
6
7
  import { Card } from '../Card';
7
8
  import { Heading } from '../Heading';
8
9
  import { IconContainer } from '../IconContainer';
9
- import { ThemedImage } from '../ThemedImage';
10
10
  import { UnstyledIconButton } from '../UnstyledIconButton';
11
- const isThemedImageProps = (props) => {
12
- return 'light' in props && 'dark' in props;
13
- };
11
+ import BannerContext from './Banner.context';
14
12
  const Banner = ({ icon, iconContainerVariant = 'subtle', iconContainerSize = 'md', iconContainerColor = 'pig', illustration, image, heading, description, direction = 'horizontal', link, button, onPress, onClose, variant = 'subtle', colorScheme = 'pig', style, ...props }) => {
15
13
  const hasIllustration = Boolean(illustration);
16
14
  styles.useVariants({ direction, hasIllustration });
15
+ const context = useMemo(() => ({
16
+ direction,
17
+ }), [direction]);
17
18
  const renderIconOrImage = () => {
18
19
  if (icon) {
19
20
  return (_jsx(IconContainer, { icon: icon, variant: iconContainerVariant, size: iconContainerSize, color: iconContainerColor, style: styles.media }));
20
21
  }
21
22
  if (illustration) {
22
- if (isThemedImageProps(illustration)) {
23
- return (_jsx(ThemedImage, { ...illustration, resizeMode: "cover", style: [styles.media, styles.imageWrapper, illustration.style] }));
24
- }
25
- return (_jsx(Image, { ...illustration, resizeMode: "cover", style: [styles.media, styles.imageWrapper, illustration.style] }));
23
+ return illustration;
26
24
  }
27
25
  if (image) {
28
- if (isThemedImageProps(image)) {
29
- return (_jsx(View, { style: [styles.media, styles.imageWrapper], children: _jsx(ThemedImage, { ...image, style: [styles.image, image.style] }) }));
30
- }
31
- return (_jsx(View, { style: [styles.media, styles.imageWrapper], children: _jsx(Image, { ...image, style: [styles.image, image.style] }) }));
26
+ return image;
32
27
  }
33
28
  return null;
34
29
  };
@@ -43,9 +38,9 @@ const Banner = ({ icon, iconContainerVariant = 'subtle', iconContainerSize = 'md
43
38
  };
44
39
  const content = (_jsxs(View, { style: styles.container, children: [onClose && direction === 'vertical' && (_jsx(UnstyledIconButton, { icon: CloseSmallIcon, size: "sm", onPress: onClose, style: styles.closeButton, accessibilityLabel: "Close banner" })), renderIconOrImage(), _jsxs(View, { style: styles.contentContainer, children: [_jsxs(View, { style: styles.contentTextContainer, children: [_jsxs(View, { style: styles.textContainer, children: [_jsx(Heading, { size: "sm", style: styles.heading, textAlign: hasIllustration && direction === 'vertical' ? 'center' : 'left', children: heading }), _jsx(BodyText, { size: "md", style: styles.description, textAlign: hasIllustration && direction === 'vertical' ? 'center' : 'left', children: description })] }), renderAction()] }), onPress && (_jsx(UnstyledIconButton, { icon: ChevronRightSmallIcon, size: "sm", onPress: onPress, style: styles.chevron })), onClose && direction === 'horizontal' && (_jsx(UnstyledIconButton, { icon: CloseSmallIcon, size: "sm", onPress: onClose, style: styles.closeButton, accessibilityLabel: "Close banner" }))] })] }));
45
40
  if (onPress) {
46
- return (_jsx(Card, { variant: variant, style: [styles.card, style], ...props, children: _jsx(Pressable, { onPress: onPress, accessibilityRole: "button", style: styles.pressable, children: content }) }));
41
+ return (_jsx(BannerContext.Provider, { value: context, children: _jsx(Card, { variant: variant, style: [styles.card, style], ...props, children: _jsx(Pressable, { onPress: onPress, accessibilityRole: "button", style: styles.pressable, children: content }) }) }));
47
42
  }
48
- return (_jsx(Card, { variant: variant, style: [styles.card, style], ...props, children: content }));
43
+ return (_jsx(BannerContext.Provider, { value: context, children: _jsx(Card, { variant: variant, style: [styles.card, style], ...props, children: content }) }));
49
44
  };
50
45
  Banner.displayName = 'Banner';
51
46
  const styles = StyleSheet.create(theme => ({
@@ -100,31 +95,6 @@ const styles = StyleSheet.create(theme => ({
100
95
  },
101
96
  },
102
97
  },
103
- imageWrapper: {
104
- flexDirection: 'row',
105
- variants: {
106
- direction: {
107
- horizontal: {},
108
- vertical: {
109
- width: '100%',
110
- },
111
- },
112
- },
113
- },
114
- image: {
115
- borderRadius: theme.borderRadius.md,
116
- borderColor: theme.color.border.strong,
117
- borderWidth: theme.borderWidth[1],
118
- variants: {
119
- direction: {
120
- horizontal: { width: 160, height: 95 },
121
- vertical: {
122
- width: '100%',
123
- height: 160,
124
- },
125
- },
126
- },
127
- },
128
98
  contentContainer: {
129
99
  alignItems: 'flex-start',
130
100
  justifyContent: 'space-between',
@@ -1,7 +1,5 @@
1
- import type { ComponentType, ReactElement } from 'react';
2
- import { ImageProps } from 'react-native';
1
+ import type { ComponentType, ReactElement, ReactNode } from 'react';
3
2
  import type CardProps from '../Card/Card.props';
4
- import { ThemedImageProps } from '../ThemedImage';
5
3
  export type BannerDirection = 'horizontal' | 'vertical';
6
4
  export interface BannerProps extends Omit<CardProps, 'noPadding' | 'variant' | 'colorScheme' | 'space' | 'gap' | 'rowGap' | 'columnGap' | 'flexDirection' | 'flexWrap' | 'alignItems' | 'justifyContent'> {
7
5
  /**
@@ -28,12 +26,12 @@ export interface BannerProps extends Omit<CardProps, 'noPadding' | 'variant' | '
28
26
  * Illustration to display in the banner
29
27
  * Mutually exclusive with icon and image
30
28
  */
31
- illustration?: ThemedImageProps | ImageProps;
29
+ illustration?: ReactNode;
32
30
  /**
33
31
  * Image to display in the banner
34
32
  * Mutually exclusive with icon and illustration
35
33
  */
36
- image?: ThemedImageProps | ImageProps;
34
+ image?: ReactNode;
37
35
  /**
38
36
  * Heading text
39
37
  */
@@ -0,0 +1,4 @@
1
+ import { ImageProps } from 'react-native';
2
+ import { ThemedImageProps } from '../ThemedImage';
3
+ declare const BannerIllustration: (props: ImageProps | ThemedImageProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default BannerIllustration;
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Image, View } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
+ import { isThemedImageProps } from '../../utils';
5
+ import { ThemedImage } from '../ThemedImage';
6
+ import { useBannerContext } from './Banner.context';
7
+ const BannerIllustration = (props) => {
8
+ const { direction } = useBannerContext();
9
+ styles.useVariants({ direction });
10
+ if (isThemedImageProps(props)) {
11
+ return (_jsx(View, { style: [styles.media, styles.imageWrapper], children: _jsx(ThemedImage, { ...props, style: [styles.image, props.style] }) }));
12
+ }
13
+ return (_jsx(View, { style: [styles.media, styles.imageWrapper], children: _jsx(Image, { ...props, style: [styles.image, props.style] }) }));
14
+ };
15
+ const styles = StyleSheet.create(theme => ({
16
+ media: {
17
+ flexShrink: 0,
18
+ variants: {
19
+ direction: {
20
+ horizontal: {},
21
+ vertical: {
22
+ alignSelf: 'flex-start',
23
+ },
24
+ },
25
+ },
26
+ },
27
+ imageWrapper: {
28
+ flexDirection: 'row',
29
+ variants: {
30
+ direction: {
31
+ horizontal: {},
32
+ vertical: {
33
+ width: '100%',
34
+ },
35
+ },
36
+ },
37
+ },
38
+ image: {
39
+ borderRadius: theme.borderRadius.md,
40
+ borderColor: theme.color.border.strong,
41
+ borderWidth: theme.borderWidth[1],
42
+ variants: {
43
+ direction: {
44
+ horizontal: { width: 160, height: 95 },
45
+ vertical: {
46
+ width: '100%',
47
+ height: 160,
48
+ },
49
+ },
50
+ },
51
+ },
52
+ }));
53
+ export default BannerIllustration;
@@ -0,0 +1,4 @@
1
+ import { ImageProps } from 'react-native';
2
+ import { ThemedImageProps } from '../ThemedImage';
3
+ declare const BannerImage: (props: ImageProps | ThemedImageProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default BannerImage;
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Image, View } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
+ import { isThemedImageProps } from '../../utils';
5
+ import { ThemedImage } from '../ThemedImage';
6
+ import { useBannerContext } from './Banner.context';
7
+ const BannerImage = (props) => {
8
+ const { direction } = useBannerContext();
9
+ styles.useVariants({ direction });
10
+ if (isThemedImageProps(props)) {
11
+ return (_jsx(View, { style: [styles.media, styles.imageWrapper], children: _jsx(ThemedImage, { ...props, style: [styles.image, props.style] }) }));
12
+ }
13
+ return (_jsx(View, { style: [styles.media, styles.imageWrapper], children: _jsx(Image, { ...props, style: [styles.image, props.style] }) }));
14
+ };
15
+ const styles = StyleSheet.create(theme => ({
16
+ media: {
17
+ flexShrink: 0,
18
+ variants: {
19
+ direction: {
20
+ horizontal: {},
21
+ vertical: {
22
+ alignSelf: 'flex-start',
23
+ },
24
+ },
25
+ },
26
+ },
27
+ imageWrapper: {
28
+ flexDirection: 'row',
29
+ variants: {
30
+ direction: {
31
+ horizontal: {},
32
+ vertical: {
33
+ width: '100%',
34
+ },
35
+ },
36
+ },
37
+ },
38
+ image: {
39
+ borderRadius: theme.borderRadius.md,
40
+ borderColor: theme.color.border.strong,
41
+ borderWidth: theme.borderWidth[1],
42
+ variants: {
43
+ direction: {
44
+ horizontal: { width: 160, height: 95 },
45
+ vertical: {
46
+ width: '100%',
47
+ height: 160,
48
+ },
49
+ },
50
+ },
51
+ },
52
+ }));
53
+ export default BannerImage;
@@ -1,2 +1,4 @@
1
1
  export { default as Banner } from './Banner';
2
2
  export type { default as BannerProps } from './Banner.props';
3
+ export { default as BannerIllustration } from './BannerIllustration';
4
+ export { default as BannerImage } from './BannerImage';
@@ -1 +1,3 @@
1
1
  export { default as Banner } from './Banner';
2
+ export { default as BannerIllustration } from './BannerIllustration';
3
+ export { default as BannerImage } from './BannerImage';
@@ -1,6 +1,5 @@
1
- import { ComponentType } from 'react';
1
+ import { ComponentType, ReactNode } from 'react';
2
2
  import type { PressableProps, ViewProps } from 'react-native';
3
- import BadgeProps from '../../Badge/Badge.props';
4
3
  import { IconContainerProps } from '../../IconContainer';
5
4
  interface CardActionBaseProps extends Omit<PressableProps, 'children'> {
6
5
  loading?: boolean;
@@ -10,7 +9,7 @@ interface CardActionBaseProps extends Omit<PressableProps, 'children'> {
10
9
  interface CardActionContentProps {
11
10
  heading: string;
12
11
  helperText?: string;
13
- badge?: BadgeProps;
12
+ badge?: ReactNode;
14
13
  badgePosition?: 'bottom' | 'middle' | 'right' | 'top';
15
14
  iconContainer?: boolean;
16
15
  iconContainerVariant?: IconContainerProps['variant'];
@@ -3,7 +3,6 @@ import { ChevronRightSmallIcon } from '@utilitywarehouse/hearth-react-native-ico
3
3
  import { useMemo } from 'react';
4
4
  import { Pressable, View } from 'react-native';
5
5
  import { StyleSheet } from 'react-native-unistyles';
6
- import { Badge } from '../../Badge';
7
6
  import { IconContainer } from '../../IconContainer';
8
7
  import { Skeleton } from '../../Skeleton';
9
8
  import { useCardContext } from '../Card.context';
@@ -46,7 +45,7 @@ const CardActionRoot = ({ heading, helperText, leadingContent, trailingContent,
46
45
  if (loading) {
47
46
  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
47
  }
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] })] })) }) }));
48
+ 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 ? badge : null, _jsx(CardActionText, { children: heading }), badgePosition === 'middle' && badge ? badge : null, helperText ? _jsx(CardActionHelperText, { children: helperText }) : null, badgePosition === 'bottom' && badge ? badge : null] }), badgePosition === 'right' && badge ? (_jsx(View, { style: styles.alignCenter, children: badge })) : null, trailingContent ? (_jsx(CardActionTrailingContent, { children: trailingContent })) : null, trailingIcon && !trailingContent ? (_jsx(CardActionTrailingContent, { children: _jsx(CardActionTrailingIcon, { as: trailingIcon }) })) : null] })] })) }) }));
50
49
  };
51
50
  CardActionRoot.displayName = 'CardActionRoot';
52
51
  const styles = StyleSheet.create(theme => ({
@@ -5,7 +5,6 @@ import { Helper } from '../Helper';
5
5
  import { useCheckboxGroupContext } from './CheckboxGroup.context';
6
6
  import StyledCheckboxGroup from './CheckboxGroupRoot';
7
7
  import StyledCheckboxIcon from './CheckboxIcon';
8
- import CheckboxImage from './CheckboxImage';
9
8
  import StyledCheckboxIndicator from './CheckboxIndicator';
10
9
  import StyledCheckboxLabel from './CheckboxLabel';
11
10
  import StyledCheckbox from './CheckboxRoot';
@@ -31,7 +30,7 @@ const Checkbox = ({ children, label, disabled, checked, helperIcon, helperText,
31
30
  const { validationStatus: groupValidationStatus, type: groupType } = useCheckboxGroupContext();
32
31
  const validationStatus = fieldValidationStatus ?? groupValidationStatus ?? validation ?? 'initial';
33
32
  const checkboxType = groupType ?? type;
34
- const checkboxChildren = children ? (children) : (_jsxs(_Fragment, { children: [_jsx(CheckboxIndicator, { children: _jsx(CheckboxIcon, {}) }), image ? _jsx(CheckboxImage, { ...image }) : null, _jsxs(CheckboxTextContent, { children: [!!label && _jsx(CheckboxLabel, { children: label }), !!helperText && _jsx(Helper, { disabled: disabled, icon: helperIcon, text: helperText }), validationStatus === 'invalid' && !!invalidText && (_jsx(Helper, { showIcon: showValidationIcon, disabled: disabled, validationStatus: "invalid", text: invalidText })), validationStatus === 'valid' && !!validText && (_jsx(Helper, { disabled: disabled, showIcon: showValidationIcon, validationStatus: "valid", text: validText }))] })] }));
33
+ const checkboxChildren = children ? (children) : (_jsxs(_Fragment, { children: [_jsx(CheckboxIndicator, { children: _jsx(CheckboxIcon, {}) }), image ? image : null, _jsxs(CheckboxTextContent, { children: [!!label && _jsx(CheckboxLabel, { children: label }), !!helperText && _jsx(Helper, { disabled: disabled, icon: helperIcon, text: helperText }), validationStatus === 'invalid' && !!invalidText && (_jsx(Helper, { showIcon: showValidationIcon, disabled: disabled, validationStatus: "invalid", text: invalidText })), validationStatus === 'valid' && !!validText && (_jsx(Helper, { disabled: disabled, showIcon: showValidationIcon, validationStatus: "valid", text: validText }))] })] }));
35
34
  return (
36
35
  // @ts-expect-error - type
37
36
  _jsx(CheckboxComponent, { ...props, isDisabled: disabled, isChecked: checked, children: checkboxType === 'tile' ? (_jsx(CheckboxTileRoot, { children: checkboxChildren })) : (checkboxChildren) }));
@@ -1,5 +1,5 @@
1
- import type { ComponentType } from 'react';
2
- import type { ImageProps, PressableProps, ViewProps } from 'react-native';
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import type { PressableProps, ViewProps } from 'react-native';
3
3
  type CheckboxBaseProps = {
4
4
  onChange?: (isSelected: boolean) => void;
5
5
  disabled?: boolean;
@@ -30,7 +30,7 @@ type CheckboxWithoutChildrenProps = {
30
30
  invalidText?: string;
31
31
  validText?: string;
32
32
  showValidationIcon?: boolean;
33
- image?: ImageProps;
33
+ image?: ReactNode;
34
34
  } & CheckboxBaseProps;
35
35
  type CheckboxProps = CheckboxWithChildrenProps | CheckboxWithoutChildrenProps;
36
36
  export default CheckboxProps;
@@ -1,6 +1,7 @@
1
1
  import { ImageProps } from 'react-native';
2
+ import { ThemedImageProps } from '../ThemedImage';
2
3
  declare const CheckboxImage: {
3
- ({ source, style, ...props }: ImageProps): import("react/jsx-runtime").JSX.Element;
4
+ ({ ...props }: ImageProps | ThemedImageProps): import("react/jsx-runtime").JSX.Element;
4
5
  displayName: string;
5
6
  };
6
7
  export default CheckboxImage;
@@ -1,5 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Image } from 'react-native';
3
- const CheckboxImage = ({ source, style, ...props }) => (_jsx(Image, { source: source, style: style, ...props }));
3
+ import { isThemedImageProps } from '../../utils';
4
+ import { ThemedImage } from '../ThemedImage';
5
+ const CheckboxImage = ({ ...props }) => {
6
+ if (isThemedImageProps(props)) {
7
+ return _jsx(ThemedImage, { ...props });
8
+ }
9
+ return _jsx(Image, { ...props });
10
+ };
4
11
  CheckboxImage.displayName = 'CheckboxImage';
5
12
  export default CheckboxImage;
@@ -0,0 +1,6 @@
1
+ import type { DateInputProps } from './DateInput.props';
2
+ declare const DateInput: {
3
+ ({ label, helperText, helperIcon, validationStatus, validText, invalidText, disabled, readonly, required, hideDay, hideMonth, hideYear, dayPlaceholder, monthPlaceholder, yearPlaceholder, dayValue, monthValue, yearValue, onDayChange, onMonthChange, onYearChange, onDayFocus, onMonthFocus, onYearFocus, onDayBlur, onMonthBlur, onYearBlur, ...props }: DateInputProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default DateInput;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
+ import { FormField } from '../FormField';
5
+ import DateInputSegment from './DateInputSegment';
6
+ const DateInput = ({ label, helperText, helperIcon, validationStatus = 'initial', validText, invalidText, disabled, readonly, required, hideDay = false, hideMonth = false, hideYear = false, dayPlaceholder = 'DD', monthPlaceholder = 'MM', yearPlaceholder = 'YYYY', dayValue, monthValue, yearValue, onDayChange, onMonthChange, onYearChange, onDayFocus, onMonthFocus, onYearFocus, onDayBlur, onMonthBlur, onYearBlur, ...props }) => {
7
+ return (_jsx(FormField, { label: label, helperText: helperText, helperIcon: helperIcon, validationStatus: validationStatus, validText: validText, invalidText: invalidText, disabled: disabled, readonly: readonly, required: required, style: styles.wrap, ...props, children: _jsxs(View, { style: styles.container, children: [!hideDay && (_jsx(DateInputSegment, { label: "Day", placeholder: dayPlaceholder, value: dayValue, onChange: onDayChange, onFocus: onDayFocus, onBlur: onDayBlur, disabled: disabled, required: required, readonly: readonly, validationStatus: validationStatus, maxLength: 2, testID: "date-input-day" })), !hideMonth && (_jsx(DateInputSegment, { label: "Month", placeholder: monthPlaceholder, value: monthValue, onChange: onMonthChange, onFocus: onMonthFocus, onBlur: onMonthBlur, disabled: disabled, required: required, readonly: readonly, validationStatus: validationStatus, maxLength: 2, testID: "date-input-month" })), !hideYear && (_jsx(DateInputSegment, { label: "Year", placeholder: yearPlaceholder, value: yearValue, onChange: onYearChange, onFocus: onYearFocus, onBlur: onYearBlur, disabled: disabled, required: required, readonly: readonly, validationStatus: validationStatus, maxLength: 4, testID: "date-input-year" }))] }) }));
8
+ };
9
+ DateInput.displayName = 'DateInput';
10
+ const styles = StyleSheet.create(theme => ({
11
+ wrap: {
12
+ gap: theme.components.input.gap,
13
+ },
14
+ container: {
15
+ flexDirection: 'row',
16
+ gap: theme.components.input.date.gap,
17
+ },
18
+ }));
19
+ export default DateInput;
@@ -0,0 +1,79 @@
1
+ import type { TextInputProps } from 'react-native';
2
+ import type { FormFieldBaseProps } from '../FormField/FormField.props';
3
+ export interface DateInputProps extends FormFieldBaseProps {
4
+ /**
5
+ * Whether the day segment is hidden.
6
+ * @default false
7
+ */
8
+ hideDay?: boolean;
9
+ /**
10
+ * Whether the month segment is hidden.
11
+ * @default false
12
+ */
13
+ hideMonth?: boolean;
14
+ /**
15
+ * Whether the year segment is hidden.
16
+ * @default false
17
+ */
18
+ hideYear?: boolean;
19
+ /**
20
+ * Placeholder text for the day segment.
21
+ */
22
+ dayPlaceholder?: string;
23
+ /**
24
+ * Placeholder text for the month segment.
25
+ */
26
+ monthPlaceholder?: string;
27
+ /**
28
+ * Placeholder text for the year segment.
29
+ */
30
+ yearPlaceholder?: string;
31
+ /**
32
+ * The controlled value for the day segment. Must be used with an `onDayChange` handler.
33
+ */
34
+ dayValue?: string;
35
+ /**
36
+ * The controlled value for the month segment. Must be used with an `onMonthChange` handler.
37
+ */
38
+ monthValue?: string;
39
+ /**
40
+ * The controlled value for the year segment. Must be used with an `onYearChange` handler.
41
+ */
42
+ yearValue?: string;
43
+ /**
44
+ * Callback fired when the day value changes.
45
+ */
46
+ onDayChange?: (text: string) => void;
47
+ /**
48
+ * Callback fired when the month value changes.
49
+ */
50
+ onMonthChange?: (text: string) => void;
51
+ /**
52
+ * Callback fired when the year value changes.
53
+ */
54
+ onYearChange?: (text: string) => void;
55
+ /**
56
+ * Callback fired when the day segment receives focus.
57
+ */
58
+ onDayFocus?: TextInputProps['onFocus'];
59
+ /**
60
+ * Callback fired when the month segment receives focus.
61
+ */
62
+ onMonthFocus?: TextInputProps['onFocus'];
63
+ /**
64
+ * Callback fired when the year segment receives focus.
65
+ */
66
+ onYearFocus?: TextInputProps['onFocus'];
67
+ /**
68
+ * Callback fired when the day segment loses focus.
69
+ */
70
+ onDayBlur?: TextInputProps['onBlur'];
71
+ /**
72
+ * Callback fired when the month segment loses focus.
73
+ */
74
+ onMonthBlur?: TextInputProps['onBlur'];
75
+ /**
76
+ * Callback fired when the year segment loses focus.
77
+ */
78
+ onYearBlur?: TextInputProps['onBlur'];
79
+ }
@@ -0,0 +1 @@
1
+ export {};