@proulr/sdui-components 0.1.69 → 0.1.70

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.69",
3
+ "version": "0.1.70",
4
4
  "type": "module",
5
5
  "main": "./src/renderer/index.ts",
6
6
  "types": "./src/renderer/index.ts",
@@ -282,11 +282,11 @@ export function SduiChipBlock({ block, onAction }: SduiBlockRenderProps) {
282
282
  const active = readBooleanProp(block, 'active');
283
283
  const variant = readStringProp(block, 'variant') ?? 'default';
284
284
  const isHeader = variant === 'on_header';
285
- const displayLabel = glyph ? `${glyph} ${label}` : label;
286
285
 
287
286
  return (
288
287
  <Chip
289
- label={displayLabel}
288
+ label={label}
289
+ icon={glyph}
290
290
  active={active}
291
291
  disabled={!actionId}
292
292
  variant={isHeader ? 'onHeader' : 'default'}
@@ -1,5 +1,6 @@
1
1
  import { Pressable, StyleSheet, Text } from 'react-native';
2
2
  import { colors, fonts, m3Colors, m3Shape, spacing } from '../theme/proulr-theme';
3
+ import { AppIcon, isAppIconName } from './app-icon';
3
4
 
4
5
  export function Chip({
5
6
  label,
@@ -7,12 +8,14 @@ export function Chip({
7
8
  onPress,
8
9
  variant = 'default',
9
10
  disabled,
11
+ icon,
10
12
  }: {
11
13
  label: string;
12
14
  active?: boolean;
13
15
  onPress?: () => void;
14
16
  variant?: 'default' | 'onHeader';
15
17
  disabled?: boolean;
18
+ icon?: string;
16
19
  }) {
17
20
  const isHeader = variant === 'onHeader';
18
21
 
@@ -32,12 +35,15 @@ export function Chip({
32
35
  ? colors.textOnAccent
33
36
  : m3Colors.onSurfaceVariant;
34
37
 
38
+ const iconName = icon && isAppIconName(icon) ? icon : null;
39
+
35
40
  return (
36
41
  <Pressable
37
42
  onPress={onPress}
38
43
  disabled={disabled}
39
44
  style={[styles.chip, isHeader && styles.chipOnHeader, containerStyle]}
40
45
  >
46
+ {iconName ? <AppIcon name={iconName} size={isHeader ? 14 : 15} color={textColor} /> : null}
41
47
  <Text
42
48
  style={{
43
49
  color: textColor,
@@ -53,6 +59,9 @@ export function Chip({
53
59
 
54
60
  const styles = StyleSheet.create({
55
61
  chip: {
62
+ flexDirection: 'row',
63
+ alignItems: 'center',
64
+ gap: spacing.xs,
56
65
  paddingHorizontal: spacing.sm,
57
66
  paddingVertical: spacing.sm,
58
67
  borderRadius: m3Shape.cornerSmall,