@proulr/sdui-components 0.1.37 → 0.1.40

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.37",
3
+ "version": "0.1.40",
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
@@ -7,6 +7,7 @@ export {
7
7
  InfoBanner,
8
8
  ListItem,
9
9
  NativeAd,
10
+ QrCode,
10
11
  Row,
11
12
  Screen,
12
13
  Scroll,
@@ -40,3 +40,8 @@ export {
40
40
  isAppIconName,
41
41
  type AppIconName,
42
42
  } from './app-icon-names';
43
+ export {
44
+ STORY_TEXT_BACKGROUND_OPTIONS,
45
+ resolveStoryTextBackgroundOption,
46
+ type StoryTextBackgroundOption,
47
+ } from './story-text-background-catalog';
@@ -0,0 +1,28 @@
1
+ export type StoryTextBackgroundOption = {
2
+ id: string;
3
+ backgroundColor: string;
4
+ textColor: string;
5
+ };
6
+
7
+ /** Fundos do composer de story em texto — fonte única de cores (sem hex nos apps). */
8
+ export const STORY_TEXT_BACKGROUND_OPTIONS: StoryTextBackgroundOption[] = [
9
+ { id: 'fuchsia', backgroundColor: '#D946EF', textColor: '#FFFFFF' },
10
+ { id: 'cyan', backgroundColor: '#00E5FF', textColor: '#001018' },
11
+ { id: 'rose', backgroundColor: '#FF2D55', textColor: '#FFFFFF' },
12
+ { id: 'violet', backgroundColor: '#7C3AED', textColor: '#FFFFFF' },
13
+ { id: 'amber', backgroundColor: '#F59E0B', textColor: '#1A1200' },
14
+ { id: 'lime', backgroundColor: '#84CC16', textColor: '#102000' },
15
+ { id: 'sky', backgroundColor: '#38BDF8', textColor: '#001018' },
16
+ { id: 'slate', backgroundColor: '#1E293B', textColor: '#FFFFFF' },
17
+ { id: 'black', backgroundColor: '#000000', textColor: '#FFFFFF' },
18
+ { id: 'white', backgroundColor: '#FFFFFF', textColor: '#111111' },
19
+ ];
20
+
21
+ export function resolveStoryTextBackgroundOption(
22
+ id: string,
23
+ ): StoryTextBackgroundOption {
24
+ return (
25
+ STORY_TEXT_BACKGROUND_OPTIONS.find((option) => option.id === id) ??
26
+ STORY_TEXT_BACKGROUND_OPTIONS[0]!
27
+ );
28
+ }
@@ -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,
@@ -34,6 +34,28 @@ export const m3Colors = {
34
34
  online: '#34FF88',
35
35
  } as const;
36
36
 
37
+ /** Accent/soft por reação Flash (conteúdo) — fonte única, sem hex solto nos apps. */
38
+ export const flashReactionColors = {
39
+ flash: { accent: m3Colors.secondary, soft: m3Colors.secondaryContainer },
40
+ fire: { accent: m3Colors.primary, soft: m3Colors.primaryContainer },
41
+ heart: { accent: '#FF6B8A', soft: 'rgba(255,107,138,0.22)' },
42
+ eyes: { accent: '#40C4FF', soft: 'rgba(64,196,255,0.22)' },
43
+ wave: { accent: '#FFD740', soft: 'rgba(255,215,64,0.22)' },
44
+ chat: { accent: '#B388FF', soft: 'rgba(179,136,255,0.22)' },
45
+ } as const;
46
+
47
+ /** Paleta estável para nome de remetente em grupos (estilo WhatsApp/Telegram). */
48
+ export const chatGroupSenderPalette = [
49
+ m3Colors.primary,
50
+ m3Colors.secondary,
51
+ m3Colors.tertiary,
52
+ '#7C4DFF',
53
+ '#00BFA5',
54
+ '#FF6D00',
55
+ '#FF4081',
56
+ '#40C4FF',
57
+ ] as const;
58
+
37
59
  export const m3Shape = {
38
60
  cornerExtraSmall: 4,
39
61
  cornerSmall: 8,