@momo-kits/animated-tooltip 0.153.2 → 0.154.1-beta.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.
@@ -5,12 +5,11 @@ import {
5
5
  ButtonProps,
6
6
  Colors,
7
7
  Icon,
8
- IconButton as FoundationIconButton,
9
8
  IconButtonProps,
10
- Radius,
11
- Spacing,
12
9
  Text,
10
+ useScaleSize,
13
11
  } from '@momo-kits/foundation';
12
+ import styles from './styles';
14
13
 
15
14
  const PrimaryButton: FC<ButtonProps> = ({ title, onPress }) => {
16
15
  return (
@@ -27,13 +26,7 @@ const PrimaryButton: FC<ButtonProps> = ({ title, onPress }) => {
27
26
  const SecondaryButton: FC<ButtonProps> = ({ title, onPress, style }) => {
28
27
  return (
29
28
  <TouchableOpacity
30
- style={[
31
- {
32
- paddingHorizontal: Spacing.M,
33
- paddingVertical: Spacing.S,
34
- },
35
- style,
36
- ]}
29
+ style={[styles.secondaryButtonContainer, style]}
37
30
  onPress={onPress}
38
31
  >
39
32
  <Text color={Colors.black_01} typography={'action_s_bold'}>
@@ -48,14 +41,8 @@ const IconButton: FC<IconButtonProps> = ({ icon, onPress, style }) => {
48
41
  <TouchableOpacity
49
42
  onPress={onPress}
50
43
  style={[
51
- {
52
- width: 36,
53
- height: 36,
54
- borderRadius: Radius.XL,
55
- backgroundColor: Colors.black_01,
56
- alignItems: 'center',
57
- justifyContent: 'center',
58
- },
44
+ { width: useScaleSize(36), height: useScaleSize(36) },
45
+ styles.iconButtonContainer,
59
46
  style,
60
47
  ]}
61
48
  >
package/index.tsx CHANGED
@@ -7,7 +7,7 @@ import React, {
7
7
  useRef,
8
8
  useState,
9
9
  } from 'react';
10
- import { Animated, Easing, View, ViewStyle } from 'react-native';
10
+ import { Animated, Easing, TouchableOpacity, View, ViewStyle } from 'react-native';
11
11
  import {
12
12
  Colors,
13
13
  Icon,
@@ -35,6 +35,7 @@ const Tooltip = forwardRef<TooltipRef, TooltipProps>(function Tooltip(
35
35
  offset = 8,
36
36
  accessibilityLabel,
37
37
  onVisibleChange,
38
+ onPressClose,
38
39
  },
39
40
  ref,
40
41
  ) {
@@ -221,20 +222,20 @@ const Tooltip = forwardRef<TooltipRef, TooltipProps>(function Tooltip(
221
222
  return (
222
223
  <View style={styles.buttonsRow}>
223
224
  {bothIcon ? (
224
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
225
+ <View style={styles.buttonRowContainer}>
225
226
  <IconButton
226
227
  icon={second.icon as string}
227
228
  onPress={secondPress}
228
- style={{ marginRight: Spacing.S }}
229
+ style={styles.buttonSpacing}
229
230
  />
230
231
  <IconButton icon={first.icon as string} onPress={firstPress} />
231
232
  </View>
232
233
  ) : (
233
- <View style={{ flexDirection: 'row', alignItems: 'center' }}>
234
+ <View style={styles.buttonRowContainer}>
234
235
  <SecondaryButton
235
236
  title={second.title || ''}
236
237
  onPress={secondPress}
237
- style={{ marginRight: Spacing.S }}
238
+ style={styles.buttonSpacing}
238
239
  />
239
240
  <PrimaryButton title={first.title || ''} onPress={firstPress} />
240
241
  </View>
@@ -273,8 +274,8 @@ const Tooltip = forwardRef<TooltipRef, TooltipProps>(function Tooltip(
273
274
  const renderContent = () => {
274
275
  return (
275
276
  <View style={styles.content}>
276
- <View style={{ flexDirection: 'row' }}>
277
- <View style={{ flex: 1 }}>
277
+ <View style={styles.contentHeader}>
278
+ <View style={styles.contentTextContainer}>
278
279
  {title ? (
279
280
  <Text
280
281
  typography={'header_s_semibold'}
@@ -294,12 +295,17 @@ const Tooltip = forwardRef<TooltipRef, TooltipProps>(function Tooltip(
294
295
  </Text>
295
296
  ) : null}
296
297
  </View>
297
- <Icon
298
- source={'navigation_close'}
299
- size={20}
300
- color={Colors.black_01}
301
- style={{ marginLeft: Spacing.S }}
302
- />
298
+ <TouchableOpacity
299
+ onPress={onPressClose}
300
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
301
+ style={styles.closeIconSpacing}
302
+ >
303
+ <Icon
304
+ source={'navigation_close'}
305
+ size={20}
306
+ color={Colors.black_01}
307
+ />
308
+ </TouchableOpacity>
303
309
  </View>
304
310
  {renderButtons()}
305
311
  </View>
package/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
- "name": "@momo-kits/animated-tooltip",
3
- "version": "0.153.2",
4
- "private": false,
5
- "main": "index.tsx",
6
- "dependencies": {},
7
- "peerDependencies": {
8
- "@momo-kits/foundation": "latest",
9
- "react": "*",
10
- "react-native": "*"
11
- },
12
- "license": "MoMo",
13
- "publishConfig": {
14
- "registry": "https://registry.npmjs.org/"
15
- }
16
- }
17
-
2
+ "name": "@momo-kits/animated-tooltip",
3
+ "version": "0.154.1-beta.0",
4
+ "private": false,
5
+ "main": "index.tsx",
6
+ "dependencies": {},
7
+ "peerDependencies": {
8
+ "@momo-kits/foundation": "latest",
9
+ "react": "*",
10
+ "react-native": "*"
11
+ },
12
+ "license": "MoMo",
13
+ "publishConfig": {
14
+ "registry": "https://registry.npmjs.org/"
15
+ }
16
+ }
package/styles.ts CHANGED
@@ -42,4 +42,32 @@ export default StyleSheet.create({
42
42
  },
43
43
  textButton: {},
44
44
  iconButton: {},
45
+ // New styles from inline
46
+ buttonRowContainer: {
47
+ flexDirection: 'row',
48
+ alignItems: 'center',
49
+ },
50
+ buttonSpacing: {
51
+ marginRight: Spacing.S,
52
+ },
53
+ contentHeader: {
54
+ flexDirection: 'row',
55
+ },
56
+ contentTextContainer: {
57
+ flex: 1,
58
+ },
59
+ closeIconSpacing: {
60
+ marginLeft: Spacing.S,
61
+ },
62
+ // TooltipButtons styles
63
+ secondaryButtonContainer: {
64
+ paddingHorizontal: Spacing.M,
65
+ paddingVertical: Spacing.S,
66
+ },
67
+ iconButtonContainer: {
68
+ borderRadius: Radius.XL,
69
+ backgroundColor: Colors.black_01,
70
+ alignItems: 'center',
71
+ justifyContent: 'center',
72
+ },
45
73
  });
package/types.ts CHANGED
@@ -73,5 +73,9 @@ export type TooltipProps = {
73
73
  * Triggered when visibility changes.
74
74
  */
75
75
  onVisibleChange?: (visible: boolean) => void;
76
+ /**
77
+ * Triggered when the close button (X) is pressed.
78
+ */
79
+ onPressClose?: () => void;
76
80
  };
77
81