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

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 (146) hide show
  1. package/Application/BottomSheet.hooks.ts +8 -8
  2. package/Application/BottomSheet.parts.tsx +44 -34
  3. package/Application/BottomSheet.tsx +40 -37
  4. package/Application/BottomTab/ActiveIndicator.tsx +15 -14
  5. package/Application/BottomTab/BottomTabBar.tsx +49 -62
  6. package/Application/BottomTab/BottomTabInset.tsx +8 -4
  7. package/Application/BottomTab/CurvedContainer.tsx +14 -12
  8. package/Application/BottomTab/CustomBottomTabItem.tsx +13 -13
  9. package/Application/BottomTab/DuoBarCompression.tsx +13 -19
  10. package/Application/BottomTab/DuoRailTabBar.tsx +20 -24
  11. package/Application/BottomTab/DuoTabBar.tsx +8 -10
  12. package/Application/BottomTab/TabBarIcon.tsx +15 -29
  13. package/Application/BottomTab/TabScreen.tsx +1 -5
  14. package/Application/BottomTab/index.tsx +33 -30
  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 +4 -0
  19. package/Application/Components/DuoGlassBackground.tsx +5 -4
  20. package/Application/Components/HeaderAnimated.tsx +40 -12
  21. package/Application/Components/HeaderBackground.tsx +19 -2
  22. package/Application/Components/HeaderExtendHeader.tsx +56 -34
  23. package/Application/Components/HeaderLeft.tsx +4 -2
  24. package/Application/Components/HeaderRight.styles.ts +15 -9
  25. package/Application/Components/HeaderRight.tsx +2 -1
  26. package/Application/Components/HeaderTitle.shared.ts +19 -12
  27. package/Application/Components/HeaderTitle.tsx +4 -3
  28. package/Application/Components/HeaderToolkitAction.tsx +28 -22
  29. package/Application/Components/NavigationButton.tsx +10 -6
  30. package/Application/Components/SearchHeader.tsx +41 -15
  31. package/Application/Components/TitleJourney.tsx +2 -2
  32. package/Application/Components/TitleLocation.tsx +2 -2
  33. package/Application/Components/TitleUser.tsx +2 -2
  34. package/Application/Components/useToolkitActions.tsx +17 -32
  35. package/Application/Localize.ts +7 -0
  36. package/Application/ModalScreen.tsx +10 -10
  37. package/Application/Navigation.ts +14 -16
  38. package/Application/NavigationContainer.tsx +19 -18
  39. package/Application/Navigator.ts +20 -48
  40. package/Application/ScaleSizeProvider.tsx +13 -6
  41. package/Application/StackScreen.tracking.ts +11 -33
  42. package/Application/StackScreen.tsx +19 -54
  43. package/Application/TooltipPortal.tsx +12 -5
  44. package/Application/WidgetContainer.tsx +10 -4
  45. package/Application/headerLayout.ts +158 -0
  46. package/Application/index.ts +11 -1
  47. package/Application/modalLayout.ts +13 -14
  48. package/Application/navigationOptions.tsx +27 -32
  49. package/Application/types.header.ts +7 -2
  50. package/Application/types.ts +7 -0
  51. package/Badge/Badge.tsx +5 -0
  52. package/Badge/BadgeDot.tsx +1 -0
  53. package/Badge/BadgeDotAnimation.tsx +15 -7
  54. package/Badge/BadgeRibbon.tsx +46 -38
  55. package/Badge/Shape.tsx +2 -0
  56. package/Badge/types.ts +2 -2
  57. package/Button/index.tsx +5 -16
  58. package/Button/utils.ts +9 -15
  59. package/CheckBox/index.tsx +4 -0
  60. package/Consts/theme.ts +10 -10
  61. package/Context/index.ts +5 -1
  62. package/Divider/DashDivider.tsx +1 -0
  63. package/Divider/index.tsx +4 -0
  64. package/FoundationList/index.tsx +4 -0
  65. package/Icon/index.tsx +6 -6
  66. package/Icon/types.ts +1 -1
  67. package/IconButton/index.tsx +4 -12
  68. package/Image/index.tsx +9 -7
  69. package/Input/Input.tsx +8 -9
  70. package/Input/InputDropDown.tsx +10 -12
  71. package/Input/InputMoney.tsx +12 -8
  72. package/Input/InputMoneyView.tsx +14 -7
  73. package/Input/InputOTP.tsx +35 -33
  74. package/Input/InputPhoneNumber.tsx +8 -9
  75. package/Input/InputSearch.tsx +22 -8
  76. package/Input/InputTextArea.tsx +4 -0
  77. package/Input/SearchTextTyping.tsx +4 -0
  78. package/Input/SystemTextInput.tsx +7 -2
  79. package/Input/TextTyping.tsx +4 -0
  80. package/Input/common.tsx +26 -12
  81. package/Input/index.tsx +24 -21
  82. package/Input/moneyUtils.ts +10 -4
  83. package/Input/styles.ts +0 -5
  84. package/Input/utils.ts +14 -12
  85. package/Layout/Card.tsx +7 -4
  86. package/Layout/FloatingButton.tsx +4 -0
  87. package/Layout/Item.tsx +6 -2
  88. package/Layout/ItemList.tsx +9 -7
  89. package/Layout/ItemSectionList.tsx +2 -1
  90. package/Layout/ReservedRegions.tsx +25 -25
  91. package/Layout/Screen.tsx +59 -58
  92. package/Layout/Section.tsx +8 -5
  93. package/Layout/TrackingScope.tsx +1 -0
  94. package/Layout/screenContent.tsx +4 -2
  95. package/Layout/screenFooter.tsx +28 -18
  96. package/Layout/screenHeader.tsx +88 -82
  97. package/Layout/screenQuickReturn.tsx +17 -20
  98. package/Layout/screenScroll.ts +4 -7
  99. package/Layout/screenTypes.ts +13 -4
  100. package/Layout/types.ts +2 -4
  101. package/Layout/utils.ts +31 -37
  102. package/Loader/DotLoader.tsx +4 -0
  103. package/Loader/Loader.tsx +4 -0
  104. package/Loader/ProgressBar.tsx +1 -0
  105. package/Loader/Spinner.tsx +4 -0
  106. package/Loader/utils.ts +11 -7
  107. package/Pagination/Dot.tsx +4 -0
  108. package/Pagination/PaginationDot.tsx +1 -0
  109. package/Pagination/PaginationNumber.tsx +5 -3
  110. package/Pagination/PaginationScroll.tsx +5 -0
  111. package/Pagination/PaginationWhiteDot.tsx +1 -0
  112. package/Pagination/index.tsx +4 -0
  113. package/Pagination/types.ts +2 -2
  114. package/Popup/PopupNotify.tsx +44 -48
  115. package/Popup/PopupPromotion.tsx +4 -7
  116. package/Popup/types.ts +4 -4
  117. package/Popup/utils.ts +4 -0
  118. package/Radio/index.tsx +4 -0
  119. package/Skeleton/index.tsx +8 -0
  120. package/Switch/index.tsx +1 -0
  121. package/Tag/index.tsx +5 -1
  122. package/Tag/types.ts +3 -3
  123. package/Text/index.tsx +14 -3
  124. package/Text/styles.ts +1 -1
  125. package/Text/types.ts +1 -6
  126. package/Text/utils.ts +20 -4
  127. package/Title/index.tsx +41 -32
  128. package/ViewBoundary/index.tsx +4 -2
  129. package/index.ts +0 -6
  130. package/package.json +1 -1
  131. package/Application/KitAdoption/AdoptionBadge.tsx +0 -119
  132. package/Application/KitAdoption/AdoptionProbe.tsx +0 -166
  133. package/Application/KitAdoption/AdoptionStore.ts +0 -80
  134. package/Application/KitAdoption/Authorship/utils.ts +0 -137
  135. package/Application/KitAdoption/Slots/utils.ts +0 -68
  136. package/Application/KitAdoption/constants.ts +0 -120
  137. package/Application/KitAdoption/index.ts +0 -12
  138. package/Application/KitAdoption/styles.ts +0 -55
  139. package/Application/KitAdoption/types.ts +0 -61
  140. package/Application/KitAdoption/utils.ts +0 -376
  141. package/Application/__tests__/KitAdoption.integration.test.tsx +0 -253
  142. package/Application/__tests__/KitAdoption.test.ts +0 -283
  143. package/Application/__tests__/KitAdoptionAuthorship.test.ts +0 -132
  144. package/Application/__tests__/KitAdoptionStore.test.ts +0 -110
  145. package/Application/__tests__/KitAdoptionStructural.test.ts +0 -193
  146. package/Application/__tests__/modalLayout.test.ts +0 -128
@@ -8,11 +8,12 @@ import {
8
8
  TransitionPresets,
9
9
  } from '@react-navigation/stack';
10
10
  import type { SharedValue } from 'react-native-reanimated';
11
- import { Colors, Spacing } from '../Consts';
11
+ import { Colors } from '../Consts';
12
12
  import { HeaderBackground } from './Components/HeaderBackground';
13
13
  import { HeaderLeft } from './Components/HeaderLeft';
14
14
  import { HeaderRight } from './Components/HeaderRight';
15
15
  import { HeaderTitle, TitleCustom } from './Components/HeaderTitle';
16
+ import { HeaderBarMetrics, TITLE_CONTAINER_RESET } from './headerLayout';
16
17
  import type { HeaderTitleProps, NavigationOptions } from './types';
17
18
 
18
19
  const CARD_SHADOW_OPACITY = 0.3;
@@ -55,13 +56,8 @@ const getStackOptions = (): StackNavigationOptions => {
55
56
  headerTitleAlign: 'left',
56
57
  headerTitle: props => <HeaderTitle {...props} />,
57
58
  headerTitleContainerStyle: {
58
- marginLeft: 0,
59
- marginEnd: 0,
60
- marginStart: 0,
61
- marginHorizontal: 0,
62
- marginVertical: 0,
63
- margin: 0,
64
- left: Spacing.S,
59
+ ...TITLE_CONTAINER_RESET,
60
+ left: HeaderBarMetrics.titleGap,
65
61
  },
66
62
  headerBackground: (props: any) => <HeaderBackground {...props} />,
67
63
  headerLeft: (props: any) => <HeaderLeft {...props} floating />,
@@ -133,13 +129,15 @@ const exportHeaderTitle = (
133
129
  };
134
130
  } else if (typeof params.headerTitle === 'string') {
135
131
  return {
136
- headerTitle: (props: any) => (
137
- <HeaderTitle
138
- {...props}
139
- children={params.headerTitle}
140
- animatedValue={animatedValue}
141
- />
142
- ),
132
+ headerTitle: (props: any) => {
133
+ return (
134
+ <HeaderTitle
135
+ {...props}
136
+ children={params.headerTitle}
137
+ animatedValue={animatedValue}
138
+ />
139
+ );
140
+ },
143
141
  };
144
142
  }
145
143
  return {};
@@ -156,25 +154,22 @@ const getOptions = (
156
154
  let options: StackNavigationOptions = {};
157
155
 
158
156
  if (hasCustomHeaderLeft(params)) {
159
- let headerLeft: any = (props: any) => (
160
- <HeaderLeft
161
- {...props}
162
- preventBack={params.preventBack}
163
- onPressLeftHeader={params.onPressLeftHeader}
164
- onBackHandler={params.onBackHandler}
165
- floating
166
- />
167
- );
157
+ let headerLeft: any = (props: any) => {
158
+ return (
159
+ <HeaderLeft
160
+ {...props}
161
+ preventBack={params.preventBack}
162
+ onPressLeftHeader={params.onPressLeftHeader}
163
+ onBackHandler={params.onBackHandler}
164
+ floating
165
+ />
166
+ );
167
+ };
168
168
  if (params.hiddenBack) {
169
169
  headerLeft = null;
170
170
  options.headerTitleContainerStyle = {
171
- marginLeft: 0,
172
- marginEnd: 0,
173
- marginStart: 0,
174
- marginHorizontal: 0,
175
- marginVertical: 0,
176
- margin: 0,
177
- left: Spacing.M,
171
+ ...TITLE_CONTAINER_RESET,
172
+ left: HeaderBarMetrics.sidePadding,
178
173
  };
179
174
  }
180
175
  options = {
@@ -203,7 +198,7 @@ const getOptions = (
203
198
  };
204
199
  }
205
200
 
206
- // only ever turns swipe back off, screens opt in via gestureEnabled
201
+ // Only ever turns swipe back off; screens opt in via gestureEnabled.
207
202
  if (params.gestureEnabled === undefined && hasCustomBackHandling(params)) {
208
203
  options.gestureEnabled = false;
209
204
  }
@@ -98,6 +98,11 @@ export interface HeaderAnimatedProps extends ViewProps {
98
98
  image: string;
99
99
  useScale?: boolean;
100
100
  aspectRatio?: '16/9' | '3/2' | '1/1';
101
+ /**
102
+ * Optional. On wide windows the image keeps its phone width, centered; this
103
+ * color fills the sides and fades to transparent downward. No fill when unset.
104
+ */
105
+ bannerBackgroundColor?: string;
101
106
  }
102
107
 
103
108
  export type AnimatedHeader = {
@@ -109,8 +114,8 @@ export type AnimatedHeader = {
109
114
  export interface SearchHeaderProps extends InputSearchProps {
110
115
  ref?: React.RefObject<InputRef>;
111
116
  animatedValue?: Animated.Value | SharedValue<number>;
112
- headerRightWidth?: 0 | 74 | 110 | number;
113
- leftPosition?: 12 | 48 | number;
117
+ headerRightWidth?: 0 | 84 | 124 | number;
118
+ leftPosition?: 12 | 52 | number;
114
119
  renderButtons?: () => ReactNode;
115
120
  hiddenBack?: boolean;
116
121
  }
@@ -9,6 +9,7 @@ import type {
9
9
  OnBoarding,
10
10
  } from './types.header';
11
11
  import type { LocalizeProps, Theme } from './types.theme';
12
+ import type { HeaderContentLayout } from './headerLayout';
12
13
 
13
14
  export * from './types.theme';
14
15
  export * from './types.header';
@@ -128,4 +129,10 @@ export interface NavigationOptions
128
129
  hiddenBack?: boolean;
129
130
  headerTitle?: HeaderTitleProps | string;
130
131
  headerRight?: OnBoarding | HeaderRightToolkit | any;
132
+ /**
133
+ * Optional. `stretch` centers back, title and the right cluster in a 600pt
134
+ * frame on wide windows (foldable inner display, tablet); the background stays
135
+ * full width. Defaults to `grid`, the header row at the window edges.
136
+ */
137
+ contentLayout?: HeaderContentLayout;
131
138
  }
package/Badge/Badge.tsx CHANGED
@@ -7,6 +7,11 @@ import { BadgeProps } from './types';
7
7
  import { Colors, Radius, Spacing } from '../Consts';
8
8
  import { Text, useScaleSize } from '../Text';
9
9
 
10
+ /**
11
+ * Label or count badge; counts over 99 show "99+". Counts use the error color,
12
+ * labels the warning color, and `backgroundColor` applies only if it's a
13
+ * `Colors.*_03` token.
14
+ */
10
15
  const Badge: FC<BadgeProps> = ({
11
16
  label = '',
12
17
  style,
@@ -4,6 +4,7 @@ import { BadgeDotProps } from './types';
4
4
  import styles from './styles';
5
5
  import { MiniAppContext } from '../Context';
6
6
 
7
+ /** Static red notification dot with a white ring, `large` or `small`. */
7
8
  const BadgeDot: FC<BadgeDotProps> = ({ size = 'large', style }) => {
8
9
  const context = useContext<any>(MiniAppContext);
9
10
  let dotStyle;
@@ -14,6 +14,10 @@ import styles from './styles';
14
14
 
15
15
  const DURATION = 500;
16
16
 
17
+ /**
18
+ * Red notification dot that pulses with a spring and emits an expanding,
19
+ * fading wave ring, looping until unmounted.
20
+ */
17
21
  const BadgeDotAnimation = ({ size, style }: BadgeDotProps) => {
18
22
  const scaleAnim = useSharedValue(1);
19
23
  const waveScaleAnim = useSharedValue(1);
@@ -57,14 +61,18 @@ const BadgeDotAnimation = ({ size, style }: BadgeDotProps) => {
57
61
  };
58
62
  }, [scaleAnim, waveOpacityAnim, waveScaleAnim]);
59
63
 
60
- const waveAnimatedStyle = useAnimatedStyle(() => ({
61
- transform: [{ scale: waveScaleAnim.value }],
62
- opacity: waveOpacityAnim.value,
63
- }));
64
+ const waveAnimatedStyle = useAnimatedStyle(() => {
65
+ return {
66
+ transform: [{ scale: waveScaleAnim.value }],
67
+ opacity: waveOpacityAnim.value,
68
+ };
69
+ });
64
70
 
65
- const dotAnimatedStyle = useAnimatedStyle(() => ({
66
- transform: [{ scale: scaleAnim.value }],
67
- }));
71
+ const dotAnimatedStyle = useAnimatedStyle(() => {
72
+ return {
73
+ transform: [{ scale: scaleAnim.value }],
74
+ };
75
+ });
68
76
 
69
77
  return (
70
78
  <View style={[styles.dotAnimationContainer, style]}>
@@ -8,6 +8,10 @@ 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
+ */
11
15
  const BadgeRibbon: FC<BadgeRibbonProps> = ({
12
16
  position = 'top_right',
13
17
  label = 'Label',
@@ -33,39 +37,16 @@ const BadgeRibbon: FC<BadgeRibbonProps> = ({
33
37
  const textTransform = useMemo(() => [{ rotateZ: textRotate }], [textRotate]);
34
38
 
35
39
  const ribbonTail = isUpTail ? <UpTail /> : <DownTail />;
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 }]}>
40
+ const renderRoundContent = () => {
41
+ return (
64
42
  <View
65
43
  collapsable={false}
66
44
  style={[
67
- styles.ribbonSkewContent,
68
- { backgroundColor: theme.colors.warning.primary },
45
+ styles.ribbonContent,
46
+ {
47
+ backgroundColor: theme.colors.warning.primary,
48
+ marginTop: textMargin,
49
+ },
69
50
  ]}
70
51
  >
71
52
  <View
@@ -81,14 +62,41 @@ const BadgeRibbon: FC<BadgeRibbonProps> = ({
81
62
  </Text>
82
63
  </View>
83
64
  </View>
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
- );
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
+ };
92
100
 
93
101
  const content = isRound ? renderRoundContent() : renderSkewContent();
94
102
 
package/Badge/Shape.tsx CHANGED
@@ -2,6 +2,7 @@ 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). */
5
6
  const UpTail = () => {
6
7
  return (
7
8
  <Image
@@ -14,6 +15,7 @@ const UpTail = () => {
14
15
  );
15
16
  };
16
17
 
18
+ /** Ribbon tail image pointing down. */
17
19
  const DownTail = () => {
18
20
  return (
19
21
  <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 general Badge component. It can display a wide range of badges including simple labels, numbers, or dots.
4
+ * Props for a Badge component. It displays a short label or a number count.
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
- *
23
+ * Optional. Overrides the generated component ID used for accessibility and QA.
24
24
  */
25
25
  accessibilityLabel?: string;
26
26
  };
package/Button/index.tsx CHANGED
@@ -63,6 +63,11 @@ 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
+ */
66
71
  const Button: FC<ButtonProps> = ({
67
72
  type = 'primary',
68
73
  size = 'large',
@@ -90,33 +95,21 @@ const Button: FC<ButtonProps> = ({
90
95
  rest.accessibilityLabel,
91
96
  );
92
97
 
93
- /**
94
- * animate press in (Reanimated)
95
- */
96
98
  const animateIn = (event: GestureResponderEvent) => {
97
99
  rest?.onPressIn?.(event);
98
100
  pressAnim.value = withTiming(1, { duration: 100 });
99
101
  };
100
102
 
101
- /**
102
- * animate press out (Reanimated)
103
- */
104
103
  const animateOut = (event: GestureResponderEvent) => {
105
104
  rest?.onPressOut?.(event);
106
105
  pressAnim.value = withTiming(0, { duration: 100 });
107
106
  };
108
107
 
109
- /**
110
- * export size style
111
- */
112
108
  const getSizeStyle = () => {
113
109
  const styleSheet: { [key: string]: any } = styles;
114
110
  return styleSheet[size ?? 'small'];
115
111
  };
116
112
 
117
- /**
118
- * render title
119
- */
120
113
  const renderTitle = () => {
121
114
  const typography = getTypography(size);
122
115
  const textColor = getTextColor(type, theme, color);
@@ -127,10 +120,6 @@ const Button: FC<ButtonProps> = ({
127
120
  );
128
121
  };
129
122
 
130
- /**
131
- * render icon
132
- * @param position
133
- */
134
123
  const renderIcon = (position: 'left' | 'right') => {
135
124
  const iconSize = getIconSize(size);
136
125
  const space = getIconSpace(size);
package/Button/utils.ts CHANGED
@@ -4,10 +4,8 @@ import { Typography } from '../Text/types';
4
4
  import { ButtonProps } from './index';
5
5
 
6
6
  /**
7
- * determine loading position
8
- * @param left
9
- * @param right
10
- * @param isLeft
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.
11
9
  */
12
10
  export const shouldShowLoading = (
13
11
  left?: string,
@@ -23,7 +21,8 @@ export const shouldShowLoading = (
23
21
  };
24
22
 
25
23
  /**
26
- * export type style
24
+ * Background and border of a button `type`; `color` (mini app button color)
25
+ * overrides the outline border.
27
26
  */
28
27
  export const getTypeStyle = (
29
28
  type: ButtonProps['type'],
@@ -64,9 +63,7 @@ export const getTypeStyle = (
64
63
  }
65
64
  };
66
65
 
67
- /**
68
- * export icon size
69
- */
66
+ /** Icon size for a button `size`. */
70
67
  export const getIconSize = (size: ButtonProps['size']) => {
71
68
  switch (size) {
72
69
  case 'large':
@@ -79,9 +76,7 @@ export const getIconSize = (size: ButtonProps['size']) => {
79
76
  }
80
77
  };
81
78
 
82
- /**
83
- * export icon space
84
- */
79
+ /** Gap between icon and title for a button `size`. */
85
80
  export const getIconSpace = (size: ButtonProps['size']) => {
86
81
  switch (size) {
87
82
  case 'large':
@@ -94,9 +89,7 @@ export const getIconSpace = (size: ButtonProps['size']) => {
94
89
  }
95
90
  };
96
91
 
97
- /**
98
- * export typography style
99
- */
92
+ /** Title typography for a button `size`. */
100
93
  export const getTypography = (size: ButtonProps['size']): Typography => {
101
94
  switch (size) {
102
95
  case 'large':
@@ -111,7 +104,8 @@ export const getTypography = (size: ButtonProps['size']): Typography => {
111
104
  };
112
105
 
113
106
  /**
114
- * export text color
107
+ * Title and icon color of a button `type`; `color` (mini app button color)
108
+ * overrides the outline and text types.
115
109
  */
116
110
  export const getTextColor = (
117
111
  type: ButtonProps['type'],
@@ -11,6 +11,10 @@ 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
+ */
14
18
  const CheckBox: FC<CheckBoxProps> = ({
15
19
  value,
16
20
  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', // Dark background
66
- surface: '#1e1e1e', // Slightly lighter surface background
65
+ default: '#121212',
66
+ surface: '#1e1e1e',
67
67
  tonal: Colors.pink_10,
68
- pressed: '#1a1a1a', // Pressed state background
68
+ pressed: '#1a1a1a',
69
69
  selected: Colors.pink_11,
70
- disable: '#303030', // Disabled state background
70
+ disable: '#303030',
71
71
  },
72
72
  text: {
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
73
+ default: '#ffffff',
74
+ secondary: '#b0b0b0',
75
+ hint: '#727272',
76
+ disable: '#505050',
77
77
  },
78
78
  border: {
79
- default: '#2a2a2a', // Darker borders
80
- disable: '#242424', // Disabled state border color
79
+ default: '#2a2a2a',
80
+ disable: '#242424',
81
81
  },
82
82
  success: {
83
83
  primary: Colors.green_03,
package/Context/index.ts CHANGED
@@ -5,11 +5,15 @@ 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.
8
9
  const MiniAppContext = (Platform as any).MiniAppContext ?? Context;
9
10
  const ScreenContext = (Platform as any).ScreenContext ?? Context;
10
11
  const ComponentContext = (Platform as any).ComponentContext ?? Context;
11
12
  const SkeletonContext = createContext({ loading: false });
12
- /** @deprecated Max font scale is fixed at 1.5; this context is no longer read. */
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
+ */
13
17
  const ScaleSizeContext = createContext<{ scaleSizeMaxRate?: number }>({
14
18
  scaleSizeMaxRate: undefined,
15
19
  });
@@ -11,6 +11,7 @@ export interface DashDividerProps {
11
11
  style?: ViewStyle;
12
12
  }
13
13
 
14
+ /** 1px dashed horizontal line in the default border color. */
14
15
  const DashDivider: React.FC<DashDividerProps> = ({ style }) => {
15
16
  const { theme } = useContext(ApplicationContext);
16
17
  const borderColor = theme.colors.border.default;
package/Divider/index.tsx CHANGED
@@ -18,6 +18,10 @@ 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
+ */
21
25
  const Divider: React.FC<DividerProps> = ({
22
26
  style,
23
27
  useMargin = true,
@@ -5,6 +5,10 @@ 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
+ */
8
12
  const FoundationList = <ItemT,>(props: CombinedListProps<ItemT>) => {
9
13
  return <FlashList {...props} />;
10
14
  };
package/Icon/index.tsx CHANGED
@@ -7,6 +7,10 @@ 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
+ */
10
14
  const Icon: React.FC<IconProps> = ({
11
15
  source = 'ic_back',
12
16
  size = 24,
@@ -19,9 +23,6 @@ const Icon: React.FC<IconProps> = ({
19
23
 
20
24
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
21
25
 
22
- /**
23
- * get icon source maps or remote http
24
- */
25
26
  const getIconSource = (): any => {
26
27
  if (source && !source.includes('http')) {
27
28
  let icon: { [key: string]: { uri: string } } = IconSources;
@@ -30,9 +31,8 @@ const Icon: React.FC<IconProps> = ({
30
31
  return { uri: source };
31
32
  };
32
33
 
33
- const tintColorProps = color !== null && {
34
- tintColor: color ?? theme.colors.text.default,
35
- };
34
+ const tintColor = color ?? theme.colors.text.default;
35
+ const tintColorProps = color !== null && { tintColor };
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.
18
+ * Optional. Represents the color of the icon; `null` keeps the image colors.
19
19
  */
20
20
  color?: string | null;
21
21
 
@@ -41,6 +41,10 @@ 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
+ */
44
48
  const IconButton: React.FC<IconButtonProps> = ({
45
49
  type = 'primary',
46
50
  icon,
@@ -54,9 +58,6 @@ const IconButton: React.FC<IconButtonProps> = ({
54
58
 
55
59
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
56
60
 
57
- /**
58
- * get size icon button
59
- */
60
61
  const getSizeStyle = () => {
61
62
  switch (size) {
62
63
  case 'small':
@@ -68,16 +69,10 @@ const IconButton: React.FC<IconButtonProps> = ({
68
69
  }
69
70
  };
70
71
 
71
- /**
72
- * get shape icon button
73
- */
74
72
  const getShapeStyle = () => {
75
73
  return shape === 'square' ? styles.square : styles.circle;
76
74
  };
77
75
 
78
- /**
79
- * get style for icon button by type
80
- */
81
76
  const getTypeStyle = () => {
82
77
  switch (type) {
83
78
  case 'disabled':
@@ -111,9 +106,6 @@ const IconButton: React.FC<IconButtonProps> = ({
111
106
  }
112
107
  };
113
108
 
114
- /**
115
- * get color for icon
116
- */
117
109
  const getIconColor = () => {
118
110
  switch (type) {
119
111
  case 'disabled':