@utilitywarehouse/hearth-react-native 0.4.2 → 0.6.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 (207) hide show
  1. package/.storybook/main.ts +21 -1
  2. package/.turbo/turbo-build.log +1 -1
  3. package/.turbo/turbo-lint.log +1 -1
  4. package/CHANGELOG.md +52 -0
  5. package/build/components/Alert/AlertTitle.js +6 -6
  6. package/build/components/Badge/Badge.js +3 -3
  7. package/build/components/Badge/Badge.props.d.ts +1 -0
  8. package/build/components/Button/ButtonRoot.js +4 -0
  9. package/build/components/Button/ButtonText.js +2 -2
  10. package/build/components/Card/CardRoot.js +1 -1
  11. package/build/components/Carousel/Carousel.context.d.ts +4 -0
  12. package/build/components/Carousel/Carousel.context.js +4 -0
  13. package/build/components/Carousel/Carousel.d.ts +6 -0
  14. package/build/components/Carousel/Carousel.js +278 -0
  15. package/build/components/Carousel/Carousel.props.d.ts +65 -0
  16. package/build/components/Carousel/Carousel.props.js +1 -0
  17. package/build/components/Carousel/CarouselControlItem.d.ts +24 -0
  18. package/build/components/Carousel/CarouselControlItem.js +64 -0
  19. package/build/components/Carousel/CarouselControls.d.ts +4 -0
  20. package/build/components/Carousel/CarouselControls.js +74 -0
  21. package/build/components/Carousel/CarouselItem.d.ts +6 -0
  22. package/build/components/Carousel/CarouselItem.js +38 -0
  23. package/build/components/Carousel/index.d.ts +5 -0
  24. package/build/components/Carousel/index.js +5 -0
  25. package/build/components/Container/Container.d.ts +6 -0
  26. package/build/components/Container/Container.js +40 -0
  27. package/build/components/Container/Container.props.d.ts +85 -0
  28. package/build/components/Container/Container.props.js +1 -0
  29. package/build/components/Container/index.d.ts +2 -0
  30. package/build/components/Container/index.js +1 -0
  31. package/build/components/DescriptionList/DescriptionList.d.ts +1 -1
  32. package/build/components/DescriptionList/DescriptionList.js +2 -2
  33. package/build/components/DescriptionList/DescriptionList.props.d.ts +1 -8
  34. package/build/components/DescriptionList/DescriptionListItem.d.ts +1 -1
  35. package/build/components/DescriptionList/DescriptionListItem.js +4 -3
  36. package/build/components/DescriptionList/DescriptionListItem.props.d.ts +3 -8
  37. package/build/components/IndicatorIconButton/IndicatorIconButton.d.ts +6 -0
  38. package/build/components/IndicatorIconButton/IndicatorIconButton.js +26 -0
  39. package/build/components/IndicatorIconButton/IndicatorIconButton.props.d.ts +8 -0
  40. package/build/components/IndicatorIconButton/IndicatorIconButton.props.js +1 -0
  41. package/build/components/IndicatorIconButton/index.d.ts +2 -0
  42. package/build/components/IndicatorIconButton/index.js +1 -0
  43. package/build/components/Link/LinkText.js +3 -3
  44. package/build/components/List/List.context.d.ts +0 -2
  45. package/build/components/List/List.d.ts +1 -1
  46. package/build/components/List/List.js +5 -5
  47. package/build/components/List/List.props.d.ts +1 -9
  48. package/build/components/List/ListAction/ListAction.d.ts +18 -0
  49. package/build/components/List/ListAction/ListAction.js +103 -0
  50. package/build/components/List/ListAction/ListAction.props.d.ts +8 -0
  51. package/build/components/List/ListAction/ListAction.props.js +1 -0
  52. package/build/components/List/ListAction/ListActionContent.d.ts +6 -0
  53. package/build/components/List/ListAction/ListActionContent.js +14 -0
  54. package/build/components/List/ListAction/ListActionText.d.ts +6 -0
  55. package/build/components/List/ListAction/ListActionText.js +7 -0
  56. package/build/components/List/ListAction/ListActionTrailingContent.d.ts +6 -0
  57. package/build/components/List/ListAction/ListActionTrailingContent.js +5 -0
  58. package/build/components/List/ListAction/ListActionTrailingIcon.d.ts +9 -0
  59. package/build/components/List/ListAction/ListActionTrailingIcon.js +18 -0
  60. package/build/components/List/ListAction/index.d.ts +6 -0
  61. package/build/components/List/ListAction/index.js +5 -0
  62. package/build/components/List/ListItem/ListItem.context.d.ts +1 -1
  63. package/build/components/List/ListItem/ListItem.props.d.ts +9 -5
  64. package/build/components/List/ListItem/ListItemRoot.d.ts +1 -1
  65. package/build/components/List/ListItem/ListItemRoot.js +10 -12
  66. package/build/components/List/ListItem/index.d.ts +4 -4
  67. package/build/components/List/ListItem/index.js +3 -3
  68. package/build/components/List/index.d.ts +1 -0
  69. package/build/components/List/index.js +1 -0
  70. package/build/components/ProgressStepper/ProgressStep.d.ts +10 -0
  71. package/build/components/ProgressStepper/ProgressStep.js +100 -0
  72. package/build/components/ProgressStepper/ProgressStepper.d.ts +6 -0
  73. package/build/components/ProgressStepper/ProgressStepper.js +22 -0
  74. package/build/components/ProgressStepper/ProgressStepper.props.d.ts +22 -0
  75. package/build/components/ProgressStepper/ProgressStepper.props.js +1 -0
  76. package/build/components/ProgressStepper/ProgressStepperRoot.d.ts +6 -0
  77. package/build/components/ProgressStepper/ProgressStepperRoot.js +16 -0
  78. package/build/components/ProgressStepper/index.d.ts +3 -0
  79. package/build/components/ProgressStepper/index.js +2 -0
  80. package/build/components/SectionHeader/SectionHeader.d.ts +1 -1
  81. package/build/components/SectionHeader/SectionHeader.js +6 -3
  82. package/build/components/SectionHeader/SectionHeader.props.d.ts +9 -16
  83. package/build/components/SectionHeader/SectionHeaderTrailingContent.d.ts +6 -0
  84. package/build/components/SectionHeader/SectionHeaderTrailingContent.js +13 -0
  85. package/build/components/SectionHeader/index.d.ts +1 -0
  86. package/build/components/SectionHeader/index.js +1 -0
  87. package/build/components/Tabs/Tab.js +2 -2
  88. package/build/components/ThemedImage/ThemedImage.d.ts +12 -0
  89. package/build/components/ThemedImage/ThemedImage.js +27 -0
  90. package/build/components/ThemedImage/ThemedImage.props.d.ts +13 -0
  91. package/build/components/ThemedImage/ThemedImage.props.js +1 -0
  92. package/build/components/ThemedImage/index.d.ts +2 -0
  93. package/build/components/ThemedImage/index.js +1 -0
  94. package/build/components/ToggleButton/ToggleButtonText.js +2 -2
  95. package/build/components/UnstyledIconButton/UnstyledIconButton.props.d.ts +4 -1
  96. package/build/components/index.d.ts +5 -0
  97. package/build/components/index.js +5 -0
  98. package/build/core/themes.d.ts +12 -24
  99. package/build/hooks/useStyleProps.js +1 -1
  100. package/build/tokens/components/dark/button.d.ts +1 -1
  101. package/build/tokens/components/dark/button.js +1 -1
  102. package/build/tokens/components/dark/dialog.d.ts +1 -0
  103. package/build/tokens/components/dark/dialog.js +1 -0
  104. package/build/tokens/components/dark/illustrations.d.ts +1 -0
  105. package/build/tokens/components/dark/illustrations.js +1 -0
  106. package/build/tokens/components/dark/toast.d.ts +4 -1
  107. package/build/tokens/components/dark/toast.js +4 -1
  108. package/build/tokens/components/light/button.d.ts +1 -1
  109. package/build/tokens/components/light/button.js +1 -1
  110. package/build/tokens/components/light/dialog.d.ts +1 -0
  111. package/build/tokens/components/light/dialog.js +1 -0
  112. package/build/tokens/components/light/illustrations.d.ts +1 -0
  113. package/build/tokens/components/light/illustrations.js +1 -0
  114. package/build/tokens/components/light/toast.d.ts +4 -1
  115. package/build/tokens/components/light/toast.js +4 -1
  116. package/build/tokens/layout.d.ts +6 -12
  117. package/build/tokens/layout.js +3 -6
  118. package/docs/components/AllComponents.web.tsx +122 -5
  119. package/docs/components/BadgeList.tsx +20 -56
  120. package/docs/components/SwitchList.tsx +4 -8
  121. package/docs/getting-started.mdx +30 -14
  122. package/docs/introduction.mdx +1 -1
  123. package/docs/layout-components.docs.mdx +30 -0
  124. package/package.json +6 -4
  125. package/src/components/Alert/AlertTitle.tsx +7 -7
  126. package/src/components/Badge/Badge.props.ts +1 -0
  127. package/src/components/Badge/Badge.tsx +3 -2
  128. package/src/components/Button/ButtonRoot.tsx +4 -0
  129. package/src/components/Button/ButtonText.tsx +3 -3
  130. package/src/components/Card/CardRoot.tsx +2 -0
  131. package/src/components/Carousel/Carousel.context.tsx +8 -0
  132. package/src/components/Carousel/Carousel.docs.mdx +389 -0
  133. package/src/components/Carousel/Carousel.props.ts +89 -0
  134. package/src/components/Carousel/Carousel.stories.tsx +317 -0
  135. package/src/components/Carousel/Carousel.tsx +444 -0
  136. package/src/components/Carousel/CarouselControlItem.tsx +87 -0
  137. package/src/components/Carousel/CarouselControls.tsx +150 -0
  138. package/src/components/Carousel/CarouselItem.tsx +68 -0
  139. package/src/components/Carousel/index.ts +6 -0
  140. package/src/components/Container/Container.docs.mdx +168 -0
  141. package/src/components/Container/Container.props.ts +89 -0
  142. package/src/components/Container/Container.stories.tsx +274 -0
  143. package/src/components/Container/Container.tsx +52 -0
  144. package/src/components/Container/index.tsx +2 -0
  145. package/src/components/DescriptionList/DescriptionList.docs.mdx +24 -27
  146. package/src/components/DescriptionList/DescriptionList.props.ts +1 -8
  147. package/src/components/DescriptionList/DescriptionList.stories.tsx +13 -19
  148. package/src/components/DescriptionList/DescriptionList.tsx +2 -14
  149. package/src/components/DescriptionList/DescriptionListItem.props.ts +3 -8
  150. package/src/components/DescriptionList/DescriptionListItem.tsx +13 -21
  151. package/src/components/IndicatorIconButton/IndicatorIconButton.docs.mdx +85 -0
  152. package/src/components/IndicatorIconButton/IndicatorIconButton.props.ts +12 -0
  153. package/src/components/IndicatorIconButton/IndicatorIconButton.stories.tsx +142 -0
  154. package/src/components/IndicatorIconButton/IndicatorIconButton.tsx +36 -0
  155. package/src/components/IndicatorIconButton/index.tsx +2 -0
  156. package/src/components/Link/LinkText.tsx +4 -4
  157. package/src/components/List/List.context.ts +0 -1
  158. package/src/components/List/List.docs.mdx +376 -179
  159. package/src/components/List/List.props.ts +1 -9
  160. package/src/components/List/List.stories.tsx +289 -38
  161. package/src/components/List/List.tsx +5 -26
  162. package/src/components/List/ListAction/ListAction.props.ts +10 -0
  163. package/src/components/List/ListAction/ListAction.tsx +133 -0
  164. package/src/components/List/ListAction/ListActionContent.tsx +21 -0
  165. package/src/components/List/ListAction/ListActionText.tsx +14 -0
  166. package/src/components/List/ListAction/ListActionTrailingContent.tsx +9 -0
  167. package/src/components/List/ListAction/ListActionTrailingIcon.tsx +32 -0
  168. package/src/components/List/ListAction/index.ts +6 -0
  169. package/src/components/List/ListItem/ListItem.context.ts +1 -1
  170. package/src/components/List/ListItem/ListItem.props.ts +9 -5
  171. package/src/components/List/ListItem/ListItemRoot.tsx +18 -14
  172. package/src/components/List/ListItem/index.ts +4 -4
  173. package/src/components/List/index.ts +1 -0
  174. package/src/components/ProgressStepper/ProgressStep.tsx +134 -0
  175. package/src/components/ProgressStepper/ProgressStepper.docs.mdx +87 -0
  176. package/src/components/ProgressStepper/ProgressStepper.props.ts +27 -0
  177. package/src/components/ProgressStepper/ProgressStepper.stories.tsx +108 -0
  178. package/src/components/ProgressStepper/ProgressStepper.tsx +26 -0
  179. package/src/components/ProgressStepper/ProgressStepperRoot.tsx +32 -0
  180. package/src/components/ProgressStepper/index.ts +3 -0
  181. package/src/components/SectionHeader/SectionHeader.props.ts +9 -16
  182. package/src/components/SectionHeader/SectionHeader.stories.tsx +28 -18
  183. package/src/components/SectionHeader/SectionHeader.tsx +18 -19
  184. package/src/components/SectionHeader/SectionHeaderTrailingContent.tsx +20 -0
  185. package/src/components/SectionHeader/Sectionheader.docs.mdx +9 -24
  186. package/src/components/SectionHeader/index.ts +1 -0
  187. package/src/components/Switch/Switch.docs.mdx +0 -4
  188. package/src/components/Tabs/Tab.tsx +4 -2
  189. package/src/components/ThemedImage/ThemedImage.docs.mdx +208 -0
  190. package/src/components/ThemedImage/ThemedImage.props.ts +15 -0
  191. package/src/components/ThemedImage/ThemedImage.stories.tsx +175 -0
  192. package/src/components/ThemedImage/ThemedImage.tsx +34 -0
  193. package/src/components/ThemedImage/index.tsx +2 -0
  194. package/src/components/ToggleButton/ToggleButtonText.tsx +3 -3
  195. package/src/components/UnstyledIconButton/UnstyledIconButton.props.ts +2 -1
  196. package/src/components/index.ts +5 -0
  197. package/src/hooks/useStyleProps.ts +1 -1
  198. package/src/tokens/components/dark/button.ts +1 -1
  199. package/src/tokens/components/dark/dialog.ts +1 -0
  200. package/src/tokens/components/dark/illustrations.ts +1 -0
  201. package/src/tokens/components/dark/toast.ts +4 -1
  202. package/src/tokens/components/light/button.ts +1 -1
  203. package/src/tokens/components/light/dialog.ts +1 -0
  204. package/src/tokens/components/light/illustrations.ts +1 -0
  205. package/src/tokens/components/light/toast.ts +4 -1
  206. package/src/tokens/layout.ts +3 -6
  207. package/src/vite-env.d.ts +6 -0
@@ -0,0 +1,64 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createPressable } from '@gluestack-ui/pressable';
3
+ import { useContext } from 'react';
4
+ import { Pressable, View } from 'react-native';
5
+ import { StyleSheet } from 'react-native-unistyles';
6
+ import CarouselContext from './Carousel.context';
7
+ export const CarouselControlItemRoot = ({ active, style, index, activeStyle, onPress, disabled, ...props }) => {
8
+ const { inverted, numItems } = useContext(CarouselContext);
9
+ styles.useVariants({ active, inverted });
10
+ return (_jsx(Pressable, { style: [styles.item, active && activeStyle], onPress: onPress, disabled: disabled, accessibilityLabel: `Page ${index + 1} of ${numItems}`, ...props, children: _jsx(View, { style: [styles.circle, style] }) }));
11
+ };
12
+ const CarouselControlItem = createPressable({
13
+ Root: CarouselControlItemRoot,
14
+ });
15
+ CarouselControlItem.displayName = 'CarouselControlItem';
16
+ const styles = StyleSheet.create(theme => ({
17
+ item: {
18
+ width: 24,
19
+ height: 24,
20
+ alignItems: 'center',
21
+ justifyContent: 'center',
22
+ },
23
+ circle: {
24
+ width: theme.components.carouselControl.size,
25
+ height: theme.components.carouselControl.size,
26
+ borderRadius: theme.borderRadius.full,
27
+ borderColor: theme.color.interactive.functional.border.subtle,
28
+ borderWidth: theme.borderWidth[2],
29
+ backgroundColor: 'transparent',
30
+ paddingTop: theme.space['100'],
31
+ overflow: 'hidden',
32
+ _hover: {
33
+ backgroundColor: theme.color.interactive.functional.surface.subtle.hover,
34
+ },
35
+ variants: {
36
+ active: {
37
+ true: {
38
+ backgroundColor: theme.color.interactive.functional.foreground.subtle,
39
+ _hover: {
40
+ backgroundColor: theme.color.interactive.functional.foreground.subtle,
41
+ },
42
+ },
43
+ },
44
+ inverted: {
45
+ true: {
46
+ borderColor: theme.color.interactive.functional.border.inverted,
47
+ _hover: {
48
+ backgroundColor: theme.color.interactive.functional.surface.subtle.inverted.hover,
49
+ },
50
+ },
51
+ },
52
+ },
53
+ compoundVariants: [
54
+ {
55
+ active: true,
56
+ inverted: true,
57
+ styles: {
58
+ backgroundColor: theme.color.interactive.functional.foreground.inverted,
59
+ },
60
+ },
61
+ ],
62
+ },
63
+ }));
64
+ export default CarouselControlItem;
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { CarouselControlsProps } from './Carousel.props';
3
+ export declare const CarouselControls: FC<CarouselControlsProps>;
4
+ export default CarouselControls;
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { nanoid } from 'nanoid/non-secure';
3
+ import { useContext, useEffect, useMemo } from 'react';
4
+ import { StyleSheet } from 'react-native-unistyles';
5
+ import { View } from 'react-native';
6
+ import { ChevronLeftSmallIcon, ChevronRightSmallIcon, } from '@utilitywarehouse/hearth-react-native-icons';
7
+ import { UnstyledIconButton } from '../UnstyledIconButton';
8
+ import CarouselContext from './Carousel.context';
9
+ import CarouselControlItem from './CarouselControlItem';
10
+ export const CarouselControls = ({ testID = 'pagination', style, itemStyle, activeItemStyle, showNavigation = false, onPressPrev, onPressNext, accessibilityHidden, ...props }) => {
11
+ const context = useContext(CarouselContext);
12
+ const { activeIndex = 0, numItems = 0, setActiveIndex, controlsAccessibilityHidden, disabled = false, } = context;
13
+ const isAccessibilityHidden = accessibilityHidden ?? controlsAccessibilityHidden ?? true;
14
+ styles.useVariants({ showNavigation });
15
+ useEffect(() => {
16
+ if (!Object.keys(context).length) {
17
+ console.warn('CarouselControls must be a child of Carousel. Pagination will not be displayed.');
18
+ }
19
+ }, [context]);
20
+ const keys = useMemo(() => {
21
+ return Array(numItems)
22
+ .fill(null)
23
+ .map(() => nanoid());
24
+ }, [numItems]);
25
+ const handlePrev = () => {
26
+ if (activeIndex > 0) {
27
+ setActiveIndex(activeIndex - 1);
28
+ onPressPrev?.();
29
+ }
30
+ };
31
+ const handleNext = () => {
32
+ if (activeIndex < numItems - 1) {
33
+ setActiveIndex(activeIndex + 1);
34
+ onPressNext?.();
35
+ }
36
+ };
37
+ const handleItemPress = (index) => {
38
+ setActiveIndex(index);
39
+ };
40
+ if (!Object.keys(context).length) {
41
+ return null;
42
+ }
43
+ return (_jsxs(View, { style: [styles.root, style], testID: testID, importantForAccessibility: isAccessibilityHidden ? 'no-hide-descendants' : 'auto', accessibilityElementsHidden: isAccessibilityHidden, ...props, children: [showNavigation && (_jsx(UnstyledIconButton, { icon: ChevronLeftSmallIcon, onPress: handlePrev, disabled: disabled || activeIndex === 0, accessibilityLabel: "Previous", style: styles.button, inverted: context.inverted })), _jsx(View, { style: styles.dotsContainer, children: keys.map((_, index) => (_jsx(CarouselControlItem, { active: index === activeIndex, index: index, style: itemStyle, activeStyle: activeItemStyle, onPress: () => handleItemPress(index), disabled: disabled }, keys[index]))) }), showNavigation && (_jsx(UnstyledIconButton, { icon: ChevronRightSmallIcon, onPress: handleNext, disabled: disabled || activeIndex === numItems - 1, accessibilityLabel: "Next", style: styles.button, inverted: context.inverted }))] }));
44
+ };
45
+ const styles = StyleSheet.create(theme => ({
46
+ root: {
47
+ width: '100%',
48
+ alignSelf: 'center',
49
+ flexDirection: 'row',
50
+ alignItems: 'center',
51
+ gap: theme.components.carouselControl.gap,
52
+ justifyContent: 'space-between',
53
+ variants: {
54
+ showNavigation: {
55
+ true: {
56
+ justifyContent: 'space-between',
57
+ },
58
+ false: {
59
+ justifyContent: 'center',
60
+ },
61
+ },
62
+ },
63
+ },
64
+ dotsContainer: {
65
+ flexDirection: 'row',
66
+ gap: theme.components.carouselControl.gap,
67
+ },
68
+ button: {
69
+ width: 24,
70
+ height: 24,
71
+ },
72
+ }));
73
+ CarouselControls.displayName = 'CarouselControls';
74
+ export default CarouselControls;
@@ -0,0 +1,6 @@
1
+ import { CarouselItemProps } from './Carousel.props';
2
+ export declare const CarouselItem: {
3
+ ({ active, children, inactiveOpacity, style, width, ...props }: CarouselItemProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default CarouselItem;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect } from 'react';
3
+ import { Platform, View } from 'react-native';
4
+ import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
5
+ import { StyleSheet } from 'react-native-unistyles';
6
+ export const CarouselItem = ({ active, children, inactiveOpacity = 1, style, width, ...props }) => {
7
+ const isWeb = Platform.OS === 'web';
8
+ const opacity = useSharedValue(inactiveOpacity);
9
+ const animatedStyles = useAnimatedStyle(() => ({
10
+ opacity: opacity.value,
11
+ width,
12
+ }), [opacity, width]);
13
+ useEffect(() => {
14
+ opacity.value = withTiming(active ? 1 : inactiveOpacity, { duration: 200 });
15
+ }, [active, inactiveOpacity, opacity]);
16
+ // For web, use a regular View with CSS transitions
17
+ if (isWeb) {
18
+ return (_jsx(View, { style: [
19
+ styles.container,
20
+ style,
21
+ {
22
+ opacity: active ? 1 : inactiveOpacity,
23
+ width,
24
+ },
25
+ ], ...props, children: children }));
26
+ }
27
+ // For native, use Animated.View with reanimated
28
+ return (_jsx(Animated.View, { style: [styles.container, style, animatedStyles], ...props, children: children }));
29
+ };
30
+ CarouselItem.displayName = 'CarouselItem';
31
+ const styles = StyleSheet.create(() => ({
32
+ container: {
33
+ _web: {
34
+ transition: 'opacity 200ms ease-in-out',
35
+ },
36
+ },
37
+ }));
38
+ export default CarouselItem;
@@ -0,0 +1,5 @@
1
+ export * from './Carousel';
2
+ export * from './Carousel.props';
3
+ export * from './CarouselControls';
4
+ export * from './CarouselItem';
5
+ export { default as Carousel } from './Carousel';
@@ -0,0 +1,5 @@
1
+ export * from './Carousel';
2
+ export * from './Carousel.props';
3
+ export * from './CarouselControls';
4
+ export * from './CarouselItem';
5
+ export { default as Carousel } from './Carousel';
@@ -0,0 +1,6 @@
1
+ import type ContainerProps from './Container.props';
2
+ declare const Container: {
3
+ ({ style, children, space, ...props }: ContainerProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default Container;
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
+ import { useStyleProps } from '../../hooks';
5
+ const Container = ({ style, children, space = 'md', ...props }) => {
6
+ const { computedStyles, remainingProps } = useStyleProps(props);
7
+ styles.useVariants({ space });
8
+ return (_jsx(View, { style: [styles.container(computedStyles), style], ...remainingProps, children: children }));
9
+ };
10
+ Container.displayName = 'Container';
11
+ const styles = StyleSheet.create(theme => ({
12
+ container: extra => ({
13
+ paddingTop: typeof extra.padding === 'undefined' && typeof extra.paddingVertical === 'undefined'
14
+ ? {
15
+ base: theme.layout.mobile.container.paddingTop,
16
+ md: theme.layout.tablet.container.paddingTop,
17
+ lg: theme.layout.desktop.container.paddingTop,
18
+ }
19
+ : undefined,
20
+ paddingBottom: typeof extra.padding === 'undefined' && typeof extra.paddingVertical === 'undefined'
21
+ ? {
22
+ base: theme.layout.mobile.container.paddingBottom,
23
+ md: theme.layout.tablet.container.paddingBottom,
24
+ lg: theme.layout.desktop.container.paddingBottom,
25
+ }
26
+ : undefined,
27
+ marginHorizontal: typeof extra.margin === 'undefined' && typeof extra.marginHorizontal === 'undefined'
28
+ ? {
29
+ base: theme.layout.mobile.container.margin,
30
+ md: theme.layout.tablet.container.margin,
31
+ lg: theme.layout.desktop.container.margin,
32
+ }
33
+ : undefined,
34
+ ...extra,
35
+ variants: {
36
+ space: theme.globalStyle.variants.space,
37
+ },
38
+ }),
39
+ }));
40
+ export default Container;
@@ -0,0 +1,85 @@
1
+ import type { ViewProps } from 'react-native';
2
+ import { SpaceValue, SpacingValues } from '../../types';
3
+ interface ContainerProps extends ViewProps {
4
+ /**
5
+ * The padding of the container.
6
+ */
7
+ padding?: SpaceValue;
8
+ /**
9
+ * The horizontal padding of the container.
10
+ */
11
+ paddingHorizontal?: SpaceValue;
12
+ /**
13
+ * The vertical padding of the container.
14
+ */
15
+ paddingVertical?: SpaceValue;
16
+ /**
17
+ * The top padding of the container.
18
+ */
19
+ paddingTop?: SpaceValue;
20
+ /**
21
+ * The bottom padding of the container.
22
+ */
23
+ paddingBottom?: SpaceValue;
24
+ /**
25
+ * The left padding of the container.
26
+ */
27
+ paddingLeft?: SpaceValue;
28
+ /**
29
+ * The right padding of the container.
30
+ */
31
+ paddingRight?: SpaceValue;
32
+ /**
33
+ * The margin of the container.
34
+ */
35
+ margin?: SpaceValue;
36
+ /**
37
+ * The horizontal margin of the container.
38
+ */
39
+ marginHorizontal?: SpaceValue;
40
+ /**
41
+ * The vertical margin of the container.
42
+ */
43
+ marginVertical?: SpaceValue;
44
+ /**
45
+ * The top margin of the container.
46
+ */
47
+ marginTop?: SpaceValue;
48
+ /**
49
+ * The bottom margin of the container.
50
+ */
51
+ marginBottom?: SpaceValue;
52
+ /**
53
+ * The left margin of the container.
54
+ */
55
+ marginLeft?: SpaceValue;
56
+ /**
57
+ * The right margin of the container.
58
+ */
59
+ marginRight?: SpaceValue;
60
+ p?: SpaceValue;
61
+ px?: SpaceValue;
62
+ py?: SpaceValue;
63
+ pt?: SpaceValue;
64
+ pb?: SpaceValue;
65
+ pl?: SpaceValue;
66
+ pr?: SpaceValue;
67
+ m?: SpaceValue;
68
+ mx?: SpaceValue;
69
+ my?: SpaceValue;
70
+ mt?: SpaceValue;
71
+ mb?: SpaceValue;
72
+ ml?: SpaceValue;
73
+ mr?: SpaceValue;
74
+ /**
75
+ * The space between child elements (gap).
76
+ */
77
+ space?: SpacingValues;
78
+ /**
79
+ * The space between child elements.
80
+ */
81
+ gap?: SpaceValue;
82
+ backgroundColor?: 'backgroundBrand' | 'backgroundPrimary' | 'backgroundSecondary' | 'transparent';
83
+ bg?: 'backgroundBrand' | 'backgroundPrimary' | 'backgroundSecondary' | 'transparent';
84
+ }
85
+ export default ContainerProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as Container } from './Container';
2
+ export type { default as ContainerProps } from './Container.props';
@@ -0,0 +1 @@
1
+ export { default as Container } from './Container';
@@ -1,6 +1,6 @@
1
1
  import type DescriptionListProps from './DescriptionList.props';
2
2
  declare const DescriptionList: {
3
- ({ direction, itemHeadingWidth, heading, helperText, linkText, linkHref, linkIcon, linkIconPosition, linkOnPress, linkTarget, linkShowIcon, children, style, ...props }: DescriptionListProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ direction, itemHeadingWidth, heading, helperText, headerTrailingContent, children, style, ...props }: DescriptionListProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  };
6
6
  export default DescriptionList;
@@ -4,10 +4,10 @@ import { View } from 'react-native';
4
4
  import { StyleSheet } from 'react-native-unistyles';
5
5
  import { SectionHeader } from '../SectionHeader';
6
6
  import { DescriptionListContext } from './DescriptionList.context';
7
- const DescriptionList = ({ direction = 'column', itemHeadingWidth, heading, helperText, linkText, linkHref, linkIcon, linkIconPosition, linkOnPress, linkTarget, linkShowIcon, children, style, ...props }) => {
7
+ const DescriptionList = ({ direction = 'column', itemHeadingWidth, heading, helperText, headerTrailingContent, children, style, ...props }) => {
8
8
  styles.useVariants({ direction });
9
9
  const value = useMemo(() => ({ direction, itemHeadingWidth }), [direction, itemHeadingWidth]);
10
- return (_jsx(DescriptionListContext.Provider, { value: value, children: _jsxs(View, { accessibilityRole: "list", ...props, style: [styles.container, style], children: [heading ? (_jsx(SectionHeader, { heading: heading, helperText: helperText, linkText: linkText, linkHref: linkHref, linkIcon: linkIcon, linkIconPosition: linkIconPosition, linkOnPress: linkOnPress, linkTarget: linkTarget, linkShowIcon: linkShowIcon })) : null, children] }) }));
10
+ return (_jsx(DescriptionListContext.Provider, { value: value, children: _jsxs(View, { accessibilityRole: "list", ...props, style: [styles.container, style], children: [heading ? (_jsx(SectionHeader, { heading: heading, helperText: helperText, trailingContent: headerTrailingContent })) : null, children] }) }));
11
11
  };
12
12
  DescriptionList.displayName = 'DescriptionList';
13
13
  const styles = StyleSheet.create(theme => ({
@@ -1,4 +1,3 @@
1
- import { ComponentType } from 'react';
2
1
  import type { ViewProps } from 'react-native';
3
2
  export interface DescriptionListProps extends ViewProps {
4
3
  /** Direction orientation for items */
@@ -7,12 +6,6 @@ export interface DescriptionListProps extends ViewProps {
7
6
  itemHeadingWidth?: number;
8
7
  heading?: string;
9
8
  helperText?: string;
10
- linkText?: string;
11
- linkHref?: string;
12
- linkIcon?: ComponentType;
13
- linkIconPosition?: 'left' | 'right';
14
- linkOnPress?: () => void;
15
- linkTarget?: '_blank' | '_self' | '_parent' | '_top';
16
- linkShowIcon?: boolean;
9
+ headerTrailingContent?: React.ReactNode;
17
10
  }
18
11
  export default DescriptionListProps;
@@ -1,6 +1,6 @@
1
1
  import type DescriptionListItemProps from './DescriptionListItem.props';
2
2
  declare const DescriptionListItem: {
3
- ({ heading, description, headingWidth, linkText, linkHref, linkIcon, linkIconPosition, linkOnPress, linkTarget, linkShowIcon, style, ...props }: DescriptionListItemProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ heading, description, headingWidth, trailingContent, invalidText, style, ...props }: DescriptionListItemProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  };
6
6
  export default DescriptionListItem;
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ErrorCircleSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
2
3
  import { View } from 'react-native';
3
4
  import { StyleSheet } from 'react-native-unistyles';
4
5
  import { useTheme } from '../../hooks';
5
6
  import { BodyText } from '../BodyText';
6
- import { Link } from '../Link';
7
+ import Helper from '../Helper/Helper';
7
8
  import { useDescriptionListContext } from './DescriptionList.context';
8
- const DescriptionListItem = ({ heading, description, headingWidth, linkText, linkHref, linkIcon, linkIconPosition, linkOnPress, linkTarget, linkShowIcon, style, ...props }) => {
9
+ const DescriptionListItem = ({ heading, description, headingWidth, trailingContent, invalidText, style, ...props }) => {
9
10
  const { components } = useTheme();
10
11
  const { direction, itemHeadingWidth = components.descriptionList.item.row.headingWidth } = useDescriptionListContext();
11
12
  styles.useVariants({ direction });
@@ -13,7 +14,7 @@ const DescriptionListItem = ({ heading, description, headingWidth, linkText, lin
13
14
  const descIsText = typeof description === 'string' || typeof description === 'number';
14
15
  const combinedLabel = headingIsText && descIsText ? `${heading}: ${description}` : undefined;
15
16
  const hideDescendants = !!combinedLabel;
16
- return (_jsxs(View, { accessibilityRole: "text", accessible: !!combinedLabel, accessibilityLabel: combinedLabel, ...props, style: [styles.item, style], children: [_jsxs(View, { style: styles.textWrap, importantForAccessibility: hideDescendants ? 'no-hide-descendants' : undefined, accessibilityElementsHidden: hideDescendants || undefined, children: [_jsx(View, { style: [direction === 'row' && { width: headingWidth || itemHeadingWidth }], children: headingIsText ? _jsx(BodyText, { style: styles.headingText, children: heading }) : heading }), _jsx(View, { style: styles.descriptionWrapper, children: descIsText ? _jsx(BodyText, { children: description }) : description })] }), linkText ? (_jsx(Link, { href: linkHref, onPress: linkOnPress, target: linkTarget, showIcon: linkShowIcon, icon: linkIcon, iconPosition: linkIconPosition, accessibilityRole: "link", children: linkText })) : null] }));
17
+ return (_jsxs(View, { accessibilityRole: "text", accessible: !!combinedLabel, accessibilityLabel: combinedLabel, ...props, style: [styles.item, style], children: [_jsxs(View, { style: styles.textWrap, importantForAccessibility: hideDescendants ? 'no-hide-descendants' : undefined, accessibilityElementsHidden: hideDescendants || undefined, children: [_jsx(View, { style: [direction === 'row' && { width: headingWidth || itemHeadingWidth }], children: headingIsText ? _jsx(BodyText, { style: styles.headingText, children: heading }) : heading }), _jsxs(View, { style: styles.descriptionWrapper, children: [descIsText ? _jsx(BodyText, { children: description }) : description, !!invalidText && (_jsx(Helper, { validationStatus: "invalid", showIcon: true, icon: ErrorCircleSmallIcon, text: invalidText || '' }))] })] }), trailingContent ? trailingContent : null] }));
17
18
  };
18
19
  DescriptionListItem.displayName = 'DescriptionListItem';
19
20
  const styles = StyleSheet.create(theme => ({
@@ -1,4 +1,4 @@
1
- import type { ComponentType, ReactNode } from 'react';
1
+ import type { ReactNode } from 'react';
2
2
  import type { ViewProps } from 'react-native';
3
3
  export interface DescriptionListItemProps extends ViewProps {
4
4
  /** Heading / label part */
@@ -6,12 +6,7 @@ export interface DescriptionListItemProps extends ViewProps {
6
6
  /** Description / value part */
7
7
  description: ReactNode;
8
8
  headingWidth?: number;
9
- linkText?: string;
10
- linkHref?: string;
11
- linkIcon?: ComponentType;
12
- linkIconPosition?: 'left' | 'right';
13
- linkOnPress?: () => void;
14
- linkTarget?: '_blank' | '_self' | '_parent' | '_top';
15
- linkShowIcon?: boolean;
9
+ trailingContent?: ReactNode;
10
+ invalidText?: string;
16
11
  }
17
12
  export default DescriptionListItemProps;
@@ -0,0 +1,6 @@
1
+ import { IndicatorIconButtonProps } from './IndicatorIconButton.props';
2
+ declare const IndicatorIconButton: {
3
+ ({ indicator, ...props }: IndicatorIconButtonProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default IndicatorIconButton;
@@ -0,0 +1,26 @@
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 { UnstyledIconButton } from '../UnstyledIconButton';
5
+ const IndicatorIconButton = ({ indicator = false, ...props }) => {
6
+ return (_jsxs(View, { style: styles.container, children: [_jsx(UnstyledIconButton, { size: "md", ...props }), indicator && _jsx(View, { style: styles.indicator })] }));
7
+ };
8
+ IndicatorIconButton.displayName = 'IndicatorIconButton';
9
+ const styles = StyleSheet.create(theme => ({
10
+ container: {
11
+ position: 'relative',
12
+ width: theme.components.iconButton.unstyled.md.width,
13
+ height: theme.components.iconButton.unstyled.md.height,
14
+ },
15
+ indicator: {
16
+ position: 'absolute',
17
+ top: 2,
18
+ right: 1,
19
+ width: theme.components.indicatorIconButton.indicator.width,
20
+ height: theme.components.indicatorIconButton.indicator.height,
21
+ borderRadius: theme.components.indicatorIconButton.indicator.radius,
22
+ backgroundColor: theme.color.interactive.destructive.surface.strong.default,
23
+ zIndex: 1,
24
+ },
25
+ }));
26
+ export default IndicatorIconButton;
@@ -0,0 +1,8 @@
1
+ import { UnstyledIconButtonProps } from '../UnstyledIconButton';
2
+ export type IndicatorIconButtonProps = Omit<UnstyledIconButtonProps, 'size' | 'disabled' | 'loading'> & {
3
+ /**
4
+ * If `true`, displays a red dot indicator in the top-right corner.
5
+ * @default false
6
+ */
7
+ indicator?: boolean;
8
+ };
@@ -0,0 +1,2 @@
1
+ export { default as IndicatorIconButton } from './IndicatorIconButton';
2
+ export type { IndicatorIconButtonProps } from './IndicatorIconButton.props';
@@ -0,0 +1 @@
1
+ export { default as IndicatorIconButton } from './IndicatorIconButton';
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useLinkContext } from './Link.context';
3
2
  import { StyleSheet } from 'react-native-unistyles';
4
- import { DetailText } from '../DetailText';
3
+ import { BodyText } from '../BodyText';
4
+ import { useLinkContext } from './Link.context';
5
5
  const LinkText = ({ children, ...props }) => {
6
6
  const { inverted, disabled, active } = useLinkContext();
7
7
  styles.useVariants({ active, inverted, disabled });
8
- return (_jsx(DetailText, { size: "md", ...props, style: [styles.text, props.style], children: children }));
8
+ return (_jsx(BodyText, { size: "md", weight: "semibold", ...props, style: [styles.text, props.style], children: children }));
9
9
  };
10
10
  LinkText.displayName = 'LinkText';
11
11
  const styles = StyleSheet.create(theme => ({
@@ -2,12 +2,10 @@ import type ListProps from './List.props';
2
2
  export declare const ListContext: import("react").Context<{
3
3
  loading?: ListProps["loading"];
4
4
  disabled?: ListProps["disabled"];
5
- divider?: ListProps["divider"];
6
5
  container?: ListProps["container"];
7
6
  }>;
8
7
  export declare const useListContext: () => {
9
8
  loading?: ListProps["loading"];
10
9
  disabled?: ListProps["disabled"];
11
- divider?: ListProps["divider"];
12
10
  container?: ListProps["container"];
13
11
  };
@@ -1,6 +1,6 @@
1
1
  import type ListProps from './List.props';
2
2
  declare const List: {
3
- ({ children, heading, helperText, linkText, linkHref, linkIcon, linkIconPosition, linkOnPress, linkTarget, linkShowIcon, ...props }: ListProps): import("react/jsx-runtime").JSX.Element;
3
+ ({ children, heading, helperText, headerTrailingContent, ...props }: ListProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
5
5
  };
6
6
  export default List;
@@ -3,8 +3,8 @@ import React, { useMemo } from 'react';
3
3
  import { View } from 'react-native';
4
4
  import { StyleSheet } from 'react-native-unistyles';
5
5
  import { Card } from '../Card';
6
- import { ListContext } from './List.context';
7
6
  import { SectionHeader } from '../SectionHeader';
7
+ import { ListContext } from './List.context';
8
8
  import { ListItem } from './ListItem';
9
9
  const markFirstListItem = (children) => {
10
10
  let found = false;
@@ -33,8 +33,8 @@ const markFirstListItem = (children) => {
33
33
  };
34
34
  return recursiveClone(children);
35
35
  };
36
- const List = ({ children, heading, helperText, linkText, linkHref, linkIcon, linkIconPosition, linkOnPress, linkTarget, linkShowIcon, ...props }) => {
37
- const { loading, disabled, divider = true, container = 'none' } = props;
36
+ const List = ({ children, heading, helperText, headerTrailingContent, ...props }) => {
37
+ const { loading, disabled, container = 'none' } = props;
38
38
  const containerToCard = {
39
39
  variant: container === 'subtleWhite' || container === 'subtleWarmWhite' ? 'subtle' : 'emphasis',
40
40
  colorScheme: container === 'subtleWhite' || container === 'emphasisWhite'
@@ -42,9 +42,9 @@ const List = ({ children, heading, helperText, linkText, linkHref, linkIcon, lin
42
42
  : 'neutralSubtle',
43
43
  };
44
44
  const updatedChildren = markFirstListItem(children);
45
- const value = useMemo(() => ({ loading, disabled, divider, container }), [loading, disabled, divider, container]);
45
+ const value = useMemo(() => ({ loading, disabled, container }), [loading, disabled, container]);
46
46
  styles.useVariants({ disabled });
47
- return (_jsx(ListContext.Provider, { value: value, children: _jsxs(View, { ...props, style: [styles.container, props.style], children: [heading ? (_jsx(SectionHeader, { heading: heading, helperText: helperText, linkText: linkText, linkHref: linkHref, linkOnPress: linkOnPress, linkTarget: linkTarget, linkIcon: linkIcon, linkIconPosition: linkIconPosition, linkShowIcon: linkShowIcon })) : null, container === 'none' ? (_jsx(View, { children: updatedChildren })) : (_jsx(Card, { ...containerToCard, noPadding: true, style: styles.card, children: _jsx(_Fragment, { children: updatedChildren }) }))] }) }));
47
+ return (_jsx(ListContext.Provider, { value: value, children: _jsxs(View, { ...props, style: [styles.container, props.style], children: [heading ? (_jsx(SectionHeader, { heading: heading, helperText: helperText, trailingContent: headerTrailingContent })) : null, container === 'none' ? (_jsx(View, { children: updatedChildren })) : (_jsx(Card, { ...containerToCard, noPadding: true, style: styles.card, children: _jsx(_Fragment, { children: updatedChildren }) }))] }) }));
48
48
  };
49
49
  List.displayName = 'List';
50
50
  const styles = StyleSheet.create(theme => ({
@@ -1,18 +1,10 @@
1
1
  import type { ViewProps } from 'react-native';
2
- import { ComponentType } from 'react';
3
2
  interface ListProps extends ViewProps {
4
3
  container?: 'none' | 'subtleWhite' | 'emphasisWhite' | 'subtleWarmWhite' | 'emphasisWarmWhite';
5
4
  heading?: string;
6
5
  helperText?: string;
7
- linkText?: string;
8
- linkHref?: string;
9
- linkIcon?: ComponentType;
10
- linkIconPosition?: 'left' | 'right';
11
- linkOnPress?: () => void;
12
- linkTarget?: '_blank' | '_self' | '_parent' | '_top';
13
- linkShowIcon?: boolean;
6
+ headerTrailingContent?: React.ReactNode;
14
7
  disabled?: boolean;
15
8
  loading?: boolean;
16
- divider?: boolean;
17
9
  }
18
10
  export default ListProps;
@@ -0,0 +1,18 @@
1
+ import type ListActionProps from './ListAction.props';
2
+ declare const ListAction: import("react").ForwardRefExoticComponent<ListActionProps & {
3
+ states?: {
4
+ active?: boolean;
5
+ disabled?: boolean;
6
+ };
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 ListAction;