@proulr/sdui-components 0.1.35 → 0.1.37
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.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/renderer/index.ts",
|
|
6
6
|
"types": "./src/renderer/index.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@proulr/sdui-contract": "^0.1.
|
|
40
|
+
"@proulr/sdui-contract": "^0.1.10"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"expo-blur": ">=15",
|
|
@@ -49,6 +49,16 @@ type ButtonProps = LayoutProps & {
|
|
|
49
49
|
|
|
50
50
|
export const Button: BdcComponent = (props) => layoutBlock('button', props as ButtonProps);
|
|
51
51
|
|
|
52
|
+
type IconProps = LayoutProps & {
|
|
53
|
+
/** AppIconName kebab-case (catalog) — ex.: 'gift', 'share'. */
|
|
54
|
+
name: string;
|
|
55
|
+
size?: number;
|
|
56
|
+
/** ColorToken do tema M3 — ex.: 'primary', 'onSurfaceVariant'. */
|
|
57
|
+
color?: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const Icon: BdcComponent = (props) => layoutBlock('icon', props as IconProps);
|
|
61
|
+
|
|
52
62
|
type InfoBannerProps = LayoutProps & {
|
|
53
63
|
message: string;
|
|
54
64
|
};
|
package/src/bdc/index.ts
CHANGED
|
@@ -2,7 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { Platform, ScrollView, StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
import type { SduiBlock } from '@proulr/sdui-contract';
|
|
4
4
|
import { AppButton } from '../ui/AppButton';
|
|
5
|
-
import {
|
|
5
|
+
import { AppIcon, isAppIconName } from '../ui/app-icon';
|
|
6
|
+
import { colors, m3Colors, m3Type, spacing } from '../theme/proulr-theme';
|
|
6
7
|
import {
|
|
7
8
|
resolveGapProp,
|
|
8
9
|
resolvePaddingProp,
|
|
@@ -135,6 +136,27 @@ export function SduiButtonBlock({ block, onAction }: SduiBlockRenderProps) {
|
|
|
135
136
|
);
|
|
136
137
|
}
|
|
137
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Bloco genérico de ícone vetorial (AppIcon). Wire: `name` = AppIconName
|
|
141
|
+
* kebab-case, `size` em px, `color` = ColorToken do tema. O container aceita
|
|
142
|
+
* StyleWire (background, borda, padding) para composições tipo hero circle.
|
|
143
|
+
*/
|
|
144
|
+
export function SduiIconBlock({ block }: SduiBlockRenderProps) {
|
|
145
|
+
const name = typeof block.props.name === 'string' ? block.props.name : '';
|
|
146
|
+
if (!isAppIconName(name)) return null;
|
|
147
|
+
|
|
148
|
+
const size = typeof block.props.size === 'number' ? block.props.size : spacing.lg;
|
|
149
|
+
const colorToken = typeof block.props.color === 'string' ? block.props.color : undefined;
|
|
150
|
+
const color =
|
|
151
|
+
(colorToken ? m3Colors[colorToken as keyof typeof m3Colors] : undefined) ?? colors.onSurface;
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<View style={resolveViewStyleProps(block.props.style as Record<string, unknown>)}>
|
|
155
|
+
<AppIcon name={name} size={size} color={color} />
|
|
156
|
+
</View>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
138
160
|
export function SduiSpacerBlock({ block }: SduiBlockRenderProps) {
|
|
139
161
|
const height = typeof block.props.height === 'number' ? block.props.height : spacing.md;
|
|
140
162
|
return <View style={{ height }} />;
|
|
@@ -3,6 +3,7 @@ import type { SduiBlock } from '@proulr/sdui-contract';
|
|
|
3
3
|
import {
|
|
4
4
|
SduiButtonBlock,
|
|
5
5
|
SduiColumnBlock,
|
|
6
|
+
SduiIconBlock,
|
|
6
7
|
SduiInfoBannerBlock,
|
|
7
8
|
SduiRowBlock,
|
|
8
9
|
SduiScrollBlock,
|
|
@@ -74,6 +75,7 @@ const REGISTRY: Record<string, SduiBlockComponent> = {
|
|
|
74
75
|
row: SduiRowBlock,
|
|
75
76
|
scroll: SduiScrollBlock,
|
|
76
77
|
button: SduiButtonBlock,
|
|
78
|
+
icon: SduiIconBlock,
|
|
77
79
|
spacer: SduiSpacerBlock,
|
|
78
80
|
info_banner: SduiInfoBannerBlock,
|
|
79
81
|
native_ad: SduiNativeAdBlock,
|