@xetwa/design-system 1.0.21 → 1.0.23
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
|
@@ -25,6 +25,8 @@ export interface WordChipProps {
|
|
|
25
25
|
fullWidth?: boolean;
|
|
26
26
|
/** Tamanho do chip. */
|
|
27
27
|
size?: 'sm' | 'md' | 'lg';
|
|
28
|
+
/** Largura personalizada. Ignora max-width e align-self flex-start. */
|
|
29
|
+
width?: number | string;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export const WordChip = ({
|
|
@@ -35,6 +37,7 @@ export const WordChip = ({
|
|
|
35
37
|
disabled = false,
|
|
36
38
|
fullWidth = false,
|
|
37
39
|
size = 'md',
|
|
40
|
+
width,
|
|
38
41
|
}: WordChipProps) => {
|
|
39
42
|
const { scale, scaleText } = useResponsive();
|
|
40
43
|
const [isPressed, setIsPressed] = useState(false);
|
|
@@ -103,13 +106,13 @@ export const WordChip = ({
|
|
|
103
106
|
const showPressed = isPressed && !isDisabled;
|
|
104
107
|
|
|
105
108
|
return (
|
|
106
|
-
<Animated.View style={[{ transform: [{ scale: scaleAnim }] }, style]}>
|
|
109
|
+
<Animated.View style={[{ transform: [{ scale: scaleAnim }] }, width ? { width } : null, style]}>
|
|
107
110
|
<Pressable
|
|
108
111
|
onPressIn={() => setIsPressed(true)}
|
|
109
112
|
onPressOut={() => setIsPressed(false)}
|
|
110
113
|
onPress={onPress}
|
|
111
114
|
disabled={isDisabled}
|
|
112
|
-
style={{ alignSelf: fullWidth ? 'stretch' : 'flex-start' }}
|
|
115
|
+
style={{ alignSelf: width ? 'stretch' : (fullWidth ? 'stretch' : 'flex-start') }}
|
|
113
116
|
>
|
|
114
117
|
<View style={[
|
|
115
118
|
styles.shadowContainer,
|
|
@@ -118,7 +121,8 @@ export const WordChip = ({
|
|
|
118
121
|
borderRadius: scale(12),
|
|
119
122
|
paddingBottom: showPressed ? 0 : scale(3),
|
|
120
123
|
marginTop: showPressed ? scale(3) : 0,
|
|
121
|
-
}
|
|
124
|
+
},
|
|
125
|
+
(fullWidth || width) ? { alignSelf: 'stretch', width: '100%' } : null
|
|
122
126
|
]}>
|
|
123
127
|
<View style={[
|
|
124
128
|
styles.innerContainer,
|
|
@@ -130,7 +134,7 @@ export const WordChip = ({
|
|
|
130
134
|
paddingHorizontal: scale(size === 'lg' ? 20 : size === 'sm' ? 10 : 14),
|
|
131
135
|
minHeight: scale(size === 'lg' ? 56 : size === 'sm' ? 36 : 44),
|
|
132
136
|
},
|
|
133
|
-
fullWidth
|
|
137
|
+
(fullWidth || width) ? { width: '100%' } : null
|
|
134
138
|
]}>
|
|
135
139
|
<Typography style={[
|
|
136
140
|
styles.text,
|
|
@@ -16,8 +16,10 @@ 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. */
|
|
@@ -30,6 +32,7 @@ export const AnswerOptionCard = ({
|
|
|
30
32
|
status = 'default',
|
|
31
33
|
label,
|
|
32
34
|
prefixNode,
|
|
35
|
+
prefix,
|
|
33
36
|
suffixNode,
|
|
34
37
|
onPress,
|
|
35
38
|
style,
|
|
@@ -144,6 +147,17 @@ export const AnswerOptionCard = ({
|
|
|
144
147
|
<View style={styles.contentRow}>
|
|
145
148
|
<View style={styles.leftSection}>
|
|
146
149
|
{prefixNode && <View style={[styles.prefixContainer, { marginRight: scale(12) }]}>{prefixNode}</View>}
|
|
150
|
+
{prefix && !prefixNode && (
|
|
151
|
+
<View style={[styles.prefixContainer, { marginRight: scale(12) }]}>
|
|
152
|
+
<Typography style={{
|
|
153
|
+
color: status === 'selected' || status === 'correct' ? theme.colors.primary : theme.colors.brown[400],
|
|
154
|
+
fontWeight: 'bold',
|
|
155
|
+
fontSize: scaleText(16)
|
|
156
|
+
}}>
|
|
157
|
+
{prefix}
|
|
158
|
+
</Typography>
|
|
159
|
+
</View>
|
|
160
|
+
)}
|
|
147
161
|
<Typography
|
|
148
162
|
style={[
|
|
149
163
|
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';
|