@utilitywarehouse/hearth-react-native 0.7.0 → 0.8.1

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 (109) 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/Banner/Banner.d.ts +6 -0
  5. package/build/components/Banner/Banner.js +161 -0
  6. package/build/components/Banner/Banner.props.d.ts +82 -0
  7. package/build/components/Banner/Banner.props.js +1 -0
  8. package/build/components/Banner/index.d.ts +2 -0
  9. package/build/components/Banner/index.js +1 -0
  10. package/build/components/BottomSheet/BottomSheetBackdrop.js +1 -5
  11. package/build/components/BottomSheet/BottomSheetFlatList.js +1 -5
  12. package/build/components/BottomSheet/BottomSheetHandle.js +1 -5
  13. package/build/components/BottomSheet/useBottomSheetLogic.d.ts +1 -1
  14. package/build/components/Expandable/Expandable.d.ts +6 -0
  15. package/build/components/Expandable/Expandable.js +44 -0
  16. package/build/components/Expandable/Expandable.props.d.ts +38 -0
  17. package/build/components/Expandable/Expandable.props.js +1 -0
  18. package/build/components/Expandable/index.d.ts +2 -0
  19. package/build/components/Expandable/index.js +1 -0
  20. package/build/components/ExpandableCard/ExpandableCard.d.ts +6 -0
  21. package/build/components/ExpandableCard/ExpandableCard.js +23 -0
  22. package/build/components/ExpandableCard/ExpandableCard.props.d.ts +69 -0
  23. package/build/components/ExpandableCard/ExpandableCard.props.js +1 -0
  24. package/build/components/ExpandableCard/ExpandableCardContent.d.ts +6 -0
  25. package/build/components/ExpandableCard/ExpandableCardContent.js +14 -0
  26. package/build/components/ExpandableCard/ExpandableCardExpandedContent.d.ts +11 -0
  27. package/build/components/ExpandableCard/ExpandableCardExpandedContent.js +18 -0
  28. package/build/components/ExpandableCard/ExpandableCardGroup.d.ts +6 -0
  29. package/build/components/ExpandableCard/ExpandableCardGroup.js +17 -0
  30. package/build/components/ExpandableCard/ExpandableCardGroup.props.d.ts +25 -0
  31. package/build/components/ExpandableCard/ExpandableCardGroup.props.js +1 -0
  32. package/build/components/ExpandableCard/ExpandableCardHelperText.d.ts +6 -0
  33. package/build/components/ExpandableCard/ExpandableCardHelperText.js +13 -0
  34. package/build/components/ExpandableCard/ExpandableCardIcon.d.ts +9 -0
  35. package/build/components/ExpandableCard/ExpandableCardIcon.js +19 -0
  36. package/build/components/ExpandableCard/ExpandableCardLeadingContent.d.ts +6 -0
  37. package/build/components/ExpandableCard/ExpandableCardLeadingContent.js +5 -0
  38. package/build/components/ExpandableCard/ExpandableCardText.d.ts +6 -0
  39. package/build/components/ExpandableCard/ExpandableCardText.js +7 -0
  40. package/build/components/ExpandableCard/ExpandableCardTrailingContent.d.ts +6 -0
  41. package/build/components/ExpandableCard/ExpandableCardTrailingContent.js +5 -0
  42. package/build/components/ExpandableCard/ExpandableCardTrailingIcon.d.ts +9 -0
  43. package/build/components/ExpandableCard/ExpandableCardTrailingIcon.js +17 -0
  44. package/build/components/ExpandableCard/ExpandableCardTrigger.d.ts +17 -0
  45. package/build/components/ExpandableCard/ExpandableCardTrigger.js +7 -0
  46. package/build/components/ExpandableCard/ExpandableCardTrigger.props.d.ts +44 -0
  47. package/build/components/ExpandableCard/ExpandableCardTrigger.props.js +1 -0
  48. package/build/components/ExpandableCard/ExpandableCardTriggerRoot.d.ts +11 -0
  49. package/build/components/ExpandableCard/ExpandableCardTriggerRoot.js +91 -0
  50. package/build/components/ExpandableCard/index.d.ts +14 -0
  51. package/build/components/ExpandableCard/index.js +11 -0
  52. package/build/components/HighlightBanner/HighlightBanner.d.ts +6 -0
  53. package/build/components/HighlightBanner/HighlightBanner.js +96 -0
  54. package/build/components/HighlightBanner/HighlightBanner.props.d.ts +14 -0
  55. package/build/components/HighlightBanner/HighlightBanner.props.js +1 -0
  56. package/build/components/HighlightBanner/index.d.ts +2 -0
  57. package/build/components/HighlightBanner/index.js +1 -0
  58. package/build/components/Spinner/Spinner.js +0 -2
  59. package/build/components/Spinner/Spinner.web.d.ts +2 -1
  60. package/build/components/Spinner/Spinner.web.js +0 -2
  61. package/build/components/Switch/Switch.web.js +0 -1
  62. package/build/components/Tabs/TabsList.js +1 -6
  63. package/build/components/index.d.ts +4 -0
  64. package/build/components/index.js +4 -0
  65. package/docs/components/AllComponents.web.tsx +75 -4
  66. package/docs/components/VariantTitle.tsx +1 -1
  67. package/package.json +4 -4
  68. package/src/components/Banner/Banner.docs.mdx +402 -0
  69. package/src/components/Banner/Banner.props.ts +106 -0
  70. package/src/components/Banner/Banner.stories.tsx +494 -0
  71. package/src/components/Banner/Banner.tsx +264 -0
  72. package/src/components/Banner/index.ts +2 -0
  73. package/src/components/BottomSheet/BottomSheetBackdrop.tsx +0 -1
  74. package/src/components/BottomSheet/BottomSheetFlatList.tsx +0 -1
  75. package/src/components/BottomSheet/BottomSheetHandle.tsx +0 -1
  76. package/src/components/Card/Card.docs.mdx +10 -2
  77. package/src/components/Expandable/Expandable.docs.mdx +201 -0
  78. package/src/components/Expandable/Expandable.props.ts +46 -0
  79. package/src/components/Expandable/Expandable.stories.tsx +284 -0
  80. package/src/components/Expandable/Expandable.tsx +92 -0
  81. package/src/components/Expandable/index.ts +2 -0
  82. package/src/components/ExpandableCard/ExpandableCard.docs.mdx +312 -0
  83. package/src/components/ExpandableCard/ExpandableCard.props.ts +85 -0
  84. package/src/components/ExpandableCard/ExpandableCard.stories.tsx +326 -0
  85. package/src/components/ExpandableCard/ExpandableCard.tsx +76 -0
  86. package/src/components/ExpandableCard/ExpandableCardContent.tsx +21 -0
  87. package/src/components/ExpandableCard/ExpandableCardExpandedContent.tsx +42 -0
  88. package/src/components/ExpandableCard/ExpandableCardGroup.props.ts +31 -0
  89. package/src/components/ExpandableCard/ExpandableCardGroup.tsx +40 -0
  90. package/src/components/ExpandableCard/ExpandableCardHelperText.tsx +21 -0
  91. package/src/components/ExpandableCard/ExpandableCardIcon.tsx +32 -0
  92. package/src/components/ExpandableCard/ExpandableCardLeadingContent.tsx +9 -0
  93. package/src/components/ExpandableCard/ExpandableCardText.tsx +14 -0
  94. package/src/components/ExpandableCard/ExpandableCardTrailingContent.tsx +9 -0
  95. package/src/components/ExpandableCard/ExpandableCardTrailingIcon.tsx +30 -0
  96. package/src/components/ExpandableCard/ExpandableCardTrigger.props.ts +47 -0
  97. package/src/components/ExpandableCard/ExpandableCardTrigger.tsx +10 -0
  98. package/src/components/ExpandableCard/ExpandableCardTriggerRoot.tsx +154 -0
  99. package/src/components/ExpandableCard/index.ts +14 -0
  100. package/src/components/HighlightBanner/HighlightBanner.docs.mdx +296 -0
  101. package/src/components/HighlightBanner/HighlightBanner.props.ts +29 -0
  102. package/src/components/HighlightBanner/HighlightBanner.stories.tsx +275 -0
  103. package/src/components/HighlightBanner/HighlightBanner.tsx +134 -0
  104. package/src/components/HighlightBanner/index.ts +2 -0
  105. package/src/components/Spinner/Spinner.tsx +0 -2
  106. package/src/components/Spinner/Spinner.web.tsx +0 -2
  107. package/src/components/Switch/Switch.web.tsx +1 -5
  108. package/src/components/Tabs/TabsList.tsx +0 -2
  109. package/src/components/index.ts +4 -0
@@ -1,4 +1,4 @@
1
1
 
2
- > @utilitywarehouse/hearth-react-native@0.7.0 build /home/runner/work/hearth/hearth/packages/react-native
2
+ > @utilitywarehouse/hearth-react-native@0.8.1 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.7.0 lint /home/runner/work/hearth/hearth/packages/react-native
2
+ > @utilitywarehouse/hearth-react-native@0.8.1 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.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#641](https://github.com/utilitywarehouse/hearth/pull/641) [`251242e`](https://github.com/utilitywarehouse/hearth/commit/251242e218c0b24589c3fb6fb6963b53bda8a367) Thanks [@jordmccord](https://github.com/jordmccord)! - Fixes `HighlightBanner` when no image is provided
8
+
9
+ ## 0.8.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#635](https://github.com/utilitywarehouse/hearth/pull/635) [`4cac2f2`](https://github.com/utilitywarehouse/hearth/commit/4cac2f28c12279557e2133d67cd75783f30c89ff) Thanks [@jordmccord](https://github.com/jordmccord)! - Adds `Expandable` component
14
+
15
+ - [#631](https://github.com/utilitywarehouse/hearth/pull/631) [`57b4991`](https://github.com/utilitywarehouse/hearth/commit/57b49912c90dce3d88a699bd50217df08dab601a) Thanks [@jordmccord](https://github.com/jordmccord)! - Adds `Banner` component
16
+
17
+ - [#636](https://github.com/utilitywarehouse/hearth/pull/636) [`a363352`](https://github.com/utilitywarehouse/hearth/commit/a363352dbfbc44245c64e2a16347463b89ff519a) Thanks [@jordmccord](https://github.com/jordmccord)! - Adds `ExpandableCard` component
18
+
19
+ - [#631](https://github.com/utilitywarehouse/hearth/pull/631) [`57b4991`](https://github.com/utilitywarehouse/hearth/commit/57b49912c90dce3d88a699bd50217df08dab601a) Thanks [@jordmccord](https://github.com/jordmccord)! - Adds `HighlightBanner` component
20
+
3
21
  ## 0.7.0
4
22
 
5
23
  ### Minor Changes
@@ -0,0 +1,6 @@
1
+ import type BannerProps from './Banner.props';
2
+ declare const Banner: {
3
+ ({ icon, iconContainerVariant, iconContainerSize, iconContainerColor, illustration, image, heading, description, direction, link, button, onPress, onClose, variant, colorScheme, style, ...props }: BannerProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default Banner;
@@ -0,0 +1,161 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronRightSmallIcon, CloseSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
3
+ import { Pressable, View } from 'react-native';
4
+ import { StyleSheet } from 'react-native-unistyles';
5
+ import { BodyText } from '../BodyText';
6
+ import { Card } from '../Card';
7
+ import { Heading } from '../Heading';
8
+ import { IconContainer } from '../IconContainer';
9
+ import { ThemedImage } from '../ThemedImage';
10
+ import { UnstyledIconButton } from '../UnstyledIconButton';
11
+ 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 }) => {
12
+ const hasIllustration = Boolean(illustration);
13
+ styles.useVariants({ direction, hasIllustration });
14
+ const renderIconOrImage = () => {
15
+ if (icon) {
16
+ return (_jsx(IconContainer, { icon: icon, variant: iconContainerVariant, size: iconContainerSize, color: iconContainerColor, style: styles.media }));
17
+ }
18
+ if (illustration) {
19
+ return (_jsx(ThemedImage, { light: illustration.light, dark: illustration.dark, style: styles.image, accessible: true, accessibilityLabel: heading }));
20
+ }
21
+ if (image) {
22
+ return (_jsx(View, { style: [styles.media, styles.imageWrapper], children: _jsx(ThemedImage, { light: image.light, dark: image.dark, style: styles.image, accessible: true, accessibilityLabel: heading }) }));
23
+ }
24
+ return null;
25
+ };
26
+ const renderAction = () => {
27
+ if (link) {
28
+ return _jsx(View, { style: styles.action, children: link });
29
+ }
30
+ if (button) {
31
+ return _jsx(View, { style: styles.action, children: button });
32
+ }
33
+ return null;
34
+ };
35
+ const content = (_jsxs(View, { style: styles.container, children: [renderIconOrImage(), _jsxs(View, { style: styles.contentContainer, 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 && (_jsx(UnstyledIconButton, { icon: CloseSmallIcon, size: "sm", onPress: onClose, style: styles.closeButton, accessibilityLabel: "Close banner" }))] })] }));
36
+ if (onPress) {
37
+ return (_jsx(Card, { variant: variant, style: [styles.card, style], ...props, children: _jsx(Pressable, { onPress: onPress, accessibilityRole: "button", style: styles.pressable, children: content }) }));
38
+ }
39
+ return (_jsx(Card, { variant: variant, style: [styles.card, style], ...props, children: content }));
40
+ };
41
+ Banner.displayName = 'Banner';
42
+ const styles = StyleSheet.create(theme => ({
43
+ card: {},
44
+ pressable: {
45
+ width: '100%',
46
+ },
47
+ container: {
48
+ flexDirection: 'row',
49
+ gap: theme.space.lg,
50
+ variants: {
51
+ direction: {
52
+ horizontal: {
53
+ flexDirection: 'row',
54
+ alignItems: 'flex-start',
55
+ },
56
+ vertical: {
57
+ flexDirection: 'column',
58
+ alignItems: 'stretch',
59
+ },
60
+ },
61
+ hasIllustration: {
62
+ true: {},
63
+ false: {},
64
+ },
65
+ },
66
+ compoundVariants: [
67
+ {
68
+ direction: 'vertical',
69
+ hasIllustration: false,
70
+ styles: {
71
+ alignItems: 'flex-start',
72
+ },
73
+ },
74
+ {
75
+ direction: 'vertical',
76
+ hasIllustration: true,
77
+ styles: {
78
+ alignItems: 'center',
79
+ },
80
+ },
81
+ ],
82
+ },
83
+ media: {
84
+ flexShrink: 0,
85
+ variants: {
86
+ direction: {
87
+ horizontal: {},
88
+ vertical: {
89
+ alignSelf: 'flex-start',
90
+ },
91
+ },
92
+ },
93
+ },
94
+ imageWrapper: {
95
+ variants: {
96
+ direction: {
97
+ horizontal: {},
98
+ vertical: {
99
+ width: '100%',
100
+ },
101
+ },
102
+ },
103
+ },
104
+ image: {
105
+ borderRadius: theme.borderRadius.md,
106
+ borderWidth: theme.borderWidth[1],
107
+ borderColor: theme.color.border.strong,
108
+ variants: {
109
+ direction: {
110
+ horizontal: { width: 160, height: 95 },
111
+ vertical: {
112
+ width: '100%',
113
+ height: 160,
114
+ },
115
+ },
116
+ },
117
+ },
118
+ contentContainer: {
119
+ flex: 1,
120
+ flexDirection: 'row',
121
+ alignItems: 'flex-start',
122
+ justifyContent: 'space-between',
123
+ gap: theme.space.lg,
124
+ },
125
+ textContainer: {
126
+ flex: 1,
127
+ gap: theme.space.lg,
128
+ },
129
+ heading: {
130
+ compoundVariants: [
131
+ {
132
+ direction: 'vertical',
133
+ hasIllustration: true,
134
+ styles: {
135
+ textAlign: 'center',
136
+ },
137
+ },
138
+ ],
139
+ },
140
+ description: {
141
+ compoundVariants: [
142
+ {
143
+ direction: 'vertical',
144
+ hasIllustration: true,
145
+ styles: {
146
+ textAlign: 'center',
147
+ },
148
+ },
149
+ ],
150
+ },
151
+ action: {
152
+ alignSelf: 'flex-start',
153
+ },
154
+ chevron: {
155
+ alignSelf: 'center',
156
+ },
157
+ closeButton: {
158
+ alignSelf: 'flex-start',
159
+ },
160
+ }));
161
+ export default Banner;
@@ -0,0 +1,82 @@
1
+ import type { ComponentType, ReactElement } from 'react';
2
+ import type { ImageSourcePropType } from 'react-native';
3
+ import type CardProps from '../Card/Card.props';
4
+ export type BannerDirection = 'horizontal' | 'vertical';
5
+ export interface BannerProps extends Omit<CardProps, 'noPadding' | 'variant' | 'colorScheme' | 'space' | 'gap' | 'rowGap' | 'columnGap' | 'flexDirection' | 'flexWrap' | 'alignItems' | 'justifyContent'> {
6
+ /**
7
+ * Icon component to display in the banner
8
+ * Mutually exclusive with image
9
+ */
10
+ icon?: ComponentType;
11
+ /**
12
+ * Icon container variant
13
+ * @default 'subtle'
14
+ */
15
+ iconContainerVariant?: 'subtle' | 'emphasis';
16
+ /**
17
+ * Icon container size
18
+ * @default 'md'
19
+ */
20
+ iconContainerSize?: 'sm' | 'md' | 'lg';
21
+ /**
22
+ * Icon container color
23
+ * @default 'pig'
24
+ */
25
+ iconContainerColor?: 'pig' | 'energy' | 'broadband' | 'mobile' | 'insurance' | 'cashback' | 'highlight';
26
+ /**
27
+ * Illustration to display in the banner
28
+ * Mutually exclusive with icon and image
29
+ */
30
+ illustration?: {
31
+ light: ImageSourcePropType | ReactElement | ComponentType;
32
+ dark: ImageSourcePropType | ReactElement | ComponentType;
33
+ };
34
+ /**
35
+ * Image to display in the banner
36
+ * Mutually exclusive with icon and illustration
37
+ */
38
+ image?: {
39
+ light: ImageSourcePropType | ReactElement | ComponentType;
40
+ dark: ImageSourcePropType | ReactElement | ComponentType;
41
+ };
42
+ /**
43
+ * Heading text
44
+ */
45
+ heading: string;
46
+ /**
47
+ * Description text
48
+ */
49
+ description: string;
50
+ /**
51
+ * Layout direction for icon/image and content
52
+ * @default 'horizontal'
53
+ */
54
+ direction?: BannerDirection;
55
+ /**
56
+ * Link element to display
57
+ */
58
+ link?: ReactElement;
59
+ /**
60
+ * Button element to display
61
+ */
62
+ button?: ReactElement;
63
+ /**
64
+ * Makes the entire banner pressable
65
+ */
66
+ onPress?: () => void;
67
+ /**
68
+ * Close button handler
69
+ */
70
+ onClose?: () => void;
71
+ /**
72
+ * Card variant
73
+ * @default 'subtle'
74
+ */
75
+ variant?: 'subtle' | 'emphasis';
76
+ /**
77
+ * Color scheme for the banner
78
+ * @default 'pig'
79
+ */
80
+ colorScheme?: 'pig' | 'energy' | 'broadband' | 'mobile' | 'insurance' | 'cashback' | 'highlight';
81
+ }
82
+ export default BannerProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as Banner } from './Banner';
2
+ export type { default as BannerProps } from './Banner.props';
@@ -0,0 +1 @@
1
+ export { default as Banner } from './Banner';
@@ -5,11 +5,7 @@ import { useTheme } from '../../hooks';
5
5
  const StyledBottomSheetBackdrop = withUnistyles(Backdrop);
6
6
  const BottomSheetBackdrop = ({ style, ...props }) => {
7
7
  const theme = useTheme();
8
- return (_jsx(StyledBottomSheetBackdrop
9
- // @ts-expect-error - style prop type issue
10
- , {
11
- // @ts-expect-error - style prop type issue
12
- style: [styles.backdrop, style], opacity: theme.components.overlay.opacity / 100, appearsOnIndex: 0, disappearsOnIndex: -1, ...props }));
8
+ return (_jsx(StyledBottomSheetBackdrop, { style: [styles.backdrop, style], opacity: theme.components.overlay.opacity / 100, appearsOnIndex: 0, disappearsOnIndex: -1, ...props }));
13
9
  };
14
10
  const styles = StyleSheet.create(theme => ({
15
11
  backdrop: {
@@ -9,11 +9,7 @@ const BottomSheetFlatList = ({ style, contentContainerStyle, isModal = true, ...
9
9
  isModal,
10
10
  handle,
11
11
  });
12
- return (_jsx(StyledBottomSheetFlatList
13
- // @ts-expect-error - style prop type issue
14
- , {
15
- // @ts-expect-error - style prop type issue
16
- style: [styles.container, style], contentContainerStyle: [styles.contentContainer, contentContainerStyle], ...props }));
12
+ return (_jsx(StyledBottomSheetFlatList, { style: [styles.container, style], contentContainerStyle: [styles.contentContainer, contentContainerStyle], ...props }));
17
13
  };
18
14
  const styles = StyleSheet.create((theme, rt) => ({
19
15
  container: {},
@@ -3,11 +3,7 @@ import { BottomSheetHandle as Handle } from '@gorhom/bottom-sheet';
3
3
  import { StyleSheet, withUnistyles } from 'react-native-unistyles';
4
4
  const StyledBottomSheetHandle = withUnistyles(Handle);
5
5
  const BottomSheetHandle = ({ style, indicatorStyle, ...props }) => {
6
- return (_jsx(StyledBottomSheetHandle
7
- // @ts-expect-error - style prop type issue
8
- , {
9
- // @ts-expect-error - style prop type issue
10
- style: [styles.handle, style], indicatorStyle: [styles.indicator, indicatorStyle], ...props }));
6
+ return (_jsx(StyledBottomSheetHandle, { style: [styles.handle, style], indicatorStyle: [styles.indicator, indicatorStyle], ...props }));
11
7
  };
12
8
  const styles = StyleSheet.create(theme => ({
13
9
  handle: {
@@ -9,7 +9,7 @@ interface UseBottomSheetLogicProps<T = any> {
9
9
  handleStyle?: ViewStyle;
10
10
  }
11
11
  declare const useBottomSheetLogic: <T = any>(props: UseBottomSheetLogicProps<T>) => {
12
- renderBackdrop: (backDropProps: BottomSheetBackdropProps) => string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<React.ReactNode> | null | undefined;
12
+ renderBackdrop: (backDropProps: BottomSheetBackdropProps) => string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
13
13
  renderHandle: (handleProps: BottomSheetHandleProps) => import("react/jsx-runtime").JSX.Element | null;
14
14
  };
15
15
  export default useBottomSheetLogic;
@@ -0,0 +1,6 @@
1
+ import { ExpandableProps } from './Expandable.props';
2
+ declare const Expandable: {
3
+ ({ expanded, onExpandedChange, children, duration, style, accessibilityLabel, testID, animateOpacity, ...props }: ExpandableProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default Expandable;
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect } from 'react';
3
+ import { View } from 'react-native';
4
+ import Animated, { useAnimatedStyle, useDerivedValue, useSharedValue, withTiming, } from 'react-native-reanimated';
5
+ import { StyleSheet } from 'react-native-unistyles';
6
+ const Expandable = ({ expanded = false, onExpandedChange, children, duration = 200, style, accessibilityLabel, testID, animateOpacity = true, ...props }) => {
7
+ const height = useSharedValue(0);
8
+ const open = useSharedValue(expanded);
9
+ // Update open value when expanded prop changes and call callback
10
+ useEffect(() => {
11
+ if (open.value !== expanded) {
12
+ open.value = expanded;
13
+ onExpandedChange?.(expanded);
14
+ }
15
+ }, [expanded, onExpandedChange, open]);
16
+ const derivedHeight = useDerivedValue(() => withTiming(height.value * Number(open.value), {
17
+ duration,
18
+ }));
19
+ const derivedOpacity = useDerivedValue(() => animateOpacity
20
+ ? withTiming(Number(open.value), {
21
+ duration,
22
+ })
23
+ : 1);
24
+ const heightStyle = useAnimatedStyle(() => ({
25
+ height: derivedHeight.value,
26
+ }));
27
+ const opacityStyle = useAnimatedStyle(() => ({
28
+ opacity: derivedOpacity.value,
29
+ }));
30
+ return (_jsx(Animated.View, { style: [styles.container, heightStyle, style], accessible: true, accessibilityLabel: accessibilityLabel, accessibilityRole: "none", accessibilityState: { expanded }, testID: testID, ...props, children: _jsx(Animated.View, { style: opacityStyle, children: _jsx(View, { onLayout: e => {
31
+ height.value = e.nativeEvent.layout.height;
32
+ }, style: styles.content, children: children }) }) }));
33
+ };
34
+ Expandable.displayName = 'Expandable';
35
+ const styles = StyleSheet.create(() => ({
36
+ container: {
37
+ overflow: 'hidden',
38
+ },
39
+ content: {
40
+ position: 'absolute',
41
+ width: '100%',
42
+ },
43
+ }));
44
+ export default Expandable;
@@ -0,0 +1,38 @@
1
+ import { ReactNode } from 'react';
2
+ import { ViewProps, ViewStyle } from 'react-native';
3
+ export interface ExpandableProps extends ViewProps {
4
+ /**
5
+ * Whether the content is expanded
6
+ */
7
+ expanded?: boolean;
8
+ /**
9
+ * Callback when expanded state changes
10
+ */
11
+ onExpandedChange?: (expanded: boolean) => void;
12
+ /**
13
+ * The content to expand/collapse
14
+ */
15
+ children: ReactNode;
16
+ /**
17
+ * Duration of the animation in milliseconds
18
+ * @default 200
19
+ */
20
+ duration?: number;
21
+ /**
22
+ * Additional style for the container
23
+ */
24
+ style?: ViewStyle;
25
+ /**
26
+ * Accessibility label for screen readers
27
+ */
28
+ accessibilityLabel?: string;
29
+ /**
30
+ * Test ID for testing
31
+ */
32
+ testID?: string;
33
+ /**
34
+ * Whether to animate opacity during expansion/collapse
35
+ * @default true
36
+ */
37
+ animateOpacity?: boolean;
38
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as Expandable } from './Expandable';
2
+ export type { ExpandableProps } from './Expandable.props';
@@ -0,0 +1 @@
1
+ export { default as Expandable } from './Expandable';
@@ -0,0 +1,6 @@
1
+ import type ExpandableCardProps from './ExpandableCard.props';
2
+ declare const ExpandableCard: {
3
+ ({ expanded: controlledExpanded, onExpandedChange, heading, helperText, leadingIcon, leadingContent, badge, badgePosition, numericValue, expandedContent, duration, animateOpacity, disabled, testID, children, ...cardProps }: ExpandableCardProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default ExpandableCard;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Card } from '../Card';
4
+ import ExpandableCardExpandedContent from './ExpandableCardExpandedContent';
5
+ import ExpandableCardTrigger from './ExpandableCardTrigger';
6
+ const ExpandableCard = ({ expanded: controlledExpanded, onExpandedChange, heading, helperText, leadingIcon, leadingContent, badge, badgePosition = 'bottom', numericValue, expandedContent, duration = 200, animateOpacity = true, disabled = false, testID = 'expandable-card', children, ...cardProps }) => {
7
+ const [internalExpanded, setInternalExpanded] = useState(false);
8
+ // Use controlled or uncontrolled state
9
+ const isExpanded = controlledExpanded !== undefined ? controlledExpanded : internalExpanded;
10
+ const handlePress = () => {
11
+ if (disabled)
12
+ return;
13
+ const newExpanded = !isExpanded;
14
+ if (controlledExpanded === undefined) {
15
+ setInternalExpanded(newExpanded);
16
+ }
17
+ onExpandedChange?.(newExpanded);
18
+ };
19
+ const renderDefaultContent = () => (_jsxs(_Fragment, { children: [_jsx(ExpandableCardTrigger, { onPress: handlePress, disabled: disabled, heading: heading, helperText: helperText, leadingIcon: leadingIcon, leadingContent: leadingContent, badge: badge, badgePosition: badgePosition, numericValue: numericValue, isExpanded: isExpanded, testID: `${testID}-trigger` }), _jsx(ExpandableCardExpandedContent, { isExpanded: isExpanded, duration: duration, animateOpacity: animateOpacity, children: expandedContent })] }));
20
+ return (_jsx(Card, { noPadding: true, ...cardProps, testID: testID, children: children || renderDefaultContent() }));
21
+ };
22
+ ExpandableCard.displayName = 'ExpandableCard';
23
+ export default ExpandableCard;
@@ -0,0 +1,69 @@
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import type BadgeProps from '../Badge/Badge.props';
3
+ import type CardProps from '../Card/Card.props';
4
+ export interface ExpandableCardProps extends Omit<CardProps, 'children'> {
5
+ /**
6
+ * Whether the card is expanded
7
+ */
8
+ expanded?: boolean;
9
+ /**
10
+ * Callback when expanded state changes
11
+ */
12
+ onExpandedChange?: (expanded: boolean) => void;
13
+ /**
14
+ * The heading text displayed in the trigger
15
+ */
16
+ heading?: string;
17
+ /**
18
+ * Optional helper text displayed below the heading
19
+ */
20
+ helperText?: string;
21
+ /**
22
+ * Leading icon component
23
+ */
24
+ leadingIcon?: ComponentType;
25
+ /**
26
+ * Leading content (icon or custom element)
27
+ */
28
+ leadingContent?: ReactNode;
29
+ /**
30
+ * Badge to display
31
+ */
32
+ badge?: BadgeProps;
33
+ /**
34
+ * Badge position
35
+ * @default 'bottom'
36
+ */
37
+ badgePosition?: 'top' | 'bottom';
38
+ /**
39
+ * Numeric value to display on the right
40
+ */
41
+ numericValue?: string | number;
42
+ /**
43
+ * The content to show when expanded
44
+ */
45
+ expandedContent?: ReactNode;
46
+ /**
47
+ * Duration of the expansion animation in milliseconds
48
+ * @default 200
49
+ */
50
+ duration?: number;
51
+ /**
52
+ * Whether to animate opacity during expansion
53
+ * @default true
54
+ */
55
+ animateOpacity?: boolean;
56
+ /**
57
+ * Whether the card is disabled
58
+ */
59
+ disabled?: boolean;
60
+ /**
61
+ * Test ID for testing
62
+ */
63
+ testID?: string;
64
+ /**
65
+ * Custom children for advanced composition
66
+ */
67
+ children?: ReactNode;
68
+ }
69
+ export default ExpandableCardProps;
@@ -0,0 +1,6 @@
1
+ import { type ViewProps } from 'react-native';
2
+ declare const ExpandableCardContent: {
3
+ ({ children, ...props }: ViewProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default ExpandableCardContent;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
+ const ExpandableCardContent = ({ children, ...props }) => {
5
+ return (_jsx(View, { ...props, style: [styles.container, props.style], children: children }));
6
+ };
7
+ ExpandableCardContent.displayName = 'ExpandableCardContent';
8
+ const styles = StyleSheet.create(theme => ({
9
+ container: {
10
+ gap: theme.components.expandableCard.gapVertical,
11
+ flex: 1,
12
+ },
13
+ }));
14
+ export default ExpandableCardContent;
@@ -0,0 +1,11 @@
1
+ interface ExpandableCardExpandedContentProps {
2
+ children: React.ReactNode;
3
+ isExpanded: boolean;
4
+ duration?: number;
5
+ animateOpacity?: boolean;
6
+ }
7
+ declare const ExpandableCardExpandedContent: {
8
+ ({ children, isExpanded, duration, animateOpacity, }: ExpandableCardExpandedContentProps): import("react/jsx-runtime").JSX.Element;
9
+ displayName: string;
10
+ };
11
+ export default ExpandableCardExpandedContent;
@@ -0,0 +1,18 @@
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 { Divider } from '../Divider';
5
+ import { Expandable } from '../Expandable';
6
+ const ExpandableCardExpandedContent = ({ children, isExpanded, duration = 200, animateOpacity = true, }) => {
7
+ return (_jsx(View, { style: styles.container, children: _jsx(Expandable, { expanded: isExpanded, duration: duration, animateOpacity: animateOpacity, children: _jsxs(View, { children: [_jsx(Divider, { space: "none" }), _jsx(View, { style: styles.content, children: children })] }) }) }));
8
+ };
9
+ ExpandableCardExpandedContent.displayName = 'ExpandableCardExpandedContent';
10
+ const styles = StyleSheet.create(theme => ({
11
+ container: {
12
+ width: '100%',
13
+ },
14
+ content: {
15
+ padding: theme.components.card.mobile.padding,
16
+ },
17
+ }));
18
+ export default ExpandableCardExpandedContent;
@@ -0,0 +1,6 @@
1
+ import type ExpandableCardGroupProps from './ExpandableCardGroup.props';
2
+ declare const ExpandableCardGroup: {
3
+ ({ heading, helperText, headerTrailingContent, children, style, testID, ...props }: ExpandableCardGroupProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default ExpandableCardGroup;
@@ -0,0 +1,17 @@
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 { SectionHeader } from '../SectionHeader';
5
+ const ExpandableCardGroup = ({ heading, helperText, headerTrailingContent, children, style, testID = 'expandable-card-group', ...props }) => {
6
+ return (_jsxs(View, { style: [styles.container, style], testID: testID, ...props, children: [heading ? (_jsx(SectionHeader, { heading: heading, helperText: helperText, trailingContent: headerTrailingContent })) : null, _jsx(View, { style: styles.cardsContainer, children: children })] }));
7
+ };
8
+ ExpandableCardGroup.displayName = 'ExpandableCardGroup';
9
+ const styles = StyleSheet.create(theme => ({
10
+ container: {
11
+ gap: theme.components.expandableCard.group.gap,
12
+ },
13
+ cardsContainer: {
14
+ gap: theme.components.expandableCard.group.gap,
15
+ },
16
+ }));
17
+ export default ExpandableCardGroup;