@unif/react-native-chat 4.3.3 → 4.4.0

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.
Files changed (62) hide show
  1. package/lib/module/components/Attachments/AttachmentItem.js +6 -1
  2. package/lib/module/components/Attachments/AttachmentItem.js.map +1 -1
  3. package/lib/module/components/Attachments/styles.js +5 -4
  4. package/lib/module/components/Attachments/styles.js.map +1 -1
  5. package/lib/module/components/Confirmation/Confirmation.js +4 -2
  6. package/lib/module/components/Confirmation/Confirmation.js.map +1 -1
  7. package/lib/module/components/Confirmation/styles.js +4 -2
  8. package/lib/module/components/Confirmation/styles.js.map +1 -1
  9. package/lib/module/components/Feedback/Feedback.js +8 -6
  10. package/lib/module/components/Feedback/Feedback.js.map +1 -1
  11. package/lib/module/components/Feedback/styles.js +3 -0
  12. package/lib/module/components/Feedback/styles.js.map +1 -1
  13. package/lib/module/components/Message/MarkdownContent/styles.js +1 -1
  14. package/lib/module/components/Message/MarkdownContent/styles.js.map +1 -1
  15. package/lib/module/components/Message/Message.js +6 -4
  16. package/lib/module/components/Message/Message.js.map +1 -1
  17. package/lib/module/components/Message/styles.js +7 -2
  18. package/lib/module/components/Message/styles.js.map +1 -1
  19. package/lib/module/components/Process/Process.js +4 -2
  20. package/lib/module/components/Process/Process.js.map +1 -1
  21. package/lib/module/components/Process/styles.js +8 -5
  22. package/lib/module/components/Process/styles.js.map +1 -1
  23. package/lib/module/components/ProcessingProgress/styles.js +2 -2
  24. package/lib/module/components/ProcessingProgress/styles.js.map +1 -1
  25. package/lib/module/components/Sources/Sources.js +30 -23
  26. package/lib/module/components/Sources/Sources.js.map +1 -1
  27. package/lib/module/components/Sources/styles.js +8 -10
  28. package/lib/module/components/Sources/styles.js.map +1 -1
  29. package/lib/typescript/src/components/Attachments/AttachmentItem.d.ts.map +1 -1
  30. package/lib/typescript/src/components/Attachments/styles.d.ts +3 -2
  31. package/lib/typescript/src/components/Attachments/styles.d.ts.map +1 -1
  32. package/lib/typescript/src/components/Confirmation/Confirmation.d.ts.map +1 -1
  33. package/lib/typescript/src/components/Confirmation/styles.d.ts +3 -1
  34. package/lib/typescript/src/components/Confirmation/styles.d.ts.map +1 -1
  35. package/lib/typescript/src/components/Feedback/Feedback.d.ts.map +1 -1
  36. package/lib/typescript/src/components/Feedback/styles.d.ts +3 -0
  37. package/lib/typescript/src/components/Feedback/styles.d.ts.map +1 -1
  38. package/lib/typescript/src/components/Message/MarkdownContent/styles.d.ts +2 -2
  39. package/lib/typescript/src/components/Message/Message.d.ts.map +1 -1
  40. package/lib/typescript/src/components/Message/styles.d.ts +6 -1
  41. package/lib/typescript/src/components/Message/styles.d.ts.map +1 -1
  42. package/lib/typescript/src/components/Process/Process.d.ts.map +1 -1
  43. package/lib/typescript/src/components/Process/styles.d.ts +6 -3
  44. package/lib/typescript/src/components/Process/styles.d.ts.map +1 -1
  45. package/lib/typescript/src/components/Sources/Sources.d.ts.map +1 -1
  46. package/lib/typescript/src/components/Sources/styles.d.ts +6 -8
  47. package/lib/typescript/src/components/Sources/styles.d.ts.map +1 -1
  48. package/package.json +3 -3
  49. package/src/components/Attachments/AttachmentItem.tsx +4 -0
  50. package/src/components/Attachments/styles.ts +1 -2
  51. package/src/components/Confirmation/Confirmation.tsx +2 -0
  52. package/src/components/Confirmation/styles.ts +1 -1
  53. package/src/components/Feedback/Feedback.tsx +8 -9
  54. package/src/components/Feedback/styles.ts +1 -0
  55. package/src/components/Message/MarkdownContent/styles.ts +1 -1
  56. package/src/components/Message/Message.tsx +12 -2
  57. package/src/components/Message/styles.ts +2 -1
  58. package/src/components/Process/Process.tsx +8 -0
  59. package/src/components/Process/styles.ts +2 -3
  60. package/src/components/ProcessingProgress/styles.ts +2 -2
  61. package/src/components/Sources/Sources.tsx +35 -20
  62. package/src/components/Sources/styles.ts +6 -17
@@ -2,6 +2,7 @@ import { AlertOutlined } from '@unif/react-native-icons';
2
2
  import { Pressable, Text, View } from 'react-native';
3
3
  import {
4
4
  Button,
5
+ GlassLayer,
5
6
  IconButton,
6
7
  useThemedStyles,
7
8
  useColors,
@@ -59,6 +60,15 @@ export function Message(props: MessageProps) {
59
60
  ];
60
61
  const content = (
61
62
  <>
63
+ {surface === 'outlined' ||
64
+ (surface === 'bubble' && placement === 'start') ? (
65
+ <GlassLayer
66
+ style={[
67
+ styles.material,
68
+ waiting && surface === 'bubble' && styles.waitingMaterial,
69
+ ]}
70
+ />
71
+ ) : null}
62
72
  {header}
63
73
  {props.text !== undefined ? (
64
74
  props.format === 'markdown' ? (
@@ -145,7 +155,7 @@ export function Message(props: MessageProps) {
145
155
  <IconButton
146
156
  icon={AlertOutlined}
147
157
  size="sm"
148
- variant="ghost"
158
+ variant="glass"
149
159
  color={colors.error}
150
160
  style={styles.failureAction}
151
161
  accessibilityLabel={failedAction.label}
@@ -166,7 +176,7 @@ export function Message(props: MessageProps) {
166
176
  key={action.id}
167
177
  icon={action.icon}
168
178
  size="sm"
169
- variant="ghost"
179
+ variant="glass"
170
180
  color={colors.foregroundSubtle}
171
181
  accessibilityLabel={action.label}
172
182
  accessibilityHint={action.accessibilityHint}
@@ -24,8 +24,9 @@ export const createStyles = (colors: ColorTokens) =>
24
24
  paddingHorizontal: space[5],
25
25
  paddingVertical: space[4],
26
26
  borderRadius: radius['2xl'],
27
- backgroundColor: colors.surface,
28
27
  },
28
+ material: { borderRadius: radius['2xl'] },
29
+ waitingMaterial: { borderTopLeftRadius: 0 },
29
30
  outgoing: { backgroundColor: colors.primary },
30
31
  outgoingText: { color: colors.onPrimary },
31
32
  outlined: {
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react';
2
2
  import { Text, View } from 'react-native';
3
3
  import {
4
4
  Button,
5
+ GlassLayer,
5
6
  r,
6
7
  useColors,
7
8
  useThemedStyles,
@@ -95,6 +96,13 @@ export function Process(props: ProcessProps): React.JSX.Element {
95
96
  ]}
96
97
  testID={testID}
97
98
  >
99
+ {variant === 'card' || variant === 'timeline' ? (
100
+ <GlassLayer
101
+ style={
102
+ variant === 'timeline' ? styles.timelineMaterial : styles.material
103
+ }
104
+ />
105
+ ) : null}
98
106
  {title || (identity && !inlineIdentity) ? (
99
107
  <View style={styles.heading}>
100
108
  {!inlineIdentity ? identity : null}
@@ -54,8 +54,9 @@ export const createStyles = (colors: ColorTokens) =>
54
54
  paddingHorizontal: space[5],
55
55
  paddingVertical: space[4],
56
56
  },
57
+ timelineMaterial: { borderRadius: radius.lg },
58
+ material: { borderRadius: radius.xl },
57
59
  timelineRoot: {
58
- backgroundColor: colors.surface,
59
60
  borderRadius: radius.lg,
60
61
  padding: space[5],
61
62
  },
@@ -134,7 +135,6 @@ export const createStyles = (colors: ColorTokens) =>
134
135
  borderRadius: radius.xl,
135
136
  borderWidth: 1,
136
137
  borderColor: colors.outline,
137
- backgroundColor: colors.surface,
138
138
  },
139
139
  heading: {
140
140
  flexDirection: 'row',
@@ -191,7 +191,6 @@ export const createStyles = (colors: ColorTokens) =>
191
191
  details: {
192
192
  padding: space[4],
193
193
  borderRadius: radius.md,
194
- backgroundColor: colors.surfaceContainer,
195
194
  },
196
195
  actions: {
197
196
  flexDirection: 'row',
@@ -1,5 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
- import { r, space, type } from '@unif/react-native-design';
2
+ import { leading, space, type } from '@unif/react-native-design';
3
3
  import type { ColorTokens } from '@unif/react-native-design';
4
4
 
5
5
  export const createStyles = (colors: ColorTokens) =>
@@ -12,6 +12,6 @@ export const createStyles = (colors: ColorTokens) =>
12
12
  text: {
13
13
  color: colors.foregroundMuted,
14
14
  fontSize: type.xs,
15
- lineHeight: r(20),
15
+ lineHeight: leading.sm,
16
16
  },
17
17
  });
@@ -1,6 +1,12 @@
1
1
  import { ChevronRightOutlined } from '@unif/react-native-icons';
2
2
  import { Pressable, Text, View } from 'react-native';
3
- import { r, useColors, useThemedStyles } from '@unif/react-native-design';
3
+ import {
4
+ GlassLayer,
5
+ pressedOpacity,
6
+ r,
7
+ useColors,
8
+ useThemedStyles,
9
+ } from '@unif/react-native-design';
4
10
  import { DEFAULT_SOURCES_TITLE } from './constants';
5
11
  import { createStyles } from './styles';
6
12
  import type { SourceItem, SourcesProps } from './types';
@@ -17,20 +23,27 @@ export function Sources({
17
23
 
18
24
  if (items.length === 0) return null;
19
25
 
20
- const renderItem = (item: SourceItem, showChevron: boolean) => (
26
+ const renderItem = (
27
+ item: SourceItem,
28
+ showChevron: boolean,
29
+ opacity: number
30
+ ) => (
21
31
  <>
22
- <Text style={styles.label} testID={`source-label-${item.id}`}>
23
- {item.label}
24
- </Text>
25
- <View style={styles.content}>
26
- {item.title ? <Text style={styles.title}>{item.title}</Text> : null}
27
- {item.description ? (
28
- <Text style={styles.description}>{item.description}</Text>
32
+ <GlassLayer style={styles.material} />
33
+ <View style={[styles.itemContent, { opacity }]}>
34
+ <Text style={styles.label} testID={`source-label-${item.id}`}>
35
+ {item.label}
36
+ </Text>
37
+ <View style={styles.content}>
38
+ {item.title ? <Text style={styles.title}>{item.title}</Text> : null}
39
+ {item.description ? (
40
+ <Text style={styles.description}>{item.description}</Text>
41
+ ) : null}
42
+ </View>
43
+ {showChevron ? (
44
+ <ChevronRightOutlined size={r(18)} color={colors.foregroundMuted} />
29
45
  ) : null}
30
46
  </View>
31
- {showChevron ? (
32
- <ChevronRightOutlined size={r(18)} color={colors.foregroundMuted} />
33
- ) : null}
34
47
  </>
35
48
  );
36
49
 
@@ -42,11 +55,7 @@ export function Sources({
42
55
  onPress ? (
43
56
  <Pressable
44
57
  key={item.id}
45
- style={({ pressed }) => [
46
- styles.item,
47
- pressed && styles.pressed,
48
- item.disabled && styles.disabled,
49
- ]}
58
+ style={styles.item}
50
59
  onPress={item.disabled ? undefined : () => onPress(item)}
51
60
  disabled={item.disabled}
52
61
  accessibilityRole="button"
@@ -56,15 +65,21 @@ export function Sources({
56
65
  accessibilityState={{ disabled: item.disabled === true }}
57
66
  testID={`source-${item.id}`}
58
67
  >
59
- {renderItem(item, true)}
68
+ {({ pressed }) =>
69
+ renderItem(
70
+ item,
71
+ true,
72
+ item.disabled ? 0.5 : pressed ? pressedOpacity : 1
73
+ )
74
+ }
60
75
  </Pressable>
61
76
  ) : (
62
77
  <View
63
78
  key={item.id}
64
- style={[styles.item, item.disabled && styles.disabled]}
79
+ style={styles.item}
65
80
  testID={`source-${item.id}`}
66
81
  >
67
- {renderItem(item, false)}
82
+ {renderItem(item, false, item.disabled ? 0.5 : 1)}
68
83
  </View>
69
84
  )
70
85
  )}
@@ -1,12 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
- import {
3
- fixed,
4
- fw,
5
- pressedOpacity,
6
- radius,
7
- space,
8
- type,
9
- } from '@unif/react-native-design';
2
+ import { fixed, fw, radius, space, type } from '@unif/react-native-design';
10
3
  import type { ColorTokens } from '@unif/react-native-design';
11
4
 
12
5
  export const createStyles = (colors: ColorTokens) =>
@@ -24,18 +17,14 @@ export const createStyles = (colors: ColorTokens) =>
24
17
  },
25
18
  item: {
26
19
  minHeight: fixed.hitTarget,
27
- flexDirection: 'row',
28
- alignItems: 'flex-start',
29
- gap: space[3],
30
20
  padding: space[3],
31
21
  borderRadius: radius.md,
32
- backgroundColor: colors.surfaceContainer,
33
- },
34
- pressed: {
35
- opacity: pressedOpacity,
36
22
  },
37
- disabled: {
38
- opacity: 0.5,
23
+ material: { borderRadius: radius.md },
24
+ itemContent: {
25
+ flexDirection: 'row',
26
+ alignItems: 'flex-start',
27
+ gap: space[3],
39
28
  },
40
29
  label: {
41
30
  minWidth: space[7],