@xetwa/design-system 1.0.22 → 1.0.24
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.
package/package.json
CHANGED
|
@@ -16,12 +16,16 @@ export interface AnswerOptionCardProps {
|
|
|
16
16
|
status?: AnswerOptionStatus;
|
|
17
17
|
/** O texto principal da opção. */
|
|
18
18
|
label: string;
|
|
19
|
-
/** Nó renderizado à esquerda do texto (ex:
|
|
19
|
+
/** Nó renderizado à esquerda do texto (ex: ícones complexos). */
|
|
20
20
|
prefixNode?: ReactNode;
|
|
21
|
+
/** Letra ou número a exibir automaticamente do lado esquerdo. */
|
|
22
|
+
prefix?: string | number;
|
|
21
23
|
/** Nó renderizado à direita. Se omitido, renderiza automaticamente ícones de check/cross consoante o estado. */
|
|
22
24
|
suffixNode?: ReactNode;
|
|
23
25
|
/** Callback para o evento de clique. */
|
|
24
26
|
onPress?: () => void;
|
|
27
|
+
/** Aumenta ligeiramente o tamanho do cartão quando selecionado. */
|
|
28
|
+
scaleOnSelect?: boolean;
|
|
25
29
|
/** Estilos adicionais para o container. */
|
|
26
30
|
style?: ViewStyle | ViewStyle[];
|
|
27
31
|
}
|
|
@@ -30,8 +34,10 @@ export const AnswerOptionCard = ({
|
|
|
30
34
|
status = 'default',
|
|
31
35
|
label,
|
|
32
36
|
prefixNode,
|
|
37
|
+
prefix,
|
|
33
38
|
suffixNode,
|
|
34
39
|
onPress,
|
|
40
|
+
scaleOnSelect = false,
|
|
35
41
|
style,
|
|
36
42
|
}: AnswerOptionCardProps) => {
|
|
37
43
|
const { scale, scaleText } = useResponsive();
|
|
@@ -134,6 +140,7 @@ export const AnswerOptionCard = ({
|
|
|
134
140
|
paddingHorizontal: scale(15),
|
|
135
141
|
borderRadius: scale(12),
|
|
136
142
|
minHeight: scale(56),
|
|
143
|
+
transform: scaleOnSelect && status === 'selected' ? [{ scale: 1.02 }] : [],
|
|
137
144
|
},
|
|
138
145
|
webShadow,
|
|
139
146
|
style,
|
|
@@ -144,6 +151,17 @@ export const AnswerOptionCard = ({
|
|
|
144
151
|
<View style={styles.contentRow}>
|
|
145
152
|
<View style={styles.leftSection}>
|
|
146
153
|
{prefixNode && <View style={[styles.prefixContainer, { marginRight: scale(12) }]}>{prefixNode}</View>}
|
|
154
|
+
{prefix && !prefixNode && (
|
|
155
|
+
<View style={[styles.prefixContainer, { marginRight: scale(12) }]}>
|
|
156
|
+
<Typography style={{
|
|
157
|
+
color: status === 'selected' || status === 'correct' ? theme.colors.primary : theme.colors.brown[400],
|
|
158
|
+
fontWeight: 'bold',
|
|
159
|
+
fontSize: scaleText(16)
|
|
160
|
+
}}>
|
|
161
|
+
{prefix}
|
|
162
|
+
</Typography>
|
|
163
|
+
</View>
|
|
164
|
+
)}
|
|
147
165
|
<Typography
|
|
148
166
|
style={[
|
|
149
167
|
styles.label,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { theme } from '../../../styles/theme';
|
|
3
|
+
import { Typography } from '../../Typography/Typography';
|
|
4
|
+
|
|
5
|
+
export interface NumberBadgeProps {
|
|
6
|
+
value: string | number;
|
|
7
|
+
selected?: boolean;
|
|
8
|
+
correct?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const NumberBadge = ({ value, selected = false, correct = false }: NumberBadgeProps) => {
|
|
12
|
+
let bgColor = theme.colors.brown[100];
|
|
13
|
+
let textColor = theme.colors.brown[500];
|
|
14
|
+
|
|
15
|
+
if (selected) {
|
|
16
|
+
bgColor = theme.colors.primary;
|
|
17
|
+
textColor = theme.colors.white;
|
|
18
|
+
} else if (correct) {
|
|
19
|
+
bgColor = theme.colors.success;
|
|
20
|
+
textColor = theme.colors.white;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<View style={{
|
|
25
|
+
width: 28,
|
|
26
|
+
height: 28,
|
|
27
|
+
borderRadius: 14,
|
|
28
|
+
backgroundColor: bgColor,
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
}}>
|
|
32
|
+
<Typography style={{
|
|
33
|
+
fontSize: 14,
|
|
34
|
+
color: textColor,
|
|
35
|
+
}}>
|
|
36
|
+
{value}
|
|
37
|
+
</Typography>
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ export * from './components/Cards/Passport/PassportViewer';
|
|
|
37
37
|
export * from './components/DataDisplay/Avatar/Avatar';
|
|
38
38
|
export * from './components/DataDisplay/InstructionBubble/InstructionBubble';
|
|
39
39
|
export * from './components/DataDisplay/StatBadge/StatBadge';
|
|
40
|
+
export * from './components/DataDisplay/NumberBadge/NumberBadge';
|
|
40
41
|
export * from './components/Forms/Checkbox/Checkbox';
|
|
41
42
|
export * from './components/Forms/DaySelector/DaySelector';
|
|
42
43
|
export * from './components/Forms/Radio/Radio';
|