@proulr/sdui-components 0.1.37 → 0.1.38
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proulr/sdui-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/renderer/index.ts",
|
|
6
6
|
"types": "./src/renderer/index.ts",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@proulr/sdui-contract": "^0.1.10"
|
|
40
|
+
"@proulr/sdui-contract": "^0.1.10",
|
|
41
|
+
"react-native-qrcode-svg": "^6.3.21"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"expo-blur": ">=15",
|
|
@@ -45,7 +46,8 @@
|
|
|
45
46
|
"react": ">=19",
|
|
46
47
|
"react-native": ">=0.85",
|
|
47
48
|
"react-native-google-mobile-ads": ">=16",
|
|
48
|
-
"react-native-safe-area-context": ">=5"
|
|
49
|
+
"react-native-safe-area-context": ">=5",
|
|
50
|
+
"react-native-svg": ">=15"
|
|
49
51
|
},
|
|
50
52
|
"peerDependenciesMeta": {
|
|
51
53
|
"react": {
|
|
@@ -65,6 +67,9 @@
|
|
|
65
67
|
},
|
|
66
68
|
"react-native-safe-area-context": {
|
|
67
69
|
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"react-native-svg": {
|
|
72
|
+
"optional": true
|
|
68
73
|
}
|
|
69
74
|
},
|
|
70
75
|
"devDependencies": {
|
|
@@ -82,6 +87,7 @@
|
|
|
82
87
|
"react-native": "0.85.3",
|
|
83
88
|
"react-native-google-mobile-ads": "^16.3.4",
|
|
84
89
|
"react-native-safe-area-context": "~5.7.0",
|
|
90
|
+
"react-native-svg": "^15.15.5",
|
|
85
91
|
"typescript": "~6.0.3",
|
|
86
92
|
"vitest": "^3.2.7"
|
|
87
93
|
},
|
|
@@ -59,6 +59,16 @@ type IconProps = LayoutProps & {
|
|
|
59
59
|
|
|
60
60
|
export const Icon: BdcComponent = (props) => layoutBlock('icon', props as IconProps);
|
|
61
61
|
|
|
62
|
+
type QrCodeProps = LayoutProps & {
|
|
63
|
+
/** Conteúdo codificado no QR (URL de convite). */
|
|
64
|
+
value: string;
|
|
65
|
+
size?: number;
|
|
66
|
+
/** Rótulo exibido sob o QR (ex.: '@handle'). */
|
|
67
|
+
label?: string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const QrCode: BdcComponent = (props) => layoutBlock('qr_code', props as QrCodeProps);
|
|
71
|
+
|
|
62
72
|
type InfoBannerProps = LayoutProps & {
|
|
63
73
|
message: string;
|
|
64
74
|
};
|
package/src/bdc/index.ts
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import QRCode from 'react-native-qrcode-svg';
|
|
4
|
+
import { m3Colors, m3Shape, m3Type, spacing } from '../theme/proulr-theme';
|
|
5
|
+
import { resolveViewStyleProps } from '../theme/resolve-style-props';
|
|
6
|
+
import type { SduiBlockRenderProps } from './SduiPrimitiveBlocks';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Nametag de QR estilo "cartão de convite" (ref. Instagram): cartão claro
|
|
10
|
+
* (inverseSurface) com QR de alto contraste e rótulo opcional (ex.: @handle).
|
|
11
|
+
* Wire: `value` = conteúdo do QR, `size` em px, `label` = texto sob o código.
|
|
12
|
+
*/
|
|
13
|
+
export function SduiQrCodeBlock({ block }: SduiBlockRenderProps) {
|
|
14
|
+
const value = typeof block.props.value === 'string' ? block.props.value : '';
|
|
15
|
+
if (!value) return null;
|
|
16
|
+
|
|
17
|
+
const size = typeof block.props.size === 'number' ? block.props.size : 200;
|
|
18
|
+
const label = typeof block.props.label === 'string' ? block.props.label : '';
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<View
|
|
22
|
+
style={[styles.card, resolveViewStyleProps(block.props.style as Record<string, unknown>)]}
|
|
23
|
+
>
|
|
24
|
+
<QRCode
|
|
25
|
+
value={value}
|
|
26
|
+
size={size}
|
|
27
|
+
color={m3Colors.inverseOnSurface}
|
|
28
|
+
backgroundColor={m3Colors.inverseSurface}
|
|
29
|
+
/>
|
|
30
|
+
{label ? <Text style={styles.label}>{label}</Text> : null}
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
card: {
|
|
37
|
+
alignSelf: 'center',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
gap: spacing.lg,
|
|
40
|
+
backgroundColor: m3Colors.inverseSurface,
|
|
41
|
+
borderRadius: m3Shape.cornerExtraLarge,
|
|
42
|
+
paddingVertical: spacing.xl,
|
|
43
|
+
paddingHorizontal: spacing.xl,
|
|
44
|
+
},
|
|
45
|
+
label: {
|
|
46
|
+
...m3Type.title,
|
|
47
|
+
color: m3Colors.inverseOnSurface,
|
|
48
|
+
letterSpacing: 2,
|
|
49
|
+
textTransform: 'uppercase',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
SduiSegmentedTabsBlock,
|
|
42
42
|
} from './blocks/SduiInboxBlocks';
|
|
43
43
|
import { SduiNativeAdBlock } from './blocks/SduiNativeAdBlock';
|
|
44
|
+
import { SduiQrCodeBlock } from './blocks/SduiQrCodeBlock';
|
|
44
45
|
import {
|
|
45
46
|
SduiAlbumDetailBlock,
|
|
46
47
|
SduiAlbumGridBlock,
|
|
@@ -76,6 +77,7 @@ const REGISTRY: Record<string, SduiBlockComponent> = {
|
|
|
76
77
|
scroll: SduiScrollBlock,
|
|
77
78
|
button: SduiButtonBlock,
|
|
78
79
|
icon: SduiIconBlock,
|
|
80
|
+
qr_code: SduiQrCodeBlock,
|
|
79
81
|
spacer: SduiSpacerBlock,
|
|
80
82
|
info_banner: SduiInfoBannerBlock,
|
|
81
83
|
native_ad: SduiNativeAdBlock,
|