vpt-sebraeds 0.0.5 → 0.0.7

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.
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo, useState } from 'react';
2
2
  import { TouchableOpacity, Text, StyleSheet, View } from 'react-native';
3
- import SEIcon from '../SEIcon';
4
- import SEText from '../SEText';
3
+ import SEIcon from '~/superApp/UI/SEIcon';
4
+ import { SEText } from '~/UI';
5
5
 
6
6
  const Button = ({
7
7
  label,
@@ -259,7 +259,7 @@ const styles = StyleSheet.create({
259
259
  aspectRatio: 1,
260
260
  },
261
261
  label: {
262
-
262
+
263
263
  fontSize: 14,
264
264
  // fontWeight: '500',
265
265
  color: '#E7F79E',
@@ -361,4 +361,4 @@ const styles = StyleSheet.create({
361
361
  },
362
362
  });
363
363
 
364
- export default Button;
364
+ export default Button;
@@ -6,7 +6,7 @@ const Icon = ({
6
6
  name,
7
7
  size = 24,
8
8
  color = '#4F7CFE',
9
- style,
9
+ style = {},
10
10
  }) => <IconRemix {...{ style, size, color, name }} />
11
11
 
12
12
 
@@ -1,21 +1,21 @@
1
1
  import React from 'react';
2
- import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
2
+ import { View, Text, StyleSheet, TouchableOpacity, ViewStyle, TextStyle } from 'react-native';
3
3
  import Icon from '../Icon';
4
4
  import SEText from '../SEText';
5
5
 
6
6
  interface NavigationItemProps {
7
- iconName: any;
7
+ iconName: string;
8
8
  label: string;
9
9
  variant?: 'default' | 'selected' | 'disabled';
10
10
  size?: 'small' | 'medium' | 'large';
11
11
  onPress?: () => void;
12
- style?: any;
12
+ style?: ViewStyle;
13
13
  iconColor?: string;
14
14
  textColor?: string;
15
15
  backgroundColor?: string;
16
16
  borderColor?: string;
17
17
  showArrow?: boolean;
18
- badge?: number | string;
18
+ badge?: string;
19
19
  badgeStyle?: 'standard' | string;
20
20
  description?: string;
21
21
  layout?: 'standard' | 'expanded' | 'list';
@@ -191,9 +191,14 @@ const NavigationItem: React.FC<NavigationItemProps> = ({
191
191
  </View>
192
192
  ) : (
193
193
  layout === 'list' ? (
194
- <SEText type={"ns-heading-4" as any} style={[{ flex: 1 }, textColor && { color: textColor }] as any} numberOfLines={1}>
195
- {label}
196
- </SEText>
194
+ (() => {
195
+ const seTextStyle: TextStyle[] = [{ flex: 1 }, ...(textColor ? [{ color: textColor as string } as TextStyle] : [])];
196
+ return (
197
+ <SEText type={'ns-heading-4' as any} style={seTextStyle} numberOfLines={1}>
198
+ {label}
199
+ </SEText>
200
+ );
201
+ })()
197
202
  ) : (
198
203
  <Text style={labelStyle} numberOfLines={1}>
199
204
  {label}
@@ -0,0 +1,58 @@
1
+ import { TextStyle, TextProps } from 'react-native';
2
+
3
+ export interface SETextProps extends TextProps {
4
+ children?: React.ReactNode;
5
+ style?: TextStyle | TextStyle[];
6
+ bold?: boolean;
7
+ semiBold?: boolean;
8
+ center?: boolean;
9
+ right?: boolean;
10
+ left?: boolean;
11
+ underlined?: boolean;
12
+ numberOfLines?: number;
13
+ campuni?: boolean;
14
+ color?: string;
15
+ size?: number | null;
16
+ lineHeight?: number | null;
17
+ justify?: boolean;
18
+ limit?: number | null;
19
+ type?:
20
+ | 'heading-1'
21
+ | 'heading-2'
22
+ | 'heading-3'
23
+ | 'heading-4'
24
+ | 'heading-5'
25
+ | 'heading-6'
26
+ | 'subtitle'
27
+ | 'sm-body'
28
+ | 'sm-body-semibold'
29
+ | 'sm-body-bold'
30
+ | 'xs-body'
31
+ | 'xs-body-semibold'
32
+ | 'xs-body-bold'
33
+ | 'xxs-body'
34
+ | 'xxs-body-semibold'
35
+ | 'xxs-body-bold'
36
+ | 'xxxs-body'
37
+ | 'xxxs-body-semibold'
38
+ | 'xxxs-body-bold'
39
+ | 'ns-heading-1'
40
+ | 'ns-heading-2'
41
+ | 'ns-heading-3'
42
+ | 'ns-heading-4'
43
+ | 'ns-heading-5'
44
+ | 'ns-heading-6'
45
+ | null;
46
+ mt?: number | null;
47
+ mb?: number | null;
48
+ ml?: number | null;
49
+ mr?: number | null;
50
+ pt?: number | null;
51
+ pb?: number | null;
52
+ pr?: number | null;
53
+ pl?: number | null;
54
+ }
55
+
56
+ declare const SEText: React.FC<SETextProps>;
57
+
58
+ export default SEText;
@@ -1,5 +1,6 @@
1
1
  import React, { useRef, useState, useEffect } from 'react';
2
- import { View, TouchableOpacity, Dimensions, Text } from 'react-native';
2
+ import { View, TouchableOpacity, Dimensions, Modal, Platform } from 'react-native';
3
+ import SEText from '../SEText';
3
4
 
4
5
  const variants = {
5
6
  light: {
@@ -28,9 +29,13 @@ const TooltipCard = ({
28
29
  const [visible, setVisible] = useState(false);
29
30
  const [tooltipPos, setTooltipPos] = useState({ top: 0, left: 0, arrowLeft: 24, arrowPosition: 'bottom' });
30
31
  const [currentIndex, setCurrentIndex] = useState(0);
31
- const [tooltipHeight, setTooltipHeight] = useState(0); // NOVO: altura dinâmica
32
- const [tooltipWidth, setTooltipWidth] = useState(320); // valor inicial
32
+ const [tooltipHeight, setTooltipHeight] = useState(0); // altura dinâmica
33
+ const [tooltipWidth, setTooltipWidth] = useState(300); // valor inicial alinhado ao maxWidth
33
34
  const triggerWrapperRef = useRef();
35
+ // Metade da base dos triângulos (outer e inner)
36
+ const ARROW_OUTER_HALF = 16; // borderLeft/Right: 16
37
+ const ARROW_INNER_HALF = 14; // borderLeft/Right: 14
38
+ const ARROW_EDGE_PADDING = 4; // acolchoamento mínimo nas bordas do card
34
39
 
35
40
  const hasItems = Array.isArray(items) && items.length > 0;
36
41
  const currentTitle = hasItems ? items[currentIndex]?.title : title;
@@ -44,33 +49,39 @@ const TooltipCard = ({
44
49
  // Recalcula a posição sempre que currentIndex ou tooltipHeight mudar e o tooltip estiver visível
45
50
  useEffect(() => {
46
51
  if (visible && triggerWrapperRef.current) {
52
+ // Aguarda o ciclo de render para garantir layout medido corretamente
47
53
  setTimeout(() => {
48
54
  triggerWrapperRef.current.measure((x, y, width, height, pageX, pageY) => {
49
55
  const screenWidth = Dimensions.get('window').width;
50
56
  let left = pageX + width / 2 - tooltipWidth / 2;
51
57
  left = Math.max(8, Math.min(left, screenWidth - tooltipWidth - 8));
52
- const arrowLeft = pageX + width / 2 - left - 14;
58
+ // Centraliza a ponta do triângulo no centro do trigger
59
+ // Usa o outer_half para alinhar a base externa (bordas 16)
60
+ let arrowLeft = Math.round(pageX + width / 2 - left - ARROW_OUTER_HALF);
53
61
  const offset = 8;
54
- let showAbove = pageY > tooltipHeight + offset + 24;
55
- let top, arrowPosition;
62
+ const showAbove = pageY > tooltipHeight + offset + 24;
63
+ let top;
64
+ let arrowPosition;
56
65
  if (showAbove) {
57
- ''
58
66
  top = pageY - tooltipHeight - offset - pointerHeight;
59
67
  arrowPosition = 'bottom';
60
68
  } else {
61
69
  top = pageY + height + offset;
62
70
  arrowPosition = 'top';
63
71
  }
72
+ // Garante que o triângulo não passe das bordas do card
73
+ const minArrowLeft = ARROW_OUTER_HALF + ARROW_EDGE_PADDING;
74
+ const maxArrowLeft = tooltipWidth - ARROW_OUTER_HALF - ARROW_EDGE_PADDING;
64
75
  setTooltipPos({
65
76
  top,
66
77
  left,
67
- arrowLeft: Math.max(16, Math.min(arrowLeft, tooltipWidth - 32)),
78
+ arrowLeft: Math.max(minArrowLeft, Math.min(arrowLeft, maxArrowLeft)),
68
79
  arrowPosition,
69
80
  });
70
81
  });
71
82
  }, 0);
72
83
  }
73
- }, [tooltipHeight, tooltipWidth, currentIndex, visible]); // dispara ao trocar conteúdo ou altura
84
+ }, [tooltipHeight, tooltipWidth, currentIndex, visible, pointerHeight]); // dispara ao trocar conteúdo ou altura
74
85
 
75
86
  const v = variants[variant];
76
87
  const isDark = variant === 'dark';
@@ -107,7 +118,7 @@ const TooltipCard = ({
107
118
  borderLeftWidth: 14,
108
119
  borderRightWidth: 14,
109
120
  borderTopColor: v.backgroundColor,
110
- left: tooltipPos.arrowLeft + 2,
121
+ left: tooltipPos.arrowLeft + (ARROW_OUTER_HALF - ARROW_INNER_HALF),
111
122
  bottom: -14,
112
123
  position: 'absolute',
113
124
  zIndex: 2,
@@ -145,7 +156,7 @@ const TooltipCard = ({
145
156
  borderLeftWidth: 14,
146
157
  borderRightWidth: 14,
147
158
  borderBottomColor: v.backgroundColor,
148
- left: tooltipPos.arrowLeft + 2,
159
+ left: tooltipPos.arrowLeft + (ARROW_OUTER_HALF - ARROW_INNER_HALF),
149
160
  top: -14,
150
161
  position: 'absolute',
151
162
  zIndex: 2,
@@ -167,81 +178,107 @@ const TooltipCard = ({
167
178
  onPress: showTooltip,
168
179
  })}
169
180
  </View>
170
- {/* Tooltip absoluto */}
181
+ {/* Tooltip absoluto via Modal para garantir que fica acima de tudo */}
171
182
  {visible && (
172
- <View style={{ position: 'absolute', top: 0, left: 0, width: Dimensions.get('window').width, height: Dimensions.get('window').height, zIndex: 9 }}>
173
- {/* Overlay para fechar ao clicar fora */}
174
- <TouchableOpacity
175
- style={{
176
- position: 'absolute',
177
- top: 0,
178
- left: 0,
179
- width: Dimensions.get('window').width,
180
- height: Dimensions.get('window').height,
181
- backgroundColor: 'transparent',
182
- }}
183
- activeOpacity={1}
184
- onPress={() => setVisible(false)}
185
- />
186
- {/* Tooltip absoluto */}
187
- <View
188
- style={{
189
- position: 'absolute',
190
- top: tooltipPos.top,
191
- left: tooltipPos.left,
192
- zIndex: 10,
193
- }}
194
- >
183
+ <Modal visible transparent animationType="fade" onRequestClose={() => setVisible(false)}>
184
+ <View style={{ flex: 1 }}>
185
+ {/* Overlay para fechar ao clicar fora */}
186
+ <TouchableOpacity
187
+ style={{
188
+ position: 'absolute',
189
+ top: 0,
190
+ left: 0,
191
+ width: Dimensions.get('window').width,
192
+ height: Dimensions.get('window').height,
193
+ backgroundColor: 'transparent',
194
+ }}
195
+ activeOpacity={1}
196
+ onPress={() => setVisible(false)}
197
+ />
198
+ {/* Tooltip absoluto */}
195
199
  <View
196
- onLayout={e => {
197
- const { height, width } = e.nativeEvent.layout;
198
- if (height !== tooltipHeight) setTooltipHeight(height);
199
- if (width !== tooltipWidth) setTooltipWidth(width);
200
+ style={{
201
+ position: 'absolute',
202
+ top: tooltipPos.top,
203
+ left: tooltipPos.left,
204
+ // zIndex não é necessário dentro do Modal, mas mantemos para iOS
205
+ zIndex: 9999,
200
206
  }}
201
207
  >
202
- {renderArrow()}
203
208
  <View
204
- style={[
205
- styles.card,
206
- { backgroundColor: v.backgroundColor, borderColor: v.borderColor },
207
- style,
208
- ]}
209
+ onLayout={e => {
210
+ const { height, width } = e.nativeEvent.layout;
211
+ if (height !== tooltipHeight) setTooltipHeight(height);
212
+ if (width !== tooltipWidth) setTooltipWidth(width);
213
+ }}
209
214
  >
210
- {currentTitle && <Text style={[styles.title, { color: v.textColor }]}>{currentTitle}</Text>}
211
- {currentDescription && <Text style={[styles.description, { color: v.textColor }]}>{currentDescription}</Text>}
212
- {/* Navegação se houver mais de um item */}
213
- {hasItems && items.length > 1 && (
214
- <View style={{ flexDirection: 'row', justifyContent: 'space-between', marginTop: 16 }}>
215
- <TouchableOpacity
216
- onPress={handlePrev}
217
- disabled={currentIndex === 0}
218
- style={{ opacity: currentIndex === 0 ? 0.5 : 1, padding: 8 }}
215
+ {renderArrow()}
216
+ <View
217
+ style={[
218
+ styles.card,
219
+ {
220
+ backgroundColor: v.backgroundColor,
221
+ borderColor: v.borderColor,
222
+ // Elevação alta para Android; dentro do Modal já resolve, mas é defensivo
223
+ elevation: Platform.OS === 'android' ? 24 : 0,
224
+ },
225
+ style,
226
+ ]}
227
+ >
228
+ {currentTitle && (
229
+ <SEText type="ns-heading-3" color={v.textColor} style={styles.title}>
230
+ {currentTitle}
231
+ </SEText>
232
+ )}
233
+ {currentDescription && (
234
+ <SEText
235
+ type="ns-sm-body"
236
+ color={v.textColor}
237
+ style={[
238
+ styles.description,
239
+ // Remove marginBottom se não houver título e não houver navegação
240
+ (!currentTitle && !(hasItems && items.length > 1)) && { marginBottom: 0 }
241
+ ]}
219
242
  >
220
- <Text style={{
221
- color: isDark ? '#E2FF66' : '#2A4FDA',
222
- fontWeight: 'bold',
223
- fontSize: 18,
224
- fontFamily: 'Nunito Sans',
225
- }}>{'< Voltar'}</Text>
226
- </TouchableOpacity>
227
- <TouchableOpacity
228
- onPress={handleNext}
229
- disabled={currentIndex === items.length - 1}
230
- style={{ opacity: currentIndex === items.length - 1 ? 0.5 : 1, padding: 8 }}
231
- >
232
- <Text style={{
233
- color: isDark ? '#E2FF66' : '#2A4FDA',
234
- fontWeight: 'bold',
235
- fontSize: 18,
236
- fontFamily: 'Nunito Sans',
237
- }}>{'Próximo >'}</Text>
238
- </TouchableOpacity>
239
- </View>
240
- )}
243
+ {currentDescription}
244
+ </SEText>
245
+ )}
246
+ {/* Navegação se houver mais de um item */}
247
+ {hasItems && items.length > 1 && (
248
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between', marginTop: 16 }}>
249
+ <TouchableOpacity
250
+ onPress={handlePrev}
251
+ disabled={currentIndex === 0}
252
+ style={{ opacity: currentIndex === 0 ? 0.5 : 1, padding: 8 }}
253
+ >
254
+ <SEText
255
+ type="ns-sm-body-bold"
256
+ color={isDark ? '#E2FF66' : '#2A4FDA'}
257
+ style={{ fontSize: 18 }}
258
+ >
259
+ {'< Voltar'}
260
+ </SEText>
261
+ </TouchableOpacity>
262
+ <TouchableOpacity
263
+ onPress={handleNext}
264
+ disabled={currentIndex === items.length - 1}
265
+ style={{ opacity: currentIndex === items.length - 1 ? 0.5 : 1, padding: 8 }}
266
+ >
267
+ <SEText
268
+ type="ns-sm-body-bold"
269
+ color={isDark ? '#E2FF66' : '#2A4FDA'}
270
+ style={{ fontSize: 18 }}
271
+ >
272
+ {'Próximo >'}
273
+ </SEText>
274
+ </TouchableOpacity>
275
+ </View>
276
+ )}
277
+ </View>
241
278
  </View>
242
279
  </View>
243
280
  </View>
244
- </View>
281
+ </Modal>
245
282
  )}
246
283
  </>
247
284
  );
@@ -251,8 +288,12 @@ const styles = {
251
288
  card: {
252
289
  borderRadius: 16,
253
290
  padding: 24,
254
- borderWidth: 1.5,
255
- borderColor: '#E2E9FC',
291
+ borderWidth: 2,
292
+ shadowColor: '#000',
293
+ shadowOpacity: 0.08,
294
+ shadowRadius: 12,
295
+ shadowOffset: { width: 0, height: 2 },
296
+ elevation: 2,
256
297
  maxWidth: 300, // Mantém o limite máximo
257
298
  },
258
299
  title: {
@@ -260,13 +301,11 @@ const styles = {
260
301
  fontWeight: 'bold',
261
302
  marginBottom: 8,
262
303
  lineHeight: 24,
263
- fontFamily: 'Nunito Sans',
264
304
  },
265
305
  description: {
266
306
  fontSize: 15,
267
307
  marginBottom: 16,
268
308
  lineHeight: 20,
269
- fontFamily: 'Nunito Sans',
270
309
  },
271
310
  arrow: {
272
311
  position: 'absolute',
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo, useState } from 'react';
2
2
  import { TouchableOpacity, Text, StyleSheet, View } from 'react-native';
3
- import SEIcon from '../SEIcon';
4
- import SEText from '../SEText';
3
+ import SEIcon from '~/superApp/UI/SEIcon';
4
+ import { SEText } from '~/UI';
5
5
  const Button = ({ label, size = 'medium', variant = 'filled', disabled = false, inverseStyle = false, onPress, iconName, iconPosition = 'both', expand = false, iconColor, }) => {
6
6
  const [isFocused, setIsFocused] = useState(false);
7
7
  const iconOnly = useMemo(() => !label && iconName, [label, iconName]);
@@ -3,7 +3,7 @@ declare function Icon({ name, size, color, style, }: {
3
3
  name: any;
4
4
  size?: number | undefined;
5
5
  color?: string | undefined;
6
- style: any;
6
+ style?: {} | undefined;
7
7
  }): React.JSX.Element;
8
8
  import React from 'react';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import IconRemix from 'react-native-remix-icon';
3
3
  import { iconEnums } from './iconEnums';
4
- const Icon = ({ name, size = 24, color = '#4F7CFE', style, }) => <IconRemix {...{ style, size, color, name }}/>;
4
+ const Icon = ({ name, size = 24, color = '#4F7CFE', style = {}, }) => <IconRemix {...{ style, size, color, name }}/>;
5
5
  export default Icon;
@@ -1,17 +1,18 @@
1
1
  import React from 'react';
2
+ import { ViewStyle } from 'react-native';
2
3
  interface NavigationItemProps {
3
- iconName: any;
4
+ iconName: string;
4
5
  label: string;
5
6
  variant?: 'default' | 'selected' | 'disabled';
6
7
  size?: 'small' | 'medium' | 'large';
7
8
  onPress?: () => void;
8
- style?: any;
9
+ style?: ViewStyle;
9
10
  iconColor?: string;
10
11
  textColor?: string;
11
12
  backgroundColor?: string;
12
13
  borderColor?: string;
13
14
  showArrow?: boolean;
14
- badge?: number | string;
15
+ badge?: string;
15
16
  badgeStyle?: 'standard' | string;
16
17
  description?: string;
17
18
  layout?: 'standard' | 'expanded' | 'list';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/NavigationItem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC9C,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;IAC1C,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAyNjD,CAAC;AAuRF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/NavigationItem/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA4C,SAAS,EAAa,MAAM,cAAc,CAAC;AAI9F,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC9C,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;IAC1C,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA8NjD,CAAC;AAuRF,eAAe,cAAc,CAAC"}
@@ -136,9 +136,12 @@ iconBackgroundColor, // Cor de fundo personalizada para o ícone
136
136
  {description}
137
137
  </Text>
138
138
  </View>
139
- </View>) : (layout === 'list' ? (<SEText type={"ns-heading-4"} style={[{ flex: 1 }, textColor && { color: textColor }]} numberOfLines={1}>
140
- {label}
141
- </SEText>) : (<Text style={labelStyle} numberOfLines={1}>
139
+ </View>) : (layout === 'list' ? ((() => {
140
+ const seTextStyle = [{ flex: 1 }, ...(textColor ? [{ color: textColor }] : [])];
141
+ return (<SEText type={'ns-heading-4'} style={seTextStyle} numberOfLines={1}>
142
+ {label}
143
+ </SEText>);
144
+ })()) : (<Text style={labelStyle} numberOfLines={1}>
142
145
  {label}
143
146
  </Text>))}
144
147
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/TooltipCard/index.jsx"],"names":[],"mappings":";AAkBA;;;;;;;;sBAqOC;kBAvPkD,OAAO"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/TooltipCard/index.jsx"],"names":[],"mappings":";AAmBA;;;;;;;;sBAyQC;kBA5RkD,OAAO"}
@@ -1,5 +1,6 @@
1
1
  import React, { useRef, useState, useEffect } from 'react';
2
- import { View, TouchableOpacity, Dimensions, Text } from 'react-native';
2
+ import { View, TouchableOpacity, Dimensions, Modal, Platform } from 'react-native';
3
+ import SEText from '../SEText';
3
4
  const variants = {
4
5
  light: {
5
6
  backgroundColor: '#fff',
@@ -18,9 +19,13 @@ const TooltipCard = ({ trigger, variant = 'light', title, description, items, st
18
19
  const [visible, setVisible] = useState(false);
19
20
  const [tooltipPos, setTooltipPos] = useState({ top: 0, left: 0, arrowLeft: 24, arrowPosition: 'bottom' });
20
21
  const [currentIndex, setCurrentIndex] = useState(0);
21
- const [tooltipHeight, setTooltipHeight] = useState(0); // NOVO: altura dinâmica
22
- const [tooltipWidth, setTooltipWidth] = useState(320); // valor inicial
22
+ const [tooltipHeight, setTooltipHeight] = useState(0); // altura dinâmica
23
+ const [tooltipWidth, setTooltipWidth] = useState(300); // valor inicial alinhado ao maxWidth
23
24
  const triggerWrapperRef = useRef();
25
+ // Metade da base dos triângulos (outer e inner)
26
+ const ARROW_OUTER_HALF = 16; // borderLeft/Right: 16
27
+ const ARROW_INNER_HALF = 14; // borderLeft/Right: 14
28
+ const ARROW_EDGE_PADDING = 4; // acolchoamento mínimo nas bordas do card
24
29
  const hasItems = Array.isArray(items) && items.length > 0;
25
30
  const currentTitle = hasItems ? items[currentIndex]?.title : title;
26
31
  const currentDescription = hasItems ? items[currentIndex]?.description : description;
@@ -31,17 +36,20 @@ const TooltipCard = ({ trigger, variant = 'light', title, description, items, st
31
36
  // Recalcula a posição sempre que currentIndex ou tooltipHeight mudar e o tooltip estiver visível
32
37
  useEffect(() => {
33
38
  if (visible && triggerWrapperRef.current) {
39
+ // Aguarda o ciclo de render para garantir layout medido corretamente
34
40
  setTimeout(() => {
35
41
  triggerWrapperRef.current.measure((x, y, width, height, pageX, pageY) => {
36
42
  const screenWidth = Dimensions.get('window').width;
37
43
  let left = pageX + width / 2 - tooltipWidth / 2;
38
44
  left = Math.max(8, Math.min(left, screenWidth - tooltipWidth - 8));
39
- const arrowLeft = pageX + width / 2 - left - 14;
45
+ // Centraliza a ponta do triângulo no centro do trigger
46
+ // Usa o outer_half para alinhar a base externa (bordas 16)
47
+ let arrowLeft = Math.round(pageX + width / 2 - left - ARROW_OUTER_HALF);
40
48
  const offset = 8;
41
- let showAbove = pageY > tooltipHeight + offset + 24;
42
- let top, arrowPosition;
49
+ const showAbove = pageY > tooltipHeight + offset + 24;
50
+ let top;
51
+ let arrowPosition;
43
52
  if (showAbove) {
44
- '';
45
53
  top = pageY - tooltipHeight - offset - pointerHeight;
46
54
  arrowPosition = 'bottom';
47
55
  }
@@ -49,16 +57,19 @@ const TooltipCard = ({ trigger, variant = 'light', title, description, items, st
49
57
  top = pageY + height + offset;
50
58
  arrowPosition = 'top';
51
59
  }
60
+ // Garante que o triângulo não passe das bordas do card
61
+ const minArrowLeft = ARROW_OUTER_HALF + ARROW_EDGE_PADDING;
62
+ const maxArrowLeft = tooltipWidth - ARROW_OUTER_HALF - ARROW_EDGE_PADDING;
52
63
  setTooltipPos({
53
64
  top,
54
65
  left,
55
- arrowLeft: Math.max(16, Math.min(arrowLeft, tooltipWidth - 32)),
66
+ arrowLeft: Math.max(minArrowLeft, Math.min(arrowLeft, maxArrowLeft)),
56
67
  arrowPosition,
57
68
  });
58
69
  });
59
70
  }, 0);
60
71
  }
61
- }, [tooltipHeight, tooltipWidth, currentIndex, visible]); // dispara ao trocar conteúdo ou altura
72
+ }, [tooltipHeight, tooltipWidth, currentIndex, visible, pointerHeight]); // dispara ao trocar conteúdo ou altura
62
73
  const v = variants[variant];
63
74
  const isDark = variant === 'dark';
64
75
  // Renderiza a seta na posição correta
@@ -89,7 +100,7 @@ const TooltipCard = ({ trigger, variant = 'light', title, description, items, st
89
100
  borderLeftWidth: 14,
90
101
  borderRightWidth: 14,
91
102
  borderTopColor: v.backgroundColor,
92
- left: tooltipPos.arrowLeft + 2,
103
+ left: tooltipPos.arrowLeft + (ARROW_OUTER_HALF - ARROW_INNER_HALF),
93
104
  bottom: -14,
94
105
  position: 'absolute',
95
106
  zIndex: 2,
@@ -121,7 +132,7 @@ const TooltipCard = ({ trigger, variant = 'light', title, description, items, st
121
132
  borderLeftWidth: 14,
122
133
  borderRightWidth: 14,
123
134
  borderBottomColor: v.backgroundColor,
124
- left: tooltipPos.arrowLeft + 2,
135
+ left: tooltipPos.arrowLeft + (ARROW_OUTER_HALF - ARROW_INNER_HALF),
125
136
  top: -14,
126
137
  position: 'absolute',
127
138
  zIndex: 2,
@@ -138,10 +149,11 @@ const TooltipCard = ({ trigger, variant = 'light', title, description, items, st
138
149
  onPress: showTooltip,
139
150
  })}
140
151
  </View>
141
- {/* Tooltip absoluto */}
142
- {visible && (<View style={{ position: 'absolute', top: 0, left: 0, width: Dimensions.get('window').width, height: Dimensions.get('window').height, zIndex: 9 }}>
143
- {/* Overlay para fechar ao clicar fora */}
144
- <TouchableOpacity style={{
152
+ {/* Tooltip absoluto via Modal para garantir que fica acima de tudo */}
153
+ {visible && (<Modal visible transparent animationType="fade" onRequestClose={() => setVisible(false)}>
154
+ <View style={{ flex: 1 }}>
155
+ {/* Overlay para fechar ao clicar fora */}
156
+ <TouchableOpacity style={{
145
157
  position: 'absolute',
146
158
  top: 0,
147
159
  left: 0,
@@ -149,59 +161,72 @@ const TooltipCard = ({ trigger, variant = 'light', title, description, items, st
149
161
  height: Dimensions.get('window').height,
150
162
  backgroundColor: 'transparent',
151
163
  }} activeOpacity={1} onPress={() => setVisible(false)}/>
152
- {/* Tooltip absoluto */}
153
- <View style={{
164
+ {/* Tooltip absoluto */}
165
+ <View style={{
154
166
  position: 'absolute',
155
167
  top: tooltipPos.top,
156
168
  left: tooltipPos.left,
157
- zIndex: 10,
169
+ // zIndex não é necessário dentro do Modal, mas mantemos para iOS
170
+ zIndex: 9999,
158
171
  }}>
159
- <View onLayout={e => {
172
+ <View onLayout={e => {
160
173
  const { height, width } = e.nativeEvent.layout;
161
174
  if (height !== tooltipHeight)
162
175
  setTooltipHeight(height);
163
176
  if (width !== tooltipWidth)
164
177
  setTooltipWidth(width);
165
178
  }}>
166
- {renderArrow()}
167
- <View style={[
179
+ {renderArrow()}
180
+ <View style={[
168
181
  styles.card,
169
- { backgroundColor: v.backgroundColor, borderColor: v.borderColor },
182
+ {
183
+ backgroundColor: v.backgroundColor,
184
+ borderColor: v.borderColor,
185
+ // Elevação alta para Android; dentro do Modal já resolve, mas é defensivo
186
+ elevation: Platform.OS === 'android' ? 24 : 0,
187
+ },
170
188
  style,
171
189
  ]}>
172
- {currentTitle && <Text style={[styles.title, { color: v.textColor }]}>{currentTitle}</Text>}
173
- {currentDescription && <Text style={[styles.description, { color: v.textColor }]}>{currentDescription}</Text>}
174
- {/* Navegação se houver mais de um item */}
175
- {hasItems && items.length > 1 && (<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginTop: 16 }}>
176
- <TouchableOpacity onPress={handlePrev} disabled={currentIndex === 0} style={{ opacity: currentIndex === 0 ? 0.5 : 1, padding: 8 }}>
177
- <Text style={{
178
- color: isDark ? '#E2FF66' : '#2A4FDA',
179
- fontWeight: 'bold',
180
- fontSize: 18,
181
- fontFamily: 'Nunito Sans',
182
- }}>{'< Voltar'}</Text>
183
- </TouchableOpacity>
184
- <TouchableOpacity onPress={handleNext} disabled={currentIndex === items.length - 1} style={{ opacity: currentIndex === items.length - 1 ? 0.5 : 1, padding: 8 }}>
185
- <Text style={{
186
- color: isDark ? '#E2FF66' : '#2A4FDA',
187
- fontWeight: 'bold',
188
- fontSize: 18,
189
- fontFamily: 'Nunito Sans',
190
- }}>{'Próximo >'}</Text>
191
- </TouchableOpacity>
192
- </View>)}
190
+ {currentTitle && (<SEText type="ns-heading-3" color={v.textColor} style={styles.title}>
191
+ {currentTitle}
192
+ </SEText>)}
193
+ {currentDescription && (<SEText type="ns-sm-body" color={v.textColor} style={[
194
+ styles.description,
195
+ // Remove marginBottom se não houver título e não houver navegação
196
+ (!currentTitle && !(hasItems && items.length > 1)) && { marginBottom: 0 }
197
+ ]}>
198
+ {currentDescription}
199
+ </SEText>)}
200
+ {/* Navegação se houver mais de um item */}
201
+ {hasItems && items.length > 1 && (<View style={{ flexDirection: 'row', justifyContent: 'space-between', marginTop: 16 }}>
202
+ <TouchableOpacity onPress={handlePrev} disabled={currentIndex === 0} style={{ opacity: currentIndex === 0 ? 0.5 : 1, padding: 8 }}>
203
+ <SEText type="ns-sm-body-bold" color={isDark ? '#E2FF66' : '#2A4FDA'} style={{ fontSize: 18 }}>
204
+ {'< Voltar'}
205
+ </SEText>
206
+ </TouchableOpacity>
207
+ <TouchableOpacity onPress={handleNext} disabled={currentIndex === items.length - 1} style={{ opacity: currentIndex === items.length - 1 ? 0.5 : 1, padding: 8 }}>
208
+ <SEText type="ns-sm-body-bold" color={isDark ? '#E2FF66' : '#2A4FDA'} style={{ fontSize: 18 }}>
209
+ {'Próximo >'}
210
+ </SEText>
211
+ </TouchableOpacity>
212
+ </View>)}
213
+ </View>
193
214
  </View>
194
215
  </View>
195
216
  </View>
196
- </View>)}
217
+ </Modal>)}
197
218
  </>);
198
219
  };
199
220
  const styles = {
200
221
  card: {
201
222
  borderRadius: 16,
202
223
  padding: 24,
203
- borderWidth: 1.5,
204
- borderColor: '#E2E9FC',
224
+ borderWidth: 2,
225
+ shadowColor: '#000',
226
+ shadowOpacity: 0.08,
227
+ shadowRadius: 12,
228
+ shadowOffset: { width: 0, height: 2 },
229
+ elevation: 2,
205
230
  maxWidth: 300, // Mantém o limite máximo
206
231
  },
207
232
  title: {
@@ -209,13 +234,11 @@ const styles = {
209
234
  fontWeight: 'bold',
210
235
  marginBottom: 8,
211
236
  lineHeight: 24,
212
- fontFamily: 'Nunito Sans',
213
237
  },
214
238
  description: {
215
239
  fontSize: 15,
216
240
  marginBottom: 16,
217
241
  lineHeight: 20,
218
- fontFamily: 'Nunito Sans',
219
242
  },
220
243
  arrow: {
221
244
  position: 'absolute',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vpt-sebraeds",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Biblioteca de componentes React Native do Sebrae",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",