@proulr/sdui-components 0.1.44 → 0.1.46
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
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
-
import QRCode from 'react-native-qrcode-svg';
|
|
4
|
-
import brandMarkAsset from '../assets/proulr-brand-mark.png';
|
|
5
|
-
import { gradients, m3Colors, m3Shape, m3Type, spacing } from '../theme/proulr-theme';
|
|
6
2
|
import { resolveViewStyleProps } from '../theme/resolve-style-props';
|
|
3
|
+
import { BrandQrNametag } from '../ui/brand-qr-code';
|
|
7
4
|
import type { SduiBlockRenderProps } from './SduiPrimitiveBlocks';
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* (roxo → fúcsia) e brand mark no centro (ECC alto para manter a leitura).
|
|
7
|
+
* Bloco wire do QR de marca — delega para o BrandQrNametag (componente único
|
|
8
|
+
* de QR do produto, usado também fora do SDUI, ex.: convite de grupo no chat).
|
|
13
9
|
* Wire: `value` = conteúdo do QR, `size` em px, `label` = texto sob o código.
|
|
14
10
|
*/
|
|
15
11
|
export function SduiQrCodeBlock({ block }: SduiBlockRenderProps) {
|
|
@@ -20,41 +16,11 @@ export function SduiQrCodeBlock({ block }: SduiBlockRenderProps) {
|
|
|
20
16
|
const label = typeof block.props.label === 'string' ? block.props.label : '';
|
|
21
17
|
|
|
22
18
|
return (
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
backgroundColor={m3Colors.inverseSurface}
|
|
30
|
-
enableLinearGradient
|
|
31
|
-
linearGradient={[...gradients.brand]}
|
|
32
|
-
ecl="H"
|
|
33
|
-
logo={brandMarkAsset}
|
|
34
|
-
logoSize={Math.round(size * 0.22)}
|
|
35
|
-
logoBackgroundColor={m3Colors.inverseSurface}
|
|
36
|
-
logoMargin={Math.max(3, Math.round(size * 0.02))}
|
|
37
|
-
logoBorderRadius={m3Shape.cornerMedium}
|
|
38
|
-
/>
|
|
39
|
-
{label ? <Text style={styles.label}>{label}</Text> : null}
|
|
40
|
-
</View>
|
|
19
|
+
<BrandQrNametag
|
|
20
|
+
value={value}
|
|
21
|
+
size={size}
|
|
22
|
+
label={label || undefined}
|
|
23
|
+
style={resolveViewStyleProps(block.props.style as Record<string, unknown>)}
|
|
24
|
+
/>
|
|
41
25
|
);
|
|
42
26
|
}
|
|
43
|
-
|
|
44
|
-
const styles = StyleSheet.create({
|
|
45
|
-
card: {
|
|
46
|
-
alignSelf: 'center',
|
|
47
|
-
alignItems: 'center',
|
|
48
|
-
gap: spacing.lg,
|
|
49
|
-
backgroundColor: m3Colors.inverseSurface,
|
|
50
|
-
borderRadius: m3Shape.cornerExtraLarge,
|
|
51
|
-
paddingVertical: spacing.xl,
|
|
52
|
-
paddingHorizontal: spacing.xl,
|
|
53
|
-
},
|
|
54
|
-
label: {
|
|
55
|
-
...m3Type.title,
|
|
56
|
-
color: m3Colors.inverseOnSurface,
|
|
57
|
-
letterSpacing: 2,
|
|
58
|
-
textTransform: 'uppercase',
|
|
59
|
-
},
|
|
60
|
-
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, Text, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import QRCode from 'react-native-qrcode-svg';
|
|
4
|
+
import { gradients, m3Colors, m3Shape, m3Type, spacing } from '../theme/proulr-theme';
|
|
5
|
+
|
|
6
|
+
// `require` (padrão RN para assets estáticos) — import ESM de .png exigiria um
|
|
7
|
+
// ambient d.ts que consumers compilando o source em node_modules não enxergam.
|
|
8
|
+
const brandMarkAsset = require('../assets/proulr-brand-mark.png') as number;
|
|
9
|
+
|
|
10
|
+
export type BrandQrCodeProps = {
|
|
11
|
+
value: string;
|
|
12
|
+
size?: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* QR customizado da marca (ref. QR do Instagram): módulos no gradiente Proulr
|
|
17
|
+
* (roxo → fúcsia) sobre fundo claro e brand mark no centro, com ECC "H" para
|
|
18
|
+
* manter a leitura mesmo com o logo cobrindo o miolo. Componente único para
|
|
19
|
+
* todo QR de produto (convidar amigos, convite de grupo, etc.).
|
|
20
|
+
*/
|
|
21
|
+
export function BrandQrCode({ value, size = 200 }: BrandQrCodeProps) {
|
|
22
|
+
return (
|
|
23
|
+
<QRCode
|
|
24
|
+
value={value}
|
|
25
|
+
size={size}
|
|
26
|
+
backgroundColor={m3Colors.inverseSurface}
|
|
27
|
+
enableLinearGradient
|
|
28
|
+
linearGradient={[...gradients.brand]}
|
|
29
|
+
ecl="H"
|
|
30
|
+
logo={brandMarkAsset}
|
|
31
|
+
logoSize={Math.round(size * 0.22)}
|
|
32
|
+
logoBackgroundColor={m3Colors.inverseSurface}
|
|
33
|
+
logoMargin={Math.max(3, Math.round(size * 0.02))}
|
|
34
|
+
logoBorderRadius={m3Shape.cornerMedium}
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type BrandQrNametagProps = BrandQrCodeProps & {
|
|
40
|
+
label?: string;
|
|
41
|
+
style?: StyleProp<ViewStyle>;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Nametag: cartão claro (inverseSurface) com o BrandQrCode e rótulo opcional
|
|
46
|
+
* (ex.: @handle). É o "cartão de convite" padrão exibido em telas e bubbles.
|
|
47
|
+
*/
|
|
48
|
+
export function BrandQrNametag({ value, size = 200, label, style }: BrandQrNametagProps) {
|
|
49
|
+
const cardPadding = size >= 160 ? spacing.xl : spacing.md;
|
|
50
|
+
return (
|
|
51
|
+
<View style={[styles.card, { padding: cardPadding }, style]}>
|
|
52
|
+
<BrandQrCode value={value} size={size} />
|
|
53
|
+
{label ? <Text style={styles.label}>{label}</Text> : null}
|
|
54
|
+
</View>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const styles = StyleSheet.create({
|
|
59
|
+
card: {
|
|
60
|
+
alignSelf: 'center',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
gap: spacing.lg,
|
|
63
|
+
backgroundColor: m3Colors.inverseSurface,
|
|
64
|
+
borderRadius: m3Shape.cornerExtraLarge,
|
|
65
|
+
},
|
|
66
|
+
label: {
|
|
67
|
+
...m3Type.title,
|
|
68
|
+
color: m3Colors.inverseOnSurface,
|
|
69
|
+
letterSpacing: 2,
|
|
70
|
+
textTransform: 'uppercase',
|
|
71
|
+
},
|
|
72
|
+
});
|
package/src/renderer/ui/index.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export { AppButton } from './AppButton';
|
|
2
|
+
export {
|
|
3
|
+
BrandQrCode,
|
|
4
|
+
BrandQrNametag,
|
|
5
|
+
type BrandQrCodeProps,
|
|
6
|
+
type BrandQrNametagProps,
|
|
7
|
+
} from './brand-qr-code';
|
|
2
8
|
export { AppChromeIconButton } from './AppChromeIconButton';
|
|
3
9
|
export { AppLoadingSpinner } from './AppLoadingSpinner';
|
|
4
10
|
export { AuthStepShell } from './AuthStepShell';
|