@utilitywarehouse/hearth-react-native 0.4.2 → 0.5.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 (180) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-lint.log +1 -1
  3. package/CHANGELOG.md +44 -0
  4. package/build/components/Alert/AlertTitle.js +6 -6
  5. package/build/components/Badge/Badge.js +3 -3
  6. package/build/components/Badge/Badge.props.d.ts +1 -0
  7. package/build/components/Button/ButtonRoot.js +4 -0
  8. package/build/components/Button/ButtonText.js +2 -2
  9. package/build/components/Card/CardRoot.js +1 -1
  10. package/build/components/Carousel/Carousel.context.d.ts +4 -0
  11. package/build/components/Carousel/Carousel.context.js +4 -0
  12. package/build/components/Carousel/Carousel.d.ts +6 -0
  13. package/build/components/Carousel/Carousel.js +278 -0
  14. package/build/components/Carousel/Carousel.props.d.ts +65 -0
  15. package/build/components/Carousel/Carousel.props.js +1 -0
  16. package/build/components/Carousel/CarouselControlItem.d.ts +24 -0
  17. package/build/components/Carousel/CarouselControlItem.js +64 -0
  18. package/build/components/Carousel/CarouselControls.d.ts +4 -0
  19. package/build/components/Carousel/CarouselControls.js +74 -0
  20. package/build/components/Carousel/CarouselItem.d.ts +6 -0
  21. package/build/components/Carousel/CarouselItem.js +38 -0
  22. package/build/components/Carousel/index.d.ts +5 -0
  23. package/build/components/Carousel/index.js +5 -0
  24. package/build/components/DescriptionList/DescriptionList.d.ts +1 -1
  25. package/build/components/DescriptionList/DescriptionList.js +2 -2
  26. package/build/components/DescriptionList/DescriptionList.props.d.ts +1 -8
  27. package/build/components/DescriptionList/DescriptionListItem.d.ts +1 -1
  28. package/build/components/DescriptionList/DescriptionListItem.js +4 -3
  29. package/build/components/DescriptionList/DescriptionListItem.props.d.ts +3 -8
  30. package/build/components/IndicatorIconButton/IndicatorIconButton.d.ts +6 -0
  31. package/build/components/IndicatorIconButton/IndicatorIconButton.js +26 -0
  32. package/build/components/IndicatorIconButton/IndicatorIconButton.props.d.ts +8 -0
  33. package/build/components/IndicatorIconButton/IndicatorIconButton.props.js +1 -0
  34. package/build/components/IndicatorIconButton/index.d.ts +2 -0
  35. package/build/components/IndicatorIconButton/index.js +1 -0
  36. package/build/components/Link/LinkText.js +3 -3
  37. package/build/components/List/List.context.d.ts +0 -2
  38. package/build/components/List/List.d.ts +1 -1
  39. package/build/components/List/List.js +5 -5
  40. package/build/components/List/List.props.d.ts +1 -9
  41. package/build/components/List/ListAction/ListAction.d.ts +18 -0
  42. package/build/components/List/ListAction/ListAction.js +103 -0
  43. package/build/components/List/ListAction/ListAction.props.d.ts +8 -0
  44. package/build/components/List/ListAction/ListAction.props.js +1 -0
  45. package/build/components/List/ListAction/ListActionContent.d.ts +6 -0
  46. package/build/components/List/ListAction/ListActionContent.js +14 -0
  47. package/build/components/List/ListAction/ListActionText.d.ts +6 -0
  48. package/build/components/List/ListAction/ListActionText.js +7 -0
  49. package/build/components/List/ListAction/ListActionTrailingContent.d.ts +6 -0
  50. package/build/components/List/ListAction/ListActionTrailingContent.js +5 -0
  51. package/build/components/List/ListAction/ListActionTrailingIcon.d.ts +9 -0
  52. package/build/components/List/ListAction/ListActionTrailingIcon.js +18 -0
  53. package/build/components/List/ListAction/index.d.ts +6 -0
  54. package/build/components/List/ListAction/index.js +5 -0
  55. package/build/components/List/ListItem/ListItem.context.d.ts +1 -1
  56. package/build/components/List/ListItem/ListItem.props.d.ts +9 -5
  57. package/build/components/List/ListItem/ListItemRoot.d.ts +1 -1
  58. package/build/components/List/ListItem/ListItemRoot.js +10 -12
  59. package/build/components/List/ListItem/index.d.ts +4 -4
  60. package/build/components/List/ListItem/index.js +3 -3
  61. package/build/components/List/index.d.ts +1 -0
  62. package/build/components/List/index.js +1 -0
  63. package/build/components/ProgressStepper/ProgressStep.d.ts +10 -0
  64. package/build/components/ProgressStepper/ProgressStep.js +100 -0
  65. package/build/components/ProgressStepper/ProgressStepper.d.ts +6 -0
  66. package/build/components/ProgressStepper/ProgressStepper.js +22 -0
  67. package/build/components/ProgressStepper/ProgressStepper.props.d.ts +22 -0
  68. package/build/components/ProgressStepper/ProgressStepper.props.js +1 -0
  69. package/build/components/ProgressStepper/ProgressStepperRoot.d.ts +6 -0
  70. package/build/components/ProgressStepper/ProgressStepperRoot.js +16 -0
  71. package/build/components/ProgressStepper/index.d.ts +3 -0
  72. package/build/components/ProgressStepper/index.js +2 -0
  73. package/build/components/SectionHeader/SectionHeader.d.ts +1 -1
  74. package/build/components/SectionHeader/SectionHeader.js +6 -3
  75. package/build/components/SectionHeader/SectionHeader.props.d.ts +9 -16
  76. package/build/components/SectionHeader/SectionHeaderTrailingContent.d.ts +6 -0
  77. package/build/components/SectionHeader/SectionHeaderTrailingContent.js +13 -0
  78. package/build/components/SectionHeader/index.d.ts +1 -0
  79. package/build/components/SectionHeader/index.js +1 -0
  80. package/build/components/Tabs/Tab.js +2 -2
  81. package/build/components/ToggleButton/ToggleButtonText.js +2 -2
  82. package/build/components/UnstyledIconButton/UnstyledIconButton.props.d.ts +4 -1
  83. package/build/components/index.d.ts +3 -0
  84. package/build/components/index.js +3 -0
  85. package/build/core/themes.d.ts +12 -24
  86. package/build/tokens/components/dark/button.d.ts +1 -1
  87. package/build/tokens/components/dark/button.js +1 -1
  88. package/build/tokens/components/dark/dialog.d.ts +1 -0
  89. package/build/tokens/components/dark/dialog.js +1 -0
  90. package/build/tokens/components/dark/illustrations.d.ts +1 -0
  91. package/build/tokens/components/dark/illustrations.js +1 -0
  92. package/build/tokens/components/dark/toast.d.ts +4 -1
  93. package/build/tokens/components/dark/toast.js +4 -1
  94. package/build/tokens/components/light/button.d.ts +1 -1
  95. package/build/tokens/components/light/button.js +1 -1
  96. package/build/tokens/components/light/dialog.d.ts +1 -0
  97. package/build/tokens/components/light/dialog.js +1 -0
  98. package/build/tokens/components/light/illustrations.d.ts +1 -0
  99. package/build/tokens/components/light/illustrations.js +1 -0
  100. package/build/tokens/components/light/toast.d.ts +4 -1
  101. package/build/tokens/components/light/toast.js +4 -1
  102. package/build/tokens/layout.d.ts +6 -12
  103. package/build/tokens/layout.js +3 -6
  104. package/docs/components/AllComponents.web.tsx +86 -4
  105. package/docs/components/BadgeList.tsx +20 -56
  106. package/docs/components/SwitchList.tsx +4 -8
  107. package/docs/getting-started.mdx +30 -14
  108. package/docs/introduction.mdx +1 -1
  109. package/package.json +4 -4
  110. package/src/components/Alert/AlertTitle.tsx +7 -7
  111. package/src/components/Badge/Badge.props.ts +1 -0
  112. package/src/components/Badge/Badge.tsx +3 -2
  113. package/src/components/Button/ButtonRoot.tsx +4 -0
  114. package/src/components/Button/ButtonText.tsx +3 -3
  115. package/src/components/Card/CardRoot.tsx +2 -0
  116. package/src/components/Carousel/Carousel.context.tsx +8 -0
  117. package/src/components/Carousel/Carousel.docs.mdx +389 -0
  118. package/src/components/Carousel/Carousel.props.ts +89 -0
  119. package/src/components/Carousel/Carousel.stories.tsx +317 -0
  120. package/src/components/Carousel/Carousel.tsx +444 -0
  121. package/src/components/Carousel/CarouselControlItem.tsx +87 -0
  122. package/src/components/Carousel/CarouselControls.tsx +150 -0
  123. package/src/components/Carousel/CarouselItem.tsx +68 -0
  124. package/src/components/Carousel/index.ts +6 -0
  125. package/src/components/DescriptionList/DescriptionList.docs.mdx +24 -27
  126. package/src/components/DescriptionList/DescriptionList.props.ts +1 -8
  127. package/src/components/DescriptionList/DescriptionList.stories.tsx +13 -19
  128. package/src/components/DescriptionList/DescriptionList.tsx +2 -14
  129. package/src/components/DescriptionList/DescriptionListItem.props.ts +3 -8
  130. package/src/components/DescriptionList/DescriptionListItem.tsx +13 -21
  131. package/src/components/IndicatorIconButton/IndicatorIconButton.docs.mdx +85 -0
  132. package/src/components/IndicatorIconButton/IndicatorIconButton.props.ts +12 -0
  133. package/src/components/IndicatorIconButton/IndicatorIconButton.stories.tsx +142 -0
  134. package/src/components/IndicatorIconButton/IndicatorIconButton.tsx +36 -0
  135. package/src/components/IndicatorIconButton/index.tsx +2 -0
  136. package/src/components/Link/LinkText.tsx +4 -4
  137. package/src/components/List/List.context.ts +0 -1
  138. package/src/components/List/List.docs.mdx +376 -179
  139. package/src/components/List/List.props.ts +1 -9
  140. package/src/components/List/List.stories.tsx +289 -38
  141. package/src/components/List/List.tsx +5 -26
  142. package/src/components/List/ListAction/ListAction.props.ts +10 -0
  143. package/src/components/List/ListAction/ListAction.tsx +133 -0
  144. package/src/components/List/ListAction/ListActionContent.tsx +21 -0
  145. package/src/components/List/ListAction/ListActionText.tsx +14 -0
  146. package/src/components/List/ListAction/ListActionTrailingContent.tsx +9 -0
  147. package/src/components/List/ListAction/ListActionTrailingIcon.tsx +32 -0
  148. package/src/components/List/ListAction/index.ts +6 -0
  149. package/src/components/List/ListItem/ListItem.context.ts +1 -1
  150. package/src/components/List/ListItem/ListItem.props.ts +9 -5
  151. package/src/components/List/ListItem/ListItemRoot.tsx +18 -14
  152. package/src/components/List/ListItem/index.ts +4 -4
  153. package/src/components/List/index.ts +1 -0
  154. package/src/components/ProgressStepper/ProgressStep.tsx +134 -0
  155. package/src/components/ProgressStepper/ProgressStepper.docs.mdx +87 -0
  156. package/src/components/ProgressStepper/ProgressStepper.props.ts +27 -0
  157. package/src/components/ProgressStepper/ProgressStepper.stories.tsx +108 -0
  158. package/src/components/ProgressStepper/ProgressStepper.tsx +26 -0
  159. package/src/components/ProgressStepper/ProgressStepperRoot.tsx +32 -0
  160. package/src/components/ProgressStepper/index.ts +3 -0
  161. package/src/components/SectionHeader/SectionHeader.props.ts +9 -16
  162. package/src/components/SectionHeader/SectionHeader.stories.tsx +28 -18
  163. package/src/components/SectionHeader/SectionHeader.tsx +18 -19
  164. package/src/components/SectionHeader/SectionHeaderTrailingContent.tsx +20 -0
  165. package/src/components/SectionHeader/Sectionheader.docs.mdx +9 -24
  166. package/src/components/SectionHeader/index.ts +1 -0
  167. package/src/components/Switch/Switch.docs.mdx +0 -4
  168. package/src/components/Tabs/Tab.tsx +4 -2
  169. package/src/components/ToggleButton/ToggleButtonText.tsx +3 -3
  170. package/src/components/UnstyledIconButton/UnstyledIconButton.props.ts +2 -1
  171. package/src/components/index.ts +3 -0
  172. package/src/tokens/components/dark/button.ts +1 -1
  173. package/src/tokens/components/dark/dialog.ts +1 -0
  174. package/src/tokens/components/dark/illustrations.ts +1 -0
  175. package/src/tokens/components/dark/toast.ts +4 -1
  176. package/src/tokens/components/light/button.ts +1 -1
  177. package/src/tokens/components/light/dialog.ts +1 -0
  178. package/src/tokens/components/light/illustrations.ts +1 -0
  179. package/src/tokens/components/light/toast.ts +4 -1
  180. package/src/tokens/layout.ts +3 -6
@@ -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';
@@ -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;
@@ -0,0 +1,103 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createPressable } from '@gluestack-ui/pressable';
3
+ import { ChevronRightSmallIcon } from '@utilitywarehouse/hearth-react-native-icons';
4
+ import { Pressable } from 'react-native';
5
+ import { StyleSheet } from 'react-native-unistyles';
6
+ import { useListContext } from '../List.context';
7
+ import ListActionContent from './ListActionContent';
8
+ import ListActionText from './ListActionText';
9
+ import ListActionTrailingContent from './ListActionTrailingContent';
10
+ import ListActionTrailingIcon from './ListActionTrailingIcon';
11
+ const ListActionRoot = ({ heading, disabled, variant = 'subtle', ...props }) => {
12
+ const { onPress } = props;
13
+ const listContext = useListContext();
14
+ const { active } = props.states || { active: false };
15
+ const getListContainer = () => {
16
+ if (listContext?.container?.includes('subtle')) {
17
+ return 'subtle';
18
+ }
19
+ if (listContext?.container?.includes('emphasis')) {
20
+ return 'emphasis';
21
+ }
22
+ return undefined;
23
+ };
24
+ const isDisabled = disabled || listContext?.disabled || false;
25
+ const listItemVariant = getListContainer() || variant;
26
+ const testID = props.testID || 'list-action';
27
+ styles.useVariants({
28
+ variant: listItemVariant,
29
+ disabled: isDisabled,
30
+ active,
31
+ showDisabled: !listContext?.disabled && disabled,
32
+ isFirstChild: props.isFirst,
33
+ container: listContext?.container,
34
+ });
35
+ return (_jsxs(Pressable, { ...props, testID: testID, style: [styles.container, props.style], disabled: isDisabled || !onPress, children: [_jsx(ListActionContent, { children: _jsx(ListActionText, { children: heading }) }), _jsx(ListActionTrailingContent, { style: styles.centeredTrailingIcon, children: _jsx(ListActionTrailingIcon, { as: ChevronRightSmallIcon }) })] }));
36
+ };
37
+ const ListAction = createPressable({
38
+ Root: ListActionRoot,
39
+ });
40
+ ListAction.displayName = 'ListAction';
41
+ const styles = StyleSheet.create(theme => ({
42
+ container: {
43
+ paddingVertical: theme.components.list.item.functional.padding,
44
+ paddingHorizontal: theme.components.list.item.functional.padding,
45
+ flexDirection: 'row',
46
+ gap: theme.components.list.item.gap,
47
+ borderTopWidth: theme.borderWidth['1'],
48
+ borderStyle: 'solid',
49
+ variants: {
50
+ isFirstChild: {
51
+ true: {
52
+ borderTopWidth: 0,
53
+ },
54
+ },
55
+ variant: {
56
+ subtle: {
57
+ borderTopColor: theme.color.border.subtle,
58
+ },
59
+ emphasis: {
60
+ borderTopColor: theme.color.border.strong,
61
+ },
62
+ },
63
+ active: {
64
+ true: {
65
+ backgroundColor: theme.color.interactive.neutral.surface.subtle.active,
66
+ },
67
+ },
68
+ disabled: {
69
+ true: {
70
+ cursor: 'auto',
71
+ },
72
+ false: {
73
+ _web: {
74
+ _hover: {
75
+ backgroundColor: theme.color.interactive.neutral.surface.subtle.hover,
76
+ },
77
+ _active: {
78
+ backgroundColor: theme.color.interactive.neutral.surface.subtle.active,
79
+ },
80
+ },
81
+ },
82
+ },
83
+ showDisabled: {
84
+ true: {
85
+ opacity: theme.opacity.disabled,
86
+ },
87
+ },
88
+ container: {
89
+ none: {
90
+ paddingHorizontal: 0,
91
+ },
92
+ subtleWhite: {},
93
+ emphasisWhite: {},
94
+ subtleWarmWhite: {},
95
+ emphasisWarmWhite: {},
96
+ },
97
+ },
98
+ },
99
+ centeredTrailingIcon: {
100
+ justifyContent: 'center',
101
+ },
102
+ }));
103
+ export default ListAction;
@@ -0,0 +1,8 @@
1
+ import type { PressableProps } from 'react-native';
2
+ interface ListActionProps extends Omit<PressableProps, 'children'> {
3
+ heading: string;
4
+ disabled?: boolean;
5
+ variant?: 'subtle' | 'emphasis';
6
+ isFirst?: boolean;
7
+ }
8
+ export default ListActionProps;
@@ -0,0 +1,6 @@
1
+ import { type ViewProps } from 'react-native';
2
+ declare const ListActionContent: {
3
+ ({ children, ...props }: ViewProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default ListActionContent;
@@ -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 ListActionContent = ({ children, ...props }) => {
5
+ return (_jsx(View, { ...props, style: [styles.container, props.style], children: children }));
6
+ };
7
+ ListActionContent.displayName = 'ListActionContent';
8
+ const styles = StyleSheet.create(theme => ({
9
+ container: {
10
+ gap: theme.components.list.item.contentGap,
11
+ flex: 1,
12
+ },
13
+ }));
14
+ export default ListActionContent;
@@ -0,0 +1,6 @@
1
+ import { TextProps } from 'react-native';
2
+ declare const ListActionText: {
3
+ ({ children, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default ListActionText;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { BodyText } from '../../BodyText';
3
+ const ListActionText = ({ children, ...props }) => {
4
+ return (_jsx(BodyText, { size: "md", weight: "semibold", ...props, children: children }));
5
+ };
6
+ ListActionText.displayName = 'ListActionText';
7
+ export default ListActionText;
@@ -0,0 +1,6 @@
1
+ import { type ViewProps } from 'react-native';
2
+ declare const ListActionTrailingContent: {
3
+ ({ children, ...props }: ViewProps): import("react/jsx-runtime").JSX.Element;
4
+ displayName: string;
5
+ };
6
+ export default ListActionTrailingContent;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ const ListActionTrailingContent = ({ children, ...props }) => (_jsx(View, { ...props, children: children }));
4
+ ListActionTrailingContent.displayName = 'ListActionTrailingContent';
5
+ export default ListActionTrailingContent;
@@ -0,0 +1,9 @@
1
+ import { ComponentType } from 'react';
2
+ import { IconProps } from '../../Icon';
3
+ declare const ListActionTrailingIcon: {
4
+ ({ children, ...props }: IconProps & {
5
+ as?: ComponentType;
6
+ }): import("react/jsx-runtime").JSX.Element;
7
+ displayName: string;
8
+ };
9
+ export default ListActionTrailingIcon;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Platform } from 'react-native';
3
+ import { StyleSheet } from 'react-native-unistyles';
4
+ import { Icon } from '../../Icon';
5
+ const ListActionTrailingIcon = ({ children, ...props }) => {
6
+ return (_jsx(Icon, { ...props, style: Platform.OS === 'web'
7
+ ? StyleSheet.compose(styles.icon, props.style)
8
+ : [styles.icon, props.style], children: children }));
9
+ };
10
+ ListActionTrailingIcon.displayName = 'ListActionTrailingIcon';
11
+ const styles = StyleSheet.create(theme => ({
12
+ icon: {
13
+ color: theme.color.icon.primary,
14
+ width: 24,
15
+ height: 24,
16
+ },
17
+ }));
18
+ export default ListActionTrailingIcon;
@@ -0,0 +1,6 @@
1
+ export { default as ListAction } from './ListAction';
2
+ export type { default as ListActionProps } from './ListAction.props';
3
+ export { default as ListActionContent } from './ListActionContent';
4
+ export { default as ListActionText } from './ListActionText';
5
+ export { default as ListActionTrailingContent } from './ListActionTrailingContent';
6
+ export { default as ListActionTrailingIcon } from './ListActionTrailingIcon';
@@ -0,0 +1,5 @@
1
+ export { default as ListAction } from './ListAction';
2
+ export { default as ListActionContent } from './ListActionContent';
3
+ export { default as ListActionText } from './ListActionText';
4
+ export { default as ListActionTrailingContent } from './ListActionTrailingContent';
5
+ export { default as ListActionTrailingIcon } from './ListActionTrailingIcon';
@@ -1,5 +1,5 @@
1
1
  import ListItemProps from './ListItem.props';
2
- export interface IListItemContext extends Pick<ListItemProps, 'divider' | 'loading' | 'disabled'> {
2
+ export interface IListItemContext extends Pick<ListItemProps, 'loading' | 'disabled'> {
3
3
  showPressed?: boolean;
4
4
  active?: boolean;
5
5
  }