@proulr/sdui-components 0.1.18 → 0.1.19

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.18",
3
+ "version": "0.1.19",
4
4
  "main": "./src/renderer/index.ts",
5
5
  "types": "./src/renderer/index.ts",
6
6
  "exports": {
@@ -9,7 +9,8 @@
9
9
  "./renderer": "./src/renderer/index.ts",
10
10
  "./ui": "./src/renderer/ui/index.ts",
11
11
  "./primitives": "./src/renderer/ui/primitives.ts",
12
- "./theme": "./src/renderer/theme/index.ts"
12
+ "./theme": "./src/renderer/theme/index.ts",
13
+ "./catalog": "./src/catalog/index.ts"
13
14
  },
14
15
  "files": [
15
16
  "src"
@@ -0,0 +1,84 @@
1
+ /** AppIconName tokens — fonte sem React Native (BFF + app + registry). */
2
+ export const APP_ICON_NAMES = [
3
+ 'search',
4
+ 'hunt',
5
+ 'back',
6
+ 'overflow',
7
+ 'location',
8
+ 'mic',
9
+ 'send',
10
+ 'chat',
11
+ 'close',
12
+ 'chevron-down',
13
+ 'chevron-right',
14
+ 'flip-camera',
15
+ 'flash',
16
+ 'gallery',
17
+ 'video',
18
+ 'camera',
19
+ 'trash',
20
+ 'globe',
21
+ 'tab-discover',
22
+ 'tab-vibes',
23
+ 'tab-flash',
24
+ 'tab-chat',
25
+ 'boost',
26
+ 'fire',
27
+ 'settings',
28
+ 'edit',
29
+ 'incognito',
30
+ 'events',
31
+ 'shield',
32
+ 'profile',
33
+ 'bookmark',
34
+ 'list',
35
+ 'communities',
36
+ 'star',
37
+ 'sign-out',
38
+ 'publish',
39
+ 'story',
40
+ 'story-music',
41
+ 'story-sticker',
42
+ 'story-text',
43
+ 'story-effects',
44
+ 'story-mention',
45
+ 'repost',
46
+ 'heart',
47
+ 'heart-filled',
48
+ 'thumbs-up',
49
+ 'thumbs-up-filled',
50
+ 'play',
51
+ 'pause',
52
+ 'plus',
53
+ 'followers',
54
+ 'mention',
55
+ 'visibility',
56
+ 'visibility-off',
57
+ 'check',
58
+ 'arrow-right',
59
+ 'arrow-up-right',
60
+ 'arrow-down-right',
61
+ 'reply',
62
+ 'pending',
63
+ 'download',
64
+ 'radio-unchecked',
65
+ 'copy',
66
+ 'attachment',
67
+ 'poll',
68
+ 'lock',
69
+ 'volume-on',
70
+ 'volume-off',
71
+ 'info',
72
+ 'warning',
73
+ 'signal',
74
+ 'hourglass',
75
+ 'bell',
76
+ ] as const;
77
+
78
+ export type AppIconName = (typeof APP_ICON_NAMES)[number];
79
+
80
+ const APP_ICON_NAME_SET: ReadonlySet<string> = new Set(APP_ICON_NAMES);
81
+
82
+ export function isAppIconName(value: string): value is AppIconName {
83
+ return APP_ICON_NAME_SET.has(value);
84
+ }
@@ -0,0 +1,115 @@
1
+ export type EmojiCategoryId = 'spicy' | 'smileys' | 'gestures' | 'hearts' | 'animals' | 'food' | 'objects' | 'symbols';
2
+
3
+ export type EmojiCategory = {
4
+ id: EmojiCategoryId;
5
+ label: string;
6
+ tab: string;
7
+ emojis: readonly string[];
8
+ };
9
+
10
+ /** Pilula padrao quando ainda nao ha historico de uso. */
11
+ export const DEFAULT_QUICK_REACTIONS = ['👍', '🔥', '🍆', '💦', '❤️', '😂'] as const;
12
+
13
+ export const QUICK_REACTION_SLOTS = 6;
14
+
15
+ export const CHAT_EMOJI_CATEGORIES: EmojiCategory[] = [
16
+ {
17
+ id: 'spicy',
18
+ label: 'Safadinhos',
19
+ tab: '😈',
20
+ emojis: [
21
+ '👍', '🔥', '🍆', '💦', '👅', '🤤', '🍑', '😈', '💋', '🫦', '🥵', '😏',
22
+ '🛏️', '🫣', '👀', '💪', '🤭', '😘', '🥰', '😍', '🫠', '😮‍💨', '🍒', '🌶️',
23
+ '🥒', '🍌', '🧴', '🛁', '🚿', '🔞', '🫦', '😜', '😝', '🤫', '😳',
24
+ ],
25
+ },
26
+ {
27
+ id: 'smileys',
28
+ label: 'Rostos',
29
+ tab: '😀',
30
+ emojis: [
31
+ '😀', '😃', '😄', '😁', '😆', '😅', '🤣', '😂', '🙂', '🙃', '😉', '😊',
32
+ '😇', '🥰', '😍', '🤩', '😘', '😗', '😚', '😙', '🥲', '😋', '😛', '😜',
33
+ '🤪', '😝', '🤑', '🤗', '🤭', '🤫', '🤔', '🤐', '🤨', '😐', '😑', '😶',
34
+ '😏', '😒', '🙄', '😬', '🤥', '😌', '😔', '😪', '🤤', '😴', '😷', '🤒',
35
+ '🤕', '🤢', '🤮', '🤧', '🥵', '🥶', '🥴', '😵', '🤯', '🤠', '🥳', '🥸',
36
+ '😎', '🤓', '🧐', '😕', '😟', '🙁', '☹️', '😮', '😯', '😲', '😳', '🥺',
37
+ '😦', '😧', '😨', '😰', '😥', '😢', '😭', '😱', '😖', '😣', '😞', '😓',
38
+ '😩', '😫', '🥱', '😤', '😡', '😠', '🤬',
39
+ ],
40
+ },
41
+ {
42
+ id: 'gestures',
43
+ label: 'Gestos',
44
+ tab: '👋',
45
+ emojis: [
46
+ '👍', '👎', '👏', '🙌', '👐', '🤲', '🤝', '🙏', '✌️', '🤞', '🤟', '🤘',
47
+ '🤙', '👈', '👉', '👆', '👇', '☝️', '✋', '🤚', '🖐', '🖖', '👋', '🤏',
48
+ '✊', '👊', '🤛', '🤜', '💪', '🦾', '🖕', '✍️', '🤳', '💅',
49
+ ],
50
+ },
51
+ {
52
+ id: 'hearts',
53
+ label: 'Amor',
54
+ tab: '❤️',
55
+ emojis: [
56
+ '❤️', '🧡', '💛', '💚', '💙', '💜', '🖤', '🤍', '🤎', '💔', '❤️‍🔥', '❤️‍🩹',
57
+ '💕', '💞', '💓', '💗', '💖', '💘', '💝', '💟', '💌', '💑', '💏', '🌹',
58
+ ],
59
+ },
60
+ {
61
+ id: 'animals',
62
+ label: 'Animais',
63
+ tab: '🐶',
64
+ emojis: [
65
+ '🐶', '🐱', '🐭', '🐹', '🐰', '🦊', '🐻', '🐼', '🐨', '🐯', '🦁', '🐮',
66
+ '🐷', '🐸', '🐵', '🐔', '🐧', '🐦', '🐤', '🦄', '🐝', '🦋', '🐢', '🐍',
67
+ ],
68
+ },
69
+ {
70
+ id: 'food',
71
+ label: 'Comida',
72
+ tab: '🍕',
73
+ emojis: [
74
+ '🍕', '🍔', '🍟', '🌭', '🍿', '🧁', '🍰', '🎂', '🍩', '🍪', '🍫', '🍬',
75
+ '🍭', '🍦', '🍧', '🍨', '🍎', '🍊', '🍋', '🍉', '🍇', '🍓', '🍑', '🍒',
76
+ '🥑', '🌮', '🍣', '🍺', '🍷', '🥂', '🍾', '☕', '🧃',
77
+ ],
78
+ },
79
+ {
80
+ id: 'objects',
81
+ label: 'Coisas',
82
+ tab: '💡',
83
+ emojis: [
84
+ '⌚', '📱', '💻', '📷', '🎮', '🎧', '🎬', '🎤', '🎵', '🎶', '🎁', '🎈',
85
+ '🎉', '🎊', '🏆', '🥇', '🥈', '🥉', '⚽', '🏀', '🎾', '🚗', '✈️', '🚀',
86
+ ],
87
+ },
88
+ {
89
+ id: 'symbols',
90
+ label: 'Símbolos',
91
+ tab: '✨',
92
+ emojis: [
93
+ '🔥', '✨', '💫', '⭐', '🌟', '💥', '💯', '💢', '💦', '💨', '🕳️', '💣',
94
+ '✅', '❌', '❓', '❗', '‼️', '⁉️', '🔴', '🟠', '🟡', '🟢', '🔵', '🟣',
95
+ '⚫', '⚪', '🟤', '🔶', '🔷', '🔸', '🔹',
96
+ ],
97
+ },
98
+ ];
99
+
100
+ export function getEmojiCategory(id: EmojiCategoryId): EmojiCategory {
101
+ return CHAT_EMOJI_CATEGORIES.find((category) => category.id === id) ?? CHAT_EMOJI_CATEGORIES[0];
102
+ }
103
+
104
+ export function allCatalogEmojis(): string[] {
105
+ const seen = new Set<string>();
106
+ const result: string[] = [];
107
+ for (const category of CHAT_EMOJI_CATEGORIES) {
108
+ for (const emoji of category.emojis) {
109
+ if (seen.has(emoji)) continue;
110
+ seen.add(emoji);
111
+ result.push(emoji);
112
+ }
113
+ }
114
+ return result;
115
+ }
@@ -0,0 +1,46 @@
1
+ export const FLASH_REACTION_IDS = ['flash', 'fire', 'heart', 'eyes', 'wave', 'chat'] as const;
2
+
3
+ export type FlashReactionId = (typeof FLASH_REACTION_IDS)[number];
4
+
5
+ export type FlashReaction = {
6
+ id: FlashReactionId;
7
+ emoji: string;
8
+ label: string;
9
+ message: string;
10
+ };
11
+
12
+ export const FLASH_REACTIONS: FlashReaction[] = [
13
+ { id: 'flash', emoji: '\u26a1', label: 'Flash', message: 'te enviou um Flash' },
14
+ { id: 'fire', emoji: '\u{1F525}', label: 'Quente', message: 'achou você quente' },
15
+ { id: 'heart', emoji: '\u{1F9E1}', label: 'Curti', message: 'curtiu você' },
16
+ { id: 'eyes', emoji: '\u{1F440}', label: 'Interesse', message: 'está de olho em você' },
17
+ { id: 'wave', emoji: '\u{1F44B}', label: 'Oi', message: 'mandou um oi' },
18
+ { id: 'chat', emoji: '\u{1F4AC}', label: 'Conversar', message: 'quer conversar' },
19
+ ];
20
+
21
+ export const FLASH_FILTER_ALL_ACTION_ID = 'flash_filter_all';
22
+
23
+ const reactionById = Object.fromEntries(FLASH_REACTIONS.map((reaction) => [reaction.id, reaction])) as Record<
24
+ FlashReactionId,
25
+ FlashReaction
26
+ >;
27
+
28
+ export function getFlashReaction(id?: string | null): FlashReaction {
29
+ if (id && id in reactionById) return reactionById[id as FlashReactionId];
30
+ return reactionById.flash;
31
+ }
32
+
33
+ export function flashFilterActionId(reactionId: FlashReactionId): string {
34
+ return `flash_filter_${reactionId}`;
35
+ }
36
+
37
+ export function parseFlashInboxFilter(value: string | undefined): 'all' | FlashReactionId {
38
+ if (value && FLASH_REACTION_IDS.includes(value as FlashReactionId)) {
39
+ return value as FlashReactionId;
40
+ }
41
+ return 'all';
42
+ }
43
+
44
+ export function isFlashReactionId(value: string): value is FlashReactionId {
45
+ return FLASH_REACTION_IDS.includes(value as FlashReactionId);
46
+ }
@@ -0,0 +1,5 @@
1
+ export * from './block-types';
2
+ export * from './style-tokens';
3
+ export * from './chat-emoji-catalog';
4
+ export * from './flash-reaction-catalog';
5
+ export * from './app-icon-names';
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { Pressable, StyleSheet, Switch, Text, View } from 'react-native';
3
3
  import type { SduiBlock } from '@proulr/sdui-contract';
4
4
  import { Card } from '../ui/Card';
5
+ import { AppIcon } from '../ui/app-icon';
5
6
  import { colors, fonts, m3Colors, m3Type, spacing } from '../theme/proulr-theme';
6
7
  import {
7
8
  resolveDataRefBoolean,
@@ -69,7 +70,7 @@ export function SduiListItemBlock({ block, data, onAction }: SduiBlockRenderProp
69
70
  </Text>
70
71
  ) : null}
71
72
  </View>
72
- {navChevron ? <Text style={styles.chevron}>{'\u203a'}</Text> : null}
73
+ {navChevron ? <AppIcon name="chevron-right" size={22} color={m3Colors.onSurfaceVariant} /> : null}
73
74
  {trailingText ? <Text style={styles.trailingText}>{trailingText}</Text> : null}
74
75
  </>
75
76
  );
@@ -152,7 +153,6 @@ const styles = StyleSheet.create({
152
153
  listTitle: { color: colors.textPrimary, fontSize: 15, fontFamily: fonts.semibold },
153
154
  listSubtitle: { color: colors.textSecondary, fontSize: 13, marginTop: 2 },
154
155
  trailingText: { ...m3Type.bodySmall, color: colors.textSecondary },
155
- chevron: { color: m3Colors.onSurfaceVariant, fontSize: 22 },
156
156
  toggleRow: {
157
157
  flexDirection: 'row',
158
158
  alignItems: 'center',
@@ -10,6 +10,7 @@ import {
10
10
  type ViewStyle,
11
11
  } from 'react-native';
12
12
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
13
+ import { AppIcon } from './app-icon';
13
14
  import { colors, fonts, m3Colors, m3Type, spacing } from '../theme/proulr-theme';
14
15
 
15
16
  type AuthStepShellProps = {
@@ -46,7 +47,7 @@ export function AuthStepShell({
46
47
  onPress={onBack}
47
48
  style={({ pressed }) => [styles.backBtn, pressed && styles.pressed]}
48
49
  >
49
- <Text style={styles.backGlyph}>{'\u2039'}</Text>
50
+ <AppIcon name="back" size={24} color={m3Colors.onSurface} />
50
51
  <Text style={styles.backLabel}>{backLabel}</Text>
51
52
  </Pressable>
52
53
  ) : null}
@@ -90,12 +91,6 @@ const styles = StyleSheet.create({
90
91
  marginBottom: spacing.md,
91
92
  paddingVertical: spacing.xs,
92
93
  },
93
- backGlyph: {
94
- color: m3Colors.onSurface,
95
- fontSize: 24,
96
- fontFamily: fonts.bold,
97
- marginTop: -2,
98
- },
99
94
  backLabel: {
100
95
  color: colors.textMuted,
101
96
  fontSize: 14,
@@ -4,7 +4,7 @@ import { colors, fonts, radius, spacing } from '../theme/proulr-theme';
4
4
 
5
5
  export function InfoBanner({
6
6
  message,
7
- icon = 'ℹ',
7
+ icon,
8
8
  appIcon,
9
9
  onDismiss,
10
10
  }: {
@@ -13,11 +13,13 @@ export function InfoBanner({
13
13
  appIcon?: AppIconName;
14
14
  onDismiss?: () => void;
15
15
  }) {
16
+ const resolvedAppIcon: AppIconName | undefined = appIcon ?? (icon ? undefined : 'info');
17
+
16
18
  return (
17
19
  <View style={styles.infoBanner}>
18
20
  <View style={styles.infoIconWrap}>
19
- {appIcon ? (
20
- <AppIcon name={appIcon} size={APP_ICON_SIZE.banner} color={colors.accentText} />
21
+ {resolvedAppIcon ? (
22
+ <AppIcon name={resolvedAppIcon} size={APP_ICON_SIZE.banner} color={colors.accentText} />
21
23
  ) : (
22
24
  <Text style={styles.infoIcon}>{icon}</Text>
23
25
  )}
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import { Pressable, StyleSheet, Text, View } from 'react-native';
3
+ import { AppIcon } from './app-icon';
3
4
  import { colors, fonts, m3Colors, spacing } from '../theme/proulr-theme';
4
5
 
5
6
  export function ListItem({
@@ -34,7 +35,7 @@ export function ListItem({
34
35
  </Text>
35
36
  ) : null}
36
37
  </View>
37
- {navChevron ? <Text style={styles.chevron}>{'\u203a'}</Text> : null}
38
+ {navChevron ? <AppIcon name="chevron-right" size={22} color={m3Colors.onSurfaceVariant} /> : null}
38
39
  {trailing ? <View style={styles.listTrailing}>{trailing}</View> : null}
39
40
  </>
40
41
  );
@@ -65,5 +66,4 @@ const styles = StyleSheet.create({
65
66
  listTitle: { color: colors.textPrimary, fontSize: 15, fontFamily: fonts.semibold },
66
67
  listSubtitle: { color: colors.textSecondary, fontSize: 13, marginTop: 2 },
67
68
  listTrailing: { alignItems: 'flex-end' },
68
- chevron: { color: m3Colors.onSurfaceVariant, fontSize: 22 },
69
69
  });
@@ -1,6 +1,7 @@
1
1
  import { useState } from 'react';
2
2
  import { Modal, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
3
3
  import { AppButton } from './AppButton';
4
+ import { AppIcon } from './app-icon';
4
5
  import { colors, fonts, radius, spacing } from '../theme/proulr-theme';
5
6
 
6
7
  function OptionModal({
@@ -31,7 +32,7 @@ function OptionModal({
31
32
  return (
32
33
  <Pressable key={opt} style={styles.optionRow} onPress={() => onSelect(opt)}>
33
34
  <Text style={{ color: isSel ? colors.accentText : colors.white, fontSize: 16 }}>{opt}</Text>
34
- {isSel ? <Text style={{ color: colors.accent, fontSize: 16 }}>{'\u2713'}</Text> : null}
35
+ {isSel ? <AppIcon name="check" size={16} color={colors.accent} /> : null}
35
36
  </Pressable>
36
37
  );
37
38
  })}
@@ -66,7 +67,7 @@ export function SelectRow({
66
67
  <Text style={styles.selectValue} numberOfLines={1}>
67
68
  {value || 'Selecionar'}
68
69
  </Text>
69
- <Text style={styles.chevron}>{'\u203a'}</Text>
70
+ <AppIcon name="chevron-right" size={18} color={colors.textSecondary} />
70
71
  </Pressable>
71
72
  <OptionModal
72
73
  title={label}
@@ -102,7 +103,7 @@ export function MultiSelectRow({
102
103
  <Text style={styles.selectValue} numberOfLines={1}>
103
104
  {values.length ? values.join(', ') : 'Selecionar'}
104
105
  </Text>
105
- <Text style={styles.chevron}>{'\u203a'}</Text>
106
+ <AppIcon name="chevron-right" size={18} color={colors.textSecondary} />
106
107
  </Pressable>
107
108
  <OptionModal
108
109
  title={label}
@@ -134,7 +135,6 @@ const styles = StyleSheet.create({
134
135
  },
135
136
  selectLabel: { flex: 1, color: colors.white, fontSize: 15, fontFamily: fonts.medium },
136
137
  selectValue: { color: colors.textSecondary, fontSize: 14, maxWidth: 160 },
137
- chevron: { color: colors.textSecondary, fontSize: 18 },
138
138
  modalBackdrop: { flex: 1, backgroundColor: colors.overlay, justifyContent: 'flex-end' },
139
139
  modalSheet: {
140
140
  backgroundColor: colors.surface,