@momo-kits/foundation 0.169.7-beta.3 → 0.169.7-beta.4

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 (141) hide show
  1. package/Application/BottomSheet.hooks.ts +8 -8
  2. package/Application/BottomSheet.parts.tsx +34 -44
  3. package/Application/BottomSheet.tsx +37 -40
  4. package/Application/BottomTab/ActiveIndicator.tsx +14 -15
  5. package/Application/BottomTab/BottomTabBar.tsx +62 -49
  6. package/Application/BottomTab/BottomTabInset.tsx +4 -8
  7. package/Application/BottomTab/CurvedContainer.tsx +12 -14
  8. package/Application/BottomTab/CustomBottomTabItem.tsx +13 -13
  9. package/Application/BottomTab/DuoBarCompression.tsx +19 -13
  10. package/Application/BottomTab/DuoRailTabBar.tsx +24 -20
  11. package/Application/BottomTab/DuoTabBar.tsx +10 -8
  12. package/Application/BottomTab/TabBarIcon.tsx +29 -15
  13. package/Application/BottomTab/TabScreen.tsx +5 -1
  14. package/Application/BottomTab/index.tsx +30 -33
  15. package/Application/BottomTab/metrics.ts +23 -23
  16. package/Application/BottomTab/tabItems.ts +1 -1
  17. package/Application/BottomTab/usePressLift.ts +2 -2
  18. package/Application/Components/BackgroundImageView.tsx +0 -4
  19. package/Application/Components/DuoGlassBackground.tsx +4 -5
  20. package/Application/Components/HeaderAnimated.tsx +0 -4
  21. package/Application/Components/HeaderBackground.tsx +0 -4
  22. package/Application/Components/HeaderExtendHeader.tsx +10 -11
  23. package/Application/Components/HeaderLeft.tsx +1 -2
  24. package/Application/Components/HeaderRight.tsx +1 -2
  25. package/Application/Components/HeaderTitle.shared.ts +9 -11
  26. package/Application/Components/HeaderTitle.tsx +3 -4
  27. package/Application/Components/HeaderToolkitAction.tsx +20 -17
  28. package/Application/Components/NavigationButton.tsx +1 -2
  29. package/Application/Components/SearchHeader.tsx +10 -17
  30. package/Application/Components/TitleJourney.tsx +2 -2
  31. package/Application/Components/TitleLocation.tsx +2 -2
  32. package/Application/Components/TitleUser.tsx +2 -2
  33. package/Application/Components/useToolkitActions.tsx +32 -17
  34. package/Application/KitAdoption/AdoptionBadge.tsx +119 -0
  35. package/Application/KitAdoption/AdoptionProbe.tsx +166 -0
  36. package/Application/KitAdoption/AdoptionStore.ts +80 -0
  37. package/Application/KitAdoption/Authorship/utils.ts +137 -0
  38. package/Application/KitAdoption/Slots/utils.ts +68 -0
  39. package/Application/KitAdoption/constants.ts +120 -0
  40. package/Application/KitAdoption/index.ts +12 -0
  41. package/Application/KitAdoption/styles.ts +55 -0
  42. package/Application/KitAdoption/types.ts +61 -0
  43. package/Application/KitAdoption/utils.ts +376 -0
  44. package/Application/Localize.ts +0 -7
  45. package/Application/ModalScreen.tsx +10 -10
  46. package/Application/Navigation.ts +16 -14
  47. package/Application/NavigationContainer.tsx +18 -19
  48. package/Application/Navigator.ts +48 -20
  49. package/Application/ScaleSizeProvider.tsx +6 -13
  50. package/Application/StackScreen.tracking.ts +33 -11
  51. package/Application/StackScreen.tsx +54 -10
  52. package/Application/TooltipPortal.tsx +5 -12
  53. package/Application/WidgetContainer.tsx +4 -10
  54. package/Application/__tests__/KitAdoption.integration.test.tsx +253 -0
  55. package/Application/__tests__/KitAdoption.test.ts +283 -0
  56. package/Application/__tests__/KitAdoptionAuthorship.test.ts +132 -0
  57. package/Application/__tests__/KitAdoptionStore.test.ts +110 -0
  58. package/Application/__tests__/KitAdoptionStructural.test.ts +193 -0
  59. package/Application/__tests__/modalLayout.test.ts +128 -0
  60. package/Application/modalLayout.ts +14 -16
  61. package/Application/navigationOptions.tsx +17 -21
  62. package/Badge/Badge.tsx +0 -5
  63. package/Badge/BadgeDot.tsx +0 -1
  64. package/Badge/BadgeDotAnimation.tsx +7 -15
  65. package/Badge/BadgeRibbon.tsx +38 -46
  66. package/Badge/Shape.tsx +0 -2
  67. package/Badge/types.ts +2 -2
  68. package/Button/index.tsx +16 -5
  69. package/Button/utils.ts +15 -9
  70. package/CheckBox/index.tsx +0 -4
  71. package/Consts/theme.ts +10 -10
  72. package/Context/index.ts +1 -5
  73. package/Divider/DashDivider.tsx +0 -1
  74. package/Divider/index.tsx +0 -4
  75. package/FoundationList/index.tsx +0 -4
  76. package/Icon/index.tsx +6 -6
  77. package/Icon/types.ts +1 -1
  78. package/IconButton/index.tsx +12 -4
  79. package/Image/index.tsx +7 -9
  80. package/Input/Input.tsx +9 -8
  81. package/Input/InputDropDown.tsx +12 -10
  82. package/Input/InputMoney.tsx +8 -12
  83. package/Input/InputMoneyView.tsx +7 -14
  84. package/Input/InputOTP.tsx +33 -35
  85. package/Input/InputPhoneNumber.tsx +9 -8
  86. package/Input/InputSearch.tsx +6 -4
  87. package/Input/InputTextArea.tsx +0 -4
  88. package/Input/SearchTextTyping.tsx +0 -4
  89. package/Input/SystemTextInput.tsx +2 -7
  90. package/Input/TextTyping.tsx +0 -4
  91. package/Input/common.tsx +12 -26
  92. package/Input/index.tsx +20 -17
  93. package/Input/moneyUtils.ts +4 -10
  94. package/Input/styles.ts +5 -0
  95. package/Input/utils.ts +12 -14
  96. package/Layout/Card.tsx +4 -7
  97. package/Layout/FloatingButton.tsx +0 -4
  98. package/Layout/Item.tsx +2 -6
  99. package/Layout/ItemList.tsx +7 -9
  100. package/Layout/ItemSectionList.tsx +1 -2
  101. package/Layout/ReservedRegions.tsx +25 -25
  102. package/Layout/Screen.tsx +58 -56
  103. package/Layout/Section.tsx +5 -8
  104. package/Layout/TrackingScope.tsx +0 -1
  105. package/Layout/screenContent.tsx +2 -4
  106. package/Layout/screenFooter.tsx +18 -28
  107. package/Layout/screenHeader.tsx +31 -34
  108. package/Layout/screenQuickReturn.tsx +20 -17
  109. package/Layout/screenScroll.ts +7 -4
  110. package/Layout/screenTypes.ts +2 -3
  111. package/Layout/types.ts +4 -2
  112. package/Layout/utils.ts +37 -31
  113. package/Loader/DotLoader.tsx +0 -4
  114. package/Loader/Loader.tsx +0 -4
  115. package/Loader/ProgressBar.tsx +0 -1
  116. package/Loader/Spinner.tsx +0 -4
  117. package/Loader/utils.ts +7 -11
  118. package/Pagination/Dot.tsx +0 -4
  119. package/Pagination/PaginationDot.tsx +0 -1
  120. package/Pagination/PaginationNumber.tsx +3 -5
  121. package/Pagination/PaginationScroll.tsx +0 -5
  122. package/Pagination/PaginationWhiteDot.tsx +0 -1
  123. package/Pagination/index.tsx +0 -4
  124. package/Pagination/types.ts +2 -2
  125. package/Popup/PopupNotify.tsx +49 -45
  126. package/Popup/PopupPromotion.tsx +7 -4
  127. package/Popup/types.ts +4 -4
  128. package/Popup/utils.ts +4 -11
  129. package/Radio/index.tsx +0 -4
  130. package/Skeleton/index.tsx +0 -8
  131. package/Switch/index.tsx +0 -1
  132. package/Tag/index.tsx +1 -5
  133. package/Tag/types.ts +3 -3
  134. package/Text/index.tsx +3 -14
  135. package/Text/styles.ts +1 -1
  136. package/Text/types.ts +6 -1
  137. package/Text/utils.ts +4 -20
  138. package/Title/index.tsx +32 -41
  139. package/ViewBoundary/index.tsx +2 -4
  140. package/index.ts +6 -0
  141. package/package.json +1 -1
@@ -8,10 +8,6 @@ import { Text } from '../Text';
8
8
  import { Colors } from '../Consts';
9
9
  import { Image } from '../Image';
10
10
 
11
- /**
12
- * Corner ribbon label in the warning color, skewed or `isRound`. Right-corner
13
- * ribbons are rotated 180deg with the text counter-rotated to stay upright.
14
- */
15
11
  const BadgeRibbon: FC<BadgeRibbonProps> = ({
16
12
  position = 'top_right',
17
13
  label = 'Label',
@@ -37,16 +33,39 @@ const BadgeRibbon: FC<BadgeRibbonProps> = ({
37
33
  const textTransform = useMemo(() => [{ rotateZ: textRotate }], [textRotate]);
38
34
 
39
35
  const ribbonTail = isUpTail ? <UpTail /> : <DownTail />;
40
- const renderRoundContent = () => {
41
- return (
36
+ const renderRoundContent = () => (
37
+ <View
38
+ collapsable={false}
39
+ style={[
40
+ styles.ribbonContent,
41
+ {
42
+ backgroundColor: theme.colors.warning.primary,
43
+ marginTop: textMargin,
44
+ },
45
+ ]}
46
+ >
47
+ <View
48
+ collapsable={false}
49
+ style={[styles.ribbonLabelWrapper, { transform: textTransform }]}
50
+ >
51
+ <Text
52
+ style={styles.ribbonLabel}
53
+ color={Colors.black_01}
54
+ typography="label_xs_medium"
55
+ >
56
+ {label}
57
+ </Text>
58
+ </View>
59
+ </View>
60
+ );
61
+
62
+ const renderSkewContent = () => (
63
+ <View style={[styles.ribbonSkewRow, { marginTop: skewMargin }]}>
42
64
  <View
43
65
  collapsable={false}
44
66
  style={[
45
- styles.ribbonContent,
46
- {
47
- backgroundColor: theme.colors.warning.primary,
48
- marginTop: textMargin,
49
- },
67
+ styles.ribbonSkewContent,
68
+ { backgroundColor: theme.colors.warning.primary },
50
69
  ]}
51
70
  >
52
71
  <View
@@ -62,41 +81,14 @@ const BadgeRibbon: FC<BadgeRibbonProps> = ({
62
81
  </Text>
63
82
  </View>
64
83
  </View>
65
- );
66
- };
67
-
68
- const renderSkewContent = () => {
69
- return (
70
- <View style={[styles.ribbonSkewRow, { marginTop: skewMargin }]}>
71
- <View
72
- collapsable={false}
73
- style={[
74
- styles.ribbonSkewContent,
75
- { backgroundColor: theme.colors.warning.primary },
76
- ]}
77
- >
78
- <View
79
- collapsable={false}
80
- style={[styles.ribbonLabelWrapper, { transform: textTransform }]}
81
- >
82
- <Text
83
- style={styles.ribbonLabel}
84
- color={Colors.black_01}
85
- typography="label_xs_medium"
86
- >
87
- {label}
88
- </Text>
89
- </View>
90
- </View>
91
- <Image
92
- source={{
93
- uri: 'https://static.momocdn.net/app/img/kits/utils/Tail_4x.png',
94
- }}
95
- style={styles.skew}
96
- />
97
- </View>
98
- );
99
- };
84
+ <Image
85
+ source={{
86
+ uri: 'https://static.momocdn.net/app/img/kits/utils/Tail_4x.png',
87
+ }}
88
+ style={styles.skew}
89
+ />
90
+ </View>
91
+ );
100
92
 
101
93
  const content = isRound ? renderRoundContent() : renderSkewContent();
102
94
 
package/Badge/Shape.tsx CHANGED
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import styles from './styles';
3
3
  import {Image} from '../Image';
4
4
 
5
- /** Ribbon tail image pointing up (the down tail rotated 180deg). */
6
5
  const UpTail = () => {
7
6
  return (
8
7
  <Image
@@ -15,7 +14,6 @@ const UpTail = () => {
15
14
  );
16
15
  };
17
16
 
18
- /** Ribbon tail image pointing down. */
19
17
  const DownTail = () => {
20
18
  return (
21
19
  <Image
package/Badge/types.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import {ViewStyle} from 'react-native';
2
2
 
3
3
  /**
4
- * Props for a Badge component. It displays a short label or a number count.
4
+ * Props for a general Badge component. It can display a wide range of badges including simple labels, numbers, or dots.
5
5
  */
6
6
  export type BadgeProps = {
7
7
  /**
@@ -20,7 +20,7 @@ export type BadgeProps = {
20
20
  backgroundColor?: string;
21
21
 
22
22
  /**
23
- * Optional. Overrides the generated component ID used for accessibility and QA.
23
+ *
24
24
  */
25
25
  accessibilityLabel?: string;
26
26
  };
package/Button/index.tsx CHANGED
@@ -63,11 +63,6 @@ export interface ButtonProps extends TouchableOpacityProps {
63
63
  params?: any;
64
64
  }
65
65
 
66
- /**
67
- * Design-system button: `type` sets the colors, `size` the height and text,
68
- * and `loading` swaps an icon slot for a spinner. Primary buttons use the mini
69
- * app gradient from `config.navigationBar.buttonColors` when set.
70
- */
71
66
  const Button: FC<ButtonProps> = ({
72
67
  type = 'primary',
73
68
  size = 'large',
@@ -95,21 +90,33 @@ const Button: FC<ButtonProps> = ({
95
90
  rest.accessibilityLabel,
96
91
  );
97
92
 
93
+ /**
94
+ * animate press in (Reanimated)
95
+ */
98
96
  const animateIn = (event: GestureResponderEvent) => {
99
97
  rest?.onPressIn?.(event);
100
98
  pressAnim.value = withTiming(1, { duration: 100 });
101
99
  };
102
100
 
101
+ /**
102
+ * animate press out (Reanimated)
103
+ */
103
104
  const animateOut = (event: GestureResponderEvent) => {
104
105
  rest?.onPressOut?.(event);
105
106
  pressAnim.value = withTiming(0, { duration: 100 });
106
107
  };
107
108
 
109
+ /**
110
+ * export size style
111
+ */
108
112
  const getSizeStyle = () => {
109
113
  const styleSheet: { [key: string]: any } = styles;
110
114
  return styleSheet[size ?? 'small'];
111
115
  };
112
116
 
117
+ /**
118
+ * render title
119
+ */
113
120
  const renderTitle = () => {
114
121
  const typography = getTypography(size);
115
122
  const textColor = getTextColor(type, theme, color);
@@ -120,6 +127,10 @@ const Button: FC<ButtonProps> = ({
120
127
  );
121
128
  };
122
129
 
130
+ /**
131
+ * render icon
132
+ * @param position
133
+ */
123
134
  const renderIcon = (position: 'left' | 'right') => {
124
135
  const iconSize = getIconSize(size);
125
136
  const space = getIconSpace(size);
package/Button/utils.ts CHANGED
@@ -4,8 +4,10 @@ import { Typography } from '../Text/types';
4
4
  import { ButtonProps } from './index';
5
5
 
6
6
  /**
7
- * Whether the loading spinner belongs in the `isLeft` icon slot: it takes the
8
- * right slot when there is a right icon, otherwise the left one.
7
+ * determine loading position
8
+ * @param left
9
+ * @param right
10
+ * @param isLeft
9
11
  */
10
12
  export const shouldShowLoading = (
11
13
  left?: string,
@@ -21,8 +23,7 @@ export const shouldShowLoading = (
21
23
  };
22
24
 
23
25
  /**
24
- * Background and border of a button `type`; `color` (mini app button color)
25
- * overrides the outline border.
26
+ * export type style
26
27
  */
27
28
  export const getTypeStyle = (
28
29
  type: ButtonProps['type'],
@@ -63,7 +64,9 @@ export const getTypeStyle = (
63
64
  }
64
65
  };
65
66
 
66
- /** Icon size for a button `size`. */
67
+ /**
68
+ * export icon size
69
+ */
67
70
  export const getIconSize = (size: ButtonProps['size']) => {
68
71
  switch (size) {
69
72
  case 'large':
@@ -76,7 +79,9 @@ export const getIconSize = (size: ButtonProps['size']) => {
76
79
  }
77
80
  };
78
81
 
79
- /** Gap between icon and title for a button `size`. */
82
+ /**
83
+ * export icon space
84
+ */
80
85
  export const getIconSpace = (size: ButtonProps['size']) => {
81
86
  switch (size) {
82
87
  case 'large':
@@ -89,7 +94,9 @@ export const getIconSpace = (size: ButtonProps['size']) => {
89
94
  }
90
95
  };
91
96
 
92
- /** Title typography for a button `size`. */
97
+ /**
98
+ * export typography style
99
+ */
93
100
  export const getTypography = (size: ButtonProps['size']): Typography => {
94
101
  switch (size) {
95
102
  case 'large':
@@ -104,8 +111,7 @@ export const getTypography = (size: ButtonProps['size']): Typography => {
104
111
  };
105
112
 
106
113
  /**
107
- * Title and icon color of a button `type`; `color` (mini app button color)
108
- * overrides the outline and text types.
114
+ * export text color
109
115
  */
110
116
  export const getTextColor = (
111
117
  type: ButtonProps['type'],
@@ -11,10 +11,6 @@ import {
11
11
  import { Text } from '../Text';
12
12
  import { Icon } from '../Icon';
13
13
 
14
- /**
15
- * Checkbox with an optional label. `indeterminate` shows a minus icon and is
16
- * styled and announced as checked.
17
- */
18
14
  const CheckBox: FC<CheckBoxProps> = ({
19
15
  value,
20
16
  disabled = false,
package/Consts/theme.ts CHANGED
@@ -62,22 +62,22 @@ const defaultDarkTheme: Theme = {
62
62
  secondary: Colors.pink_08,
63
63
  gradient: '#FDCADE',
64
64
  background: {
65
- default: '#121212',
66
- surface: '#1e1e1e',
65
+ default: '#121212', // Dark background
66
+ surface: '#1e1e1e', // Slightly lighter surface background
67
67
  tonal: Colors.pink_10,
68
- pressed: '#1a1a1a',
68
+ pressed: '#1a1a1a', // Pressed state background
69
69
  selected: Colors.pink_11,
70
- disable: '#303030',
70
+ disable: '#303030', // Disabled state background
71
71
  },
72
72
  text: {
73
- default: '#ffffff',
74
- secondary: '#b0b0b0',
75
- hint: '#727272',
76
- disable: '#505050',
73
+ default: '#ffffff', // White text for better contrast
74
+ secondary: '#b0b0b0', // Light gray secondary text
75
+ hint: '#727272', // Hint text color
76
+ disable: '#505050', // Disabled text color
77
77
  },
78
78
  border: {
79
- default: '#2a2a2a',
80
- disable: '#242424',
79
+ default: '#2a2a2a', // Darker borders
80
+ disable: '#242424', // Disabled state border color
81
81
  },
82
82
  success: {
83
83
  primary: Colors.green_03,
package/Context/index.ts CHANGED
@@ -5,15 +5,11 @@ import { defaultContext } from '../Consts';
5
5
  const Context = createContext({});
6
6
  const ApplicationContext = createContext(defaultContext);
7
7
 
8
- // Shared by the host app via `Platform`; standalone falls back to a local one.
9
8
  const MiniAppContext = (Platform as any).MiniAppContext ?? Context;
10
9
  const ScreenContext = (Platform as any).ScreenContext ?? Context;
11
10
  const ComponentContext = (Platform as any).ComponentContext ?? Context;
12
11
  const SkeletonContext = createContext({ loading: false });
13
- /**
14
- * @deprecated Not read: wrap the subtree in `ScaleSizeProvider`, which caps the
15
- * font scale through MiniAppContext. Kept for mini apps built on older kits.
16
- */
12
+ /** @deprecated Max font scale is fixed at 1.5; this context is no longer read. */
17
13
  const ScaleSizeContext = createContext<{ scaleSizeMaxRate?: number }>({
18
14
  scaleSizeMaxRate: undefined,
19
15
  });
@@ -11,7 +11,6 @@ export interface DashDividerProps {
11
11
  style?: ViewStyle;
12
12
  }
13
13
 
14
- /** 1px dashed horizontal line in the default border color. */
15
14
  const DashDivider: React.FC<DashDividerProps> = ({ style }) => {
16
15
  const { theme } = useContext(ApplicationContext);
17
16
  const borderColor = theme.colors.border.default;
package/Divider/index.tsx CHANGED
@@ -18,10 +18,6 @@ export interface DividerProps {
18
18
  type?: 'dash' | 'default';
19
19
  }
20
20
 
21
- /**
22
- * 1px horizontal line in the default border color. `type='dash'` renders
23
- * `DashDivider`, which always has a 4px vertical margin.
24
- */
25
21
  const Divider: React.FC<DividerProps> = ({
26
22
  style,
27
23
  useMargin = true,
@@ -5,10 +5,6 @@ import { FlatListProps } from 'react-native';
5
5
  type CombinedListProps<ItemT> = FlatListProps<ItemT> &
6
6
  Partial<FlashListProps<ItemT>>;
7
7
 
8
- /**
9
- * FlashList typed to also accept FlatList props, so FlatList call sites can
10
- * switch to it without type changes.
11
- */
12
8
  const FoundationList = <ItemT,>(props: CombinedListProps<ItemT>) => {
13
9
  return <FlashList {...props} />;
14
10
  };
package/Icon/index.tsx CHANGED
@@ -7,10 +7,6 @@ import { Image } from '../Image';
7
7
  import { StyleSheet } from 'react-native';
8
8
  import { Colors } from '../Consts';
9
9
 
10
- /**
11
- * Tinted icon from the bundled icon map (unknown names fall back to
12
- * `ic_warning`) or from a URL. `color={null}` keeps the image's own colors.
13
- */
14
10
  const Icon: React.FC<IconProps> = ({
15
11
  source = 'ic_back',
16
12
  size = 24,
@@ -23,6 +19,9 @@ const Icon: React.FC<IconProps> = ({
23
19
 
24
20
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
25
21
 
22
+ /**
23
+ * get icon source maps or remote http
24
+ */
26
25
  const getIconSource = (): any => {
27
26
  if (source && !source.includes('http')) {
28
27
  let icon: { [key: string]: { uri: string } } = IconSources;
@@ -31,8 +30,9 @@ const Icon: React.FC<IconProps> = ({
31
30
  return { uri: source };
32
31
  };
33
32
 
34
- const tintColor = color ?? theme.colors.text.default;
35
- const tintColorProps = color !== null && { tintColor };
33
+ const tintColorProps = color !== null && {
34
+ tintColor: color ?? theme.colors.text.default,
35
+ };
36
36
 
37
37
  return (
38
38
  <Image
package/Icon/types.ts CHANGED
@@ -15,7 +15,7 @@ export type IconProps = {
15
15
  size?: number;
16
16
 
17
17
  /**
18
- * Optional. Represents the color of the icon; `null` keeps the image colors.
18
+ * Optional. Represents the color of the icon.
19
19
  */
20
20
  color?: string | null;
21
21
 
@@ -41,10 +41,6 @@ export interface IconButtonProps extends TouchableOpacityProps {
41
41
  params?: any;
42
42
  }
43
43
 
44
- /**
45
- * Icon-only button. `type` sets the background and icon color; `'disabled'`
46
- * also blocks presses.
47
- */
48
44
  const IconButton: React.FC<IconButtonProps> = ({
49
45
  type = 'primary',
50
46
  icon,
@@ -58,6 +54,9 @@ const IconButton: React.FC<IconButtonProps> = ({
58
54
 
59
55
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
60
56
 
57
+ /**
58
+ * get size icon button
59
+ */
61
60
  const getSizeStyle = () => {
62
61
  switch (size) {
63
62
  case 'small':
@@ -69,10 +68,16 @@ const IconButton: React.FC<IconButtonProps> = ({
69
68
  }
70
69
  };
71
70
 
71
+ /**
72
+ * get shape icon button
73
+ */
72
74
  const getShapeStyle = () => {
73
75
  return shape === 'square' ? styles.square : styles.circle;
74
76
  };
75
77
 
78
+ /**
79
+ * get style for icon button by type
80
+ */
76
81
  const getTypeStyle = () => {
77
82
  switch (type) {
78
83
  case 'disabled':
@@ -106,6 +111,9 @@ const IconButton: React.FC<IconButtonProps> = ({
106
111
  }
107
112
  };
108
113
 
114
+ /**
115
+ * get color for icon
116
+ */
109
117
  const getIconColor = () => {
110
118
  switch (type) {
111
119
  case 'disabled':
package/Image/index.tsx CHANGED
@@ -15,7 +15,6 @@ import { ImageProps } from './types';
15
15
 
16
16
  type Status = 'success' | 'loading' | 'error';
17
17
 
18
- /** Last path segment of a `{ uri }` source, used in QA labels; '' otherwise. */
19
18
  export const getImageName = (source: any): string => {
20
19
  const parts = source?.uri?.split?.('/');
21
20
  if (parts?.length > 0) {
@@ -24,10 +23,6 @@ export const getImageName = (source: any): string => {
24
23
  return '';
25
24
  };
26
25
 
27
- /**
28
- * FastImage that shows a skeleton while loading (if `loading`) or inside a
29
- * loading `SkeletonProvider`, and a fail icon on error.
30
- */
31
26
  const Image: React.FC<ImageProps> = ({
32
27
  style,
33
28
  source,
@@ -49,12 +44,15 @@ const Image: React.FC<ImageProps> = ({
49
44
 
50
45
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
51
46
 
52
- const imageName = getImageName(source);
53
- let accessibilityLabel: any = `img|${imageName}`;
47
+ let accessibilityLabel: any = `img|${getImageName(source)}`;
54
48
  if (component?.componentId) {
55
- accessibilityLabel = `${component?.componentId}|img|${imageName}`;
49
+ accessibilityLabel = `${component?.componentId}|img|${getImageName(
50
+ source,
51
+ )}`;
56
52
  }
57
-
53
+ /**
54
+ * render content loading | fail | rendered
55
+ */
58
56
  const renderContent = () => {
59
57
  if (status === 'loading' || status === 'error') {
60
58
  let content = <Skeleton />;
package/Input/Input.tsx CHANGED
@@ -31,8 +31,7 @@ import {
31
31
  } from '../Context';
32
32
 
33
33
  /**
34
- * Text input with floating label, leading/trailing/clear icons and an error or
35
- * hint row; controlled via `value` or uncontrolled via `defaultValue`.
34
+ * Input default component
36
35
  */
37
36
  const Input = forwardRef(
38
37
  (
@@ -132,17 +131,15 @@ const Input = forwardRef(
132
131
  };
133
132
  });
134
133
 
134
+ /**
135
+ * Render input view
136
+ */
135
137
  const renderInputView = () => {
136
138
  const disabledColor = theme.colors.text.disable;
137
139
  const secure = secureTextEntry;
138
140
  let textColor = theme.colors.text.default;
139
141
  let placeholderColor = theme.colors.text.hint;
140
142
  let iconTintColor = trailingColor;
141
- let secureTextStyle = styles.secureTextLarge;
142
-
143
- if (size === 'small') {
144
- secureTextStyle = styles.secureTextSmall;
145
- }
146
143
 
147
144
  if (disabled) {
148
145
  textColor = disabledColor;
@@ -202,7 +199,11 @@ const Input = forwardRef(
202
199
  color: textColor,
203
200
  fontFamily: exportFontFamily(fontWeight ?? 'regular'),
204
201
  },
205
- secure && haveValue && secureTextStyle,
202
+ secure &&
203
+ haveValue &&
204
+ (size === 'small'
205
+ ? styles.secureTextSmall
206
+ : styles.secureTextLarge),
206
207
  ]}
207
208
  defaultValue={defaultValue}
208
209
  allowFontScaling={false}
@@ -1,5 +1,5 @@
1
1
  import React, { useContext } from 'react';
2
- import { TouchableOpacity, View, type ViewStyle } from 'react-native';
2
+ import { TouchableOpacity, View } from 'react-native';
3
3
  import { useComponentId } from '../Application';
4
4
  import {
5
5
  ApplicationContext,
@@ -18,10 +18,6 @@ import { Text, useScaleSize } from '../Text';
18
18
  import styles from './styles';
19
19
  import { Spacing } from '../Consts';
20
20
 
21
- /**
22
- * Pressable field styled like an input with a chevron; shows `value` or
23
- * `placeholder`. Opening the picker is left to `onPress`.
24
- */
25
21
  const InputDropDown = ({
26
22
  value,
27
23
  floatingValue,
@@ -54,19 +50,18 @@ const InputDropDown = ({
54
50
  props.accessibilityLabel,
55
51
  );
56
52
 
53
+ /**
54
+ * Render the input view
55
+ */
57
56
  const renderInputView = () => {
58
57
  const disabledColor = theme.colors.text.disable;
59
58
  let textColor = theme.colors.text.default;
60
59
  let placeholderColor = theme.colors.text.hint;
61
- let chevronStyle: ViewStyle = styles.iconViewDropDownSingle;
62
60
 
63
61
  if (disabled) {
64
62
  textColor = disabledColor;
65
63
  placeholderColor = disabledColor;
66
64
  }
67
- if (multiline) {
68
- chevronStyle = styles.iconViewDropDownMultiline;
69
- }
70
65
 
71
66
  return (
72
67
  <View
@@ -116,7 +111,14 @@ const InputDropDown = ({
116
111
  </Text>
117
112
  </View>
118
113
  </View>
119
- <View style={[styles.iconViewDropDown, chevronStyle]}>
114
+ <View
115
+ style={[
116
+ styles.iconViewDropDown,
117
+ multiline
118
+ ? styles.iconViewDropDownMultiline
119
+ : styles.iconViewDropDownSingle,
120
+ ]}
121
+ >
120
122
  <Icon source={'arrow_chevron_down_small'} />
121
123
  </View>
122
124
  </View>
@@ -16,11 +16,6 @@ import { InputMoneyView } from './InputMoneyView';
16
16
  import { findEdit, moneyFormatter } from './moneyUtils';
17
17
  import styles from './styles';
18
18
 
19
- /**
20
- * Money input: keeps digits only, shows them grouped with a currency suffix and
21
- * reports raw digits to `onChangeText`. On Android it restores the caret by the
22
- * count of digits after it, since regrouping shifts positions.
23
- */
24
19
  const InputMoney = forwardRef(
25
20
  (
26
21
  {
@@ -93,9 +88,9 @@ const InputMoney = forwardRef(
93
88
 
94
89
  useEffect(() => {
95
90
  if (!caretSelection) return;
96
- setCaretSelection(current => {
97
- return current === caretSelection ? undefined : current;
98
- });
91
+ setCaretSelection(current =>
92
+ current === caretSelection ? undefined : current,
93
+ );
99
94
  }, [caretSelection]);
100
95
 
101
96
  const updateDisplayValue = (numeric: string) => {
@@ -147,10 +142,11 @@ const InputMoney = forwardRef(
147
142
  lastRawText.current = text;
148
143
  const formattedEdit = findEdit(lastDisplayValue, text);
149
144
  const rawEdit = findEdit(raw, text);
150
- const isRawEditSmaller = !!raw && rawEdit.size < formattedEdit.size;
151
- const { old, start, suffix } = isRawEditSmaller ? rawEdit : formattedEdit;
152
- const textAfterEdit = text.slice(text.length - suffix);
153
- caretDigitsAfter.current = parseInputText(textAfterEdit).length;
145
+ const { old, start, suffix } =
146
+ raw && rawEdit.size < formattedEdit.size ? rawEdit : formattedEdit;
147
+ caretDigitsAfter.current = parseInputText(
148
+ text.slice(text.length - suffix),
149
+ ).length;
154
150
  if (text.length < old.length && digits === numericValue) {
155
151
  const index = parseInputText(text.slice(0, start)).length - 1;
156
152
  if (index >= 0) {