@planningcenter/chat-react-native 3.15.0 → 3.16.0-rc.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 (35) hide show
  1. package/build/components/conversation/message.d.ts.map +1 -1
  2. package/build/components/conversation/message.js +11 -9
  3. package/build/components/conversation/message.js.map +1 -1
  4. package/build/components/conversation/reply_connectors.d.ts +9 -0
  5. package/build/components/conversation/reply_connectors.d.ts.map +1 -0
  6. package/build/components/conversation/reply_connectors.js +147 -0
  7. package/build/components/conversation/reply_connectors.js.map +1 -0
  8. package/build/components/display/avatar.d.ts +2 -1
  9. package/build/components/display/avatar.d.ts.map +1 -1
  10. package/build/components/display/avatar.js +2 -2
  11. package/build/components/display/avatar.js.map +1 -1
  12. package/build/components/display/avatar_group.d.ts +2 -1
  13. package/build/components/display/avatar_group.d.ts.map +1 -1
  14. package/build/components/display/avatar_group.js +2 -2
  15. package/build/components/display/avatar_group.js.map +1 -1
  16. package/build/components/primitive/avatar_primitive.d.ts +1 -0
  17. package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
  18. package/build/components/primitive/avatar_primitive.js +25 -19
  19. package/build/components/primitive/avatar_primitive.js.map +1 -1
  20. package/build/screens/conversation_screen.d.ts +1 -0
  21. package/build/screens/conversation_screen.d.ts.map +1 -1
  22. package/build/screens/conversation_screen.js +1 -0
  23. package/build/screens/conversation_screen.js.map +1 -1
  24. package/build/utils/styles.d.ts +1 -0
  25. package/build/utils/styles.d.ts.map +1 -1
  26. package/build/utils/styles.js +1 -0
  27. package/build/utils/styles.js.map +1 -1
  28. package/package.json +2 -2
  29. package/src/components/conversation/message.tsx +22 -8
  30. package/src/components/conversation/reply_connectors.tsx +192 -0
  31. package/src/components/display/avatar.tsx +8 -1
  32. package/src/components/display/avatar_group.tsx +8 -1
  33. package/src/components/primitive/avatar_primitive.tsx +28 -17
  34. package/src/screens/conversation_screen.tsx +2 -0
  35. package/src/utils/styles.ts +1 -0
@@ -86,6 +86,7 @@ interface AvatarContextType {
86
86
  allImagesLoaded: boolean
87
87
  setAllImagesLoaded: React.Dispatch<React.SetStateAction<boolean>>
88
88
  maxFontSizeMultiplier: number
89
+ minFontSizeMultiplier?: number
89
90
  }
90
91
 
91
92
  const AvatarContext = createContext<AvatarContextType | null>(null)
@@ -107,6 +108,7 @@ interface AvatarRootProps {
107
108
  size?: AvatarSize
108
109
  style?: ViewProps['style']
109
110
  maxFontSizeMultiplier?: number
111
+ minFontSizeMultiplier?: number
110
112
  }
111
113
 
112
114
  function AvatarRoot({
@@ -114,13 +116,20 @@ function AvatarRoot({
114
116
  size = 'md',
115
117
  style,
116
118
  maxFontSizeMultiplier = MAX_FONT_SIZE_MULTIPLIER,
119
+ minFontSizeMultiplier = undefined,
117
120
  }: AvatarRootProps) {
118
121
  const [allImagesLoaded, setAllImagesLoaded] = useState(false)
119
- const styles = useStyles({ size, maxFontSizeMultiplier })
122
+ const styles = useStyles({ size, maxFontSizeMultiplier, minFontSizeMultiplier })
120
123
 
121
124
  return (
122
125
  <AvatarContext.Provider
123
- value={{ size, allImagesLoaded, setAllImagesLoaded, maxFontSizeMultiplier }}
126
+ value={{
127
+ size,
128
+ allImagesLoaded,
129
+ setAllImagesLoaded,
130
+ maxFontSizeMultiplier,
131
+ minFontSizeMultiplier,
132
+ }}
124
133
  >
125
134
  <View style={[styles.rootContainer, style]}>{children}</View>
126
135
  </AvatarContext.Provider>
@@ -136,8 +145,8 @@ AvatarRoot.displayName = 'Avatar.Root'
136
145
  type AvatarMaskProps = ViewProps
137
146
 
138
147
  function AvatarMask({ children, ...props }: AvatarMaskProps) {
139
- const { maxFontSizeMultiplier } = useAvatarContext()
140
- const styles = useStyles({ maxFontSizeMultiplier })
148
+ const { maxFontSizeMultiplier, minFontSizeMultiplier } = useAvatarContext()
149
+ const styles = useStyles({ maxFontSizeMultiplier, minFontSizeMultiplier })
141
150
 
142
151
  return (
143
152
  <View style={styles.mask} {...props}>
@@ -157,8 +166,8 @@ interface AvatarImageProps extends Omit<ImageProps, 'source' | 'alt'> {
157
166
  }
158
167
 
159
168
  function AvatarImage({ sourceUri, ...props }: AvatarImageProps) {
160
- const { size, maxFontSizeMultiplier } = useAvatarContext()
161
- const fontScale = useFontScale({ maxFontSizeMultiplier })
169
+ const { size, maxFontSizeMultiplier, minFontSizeMultiplier } = useAvatarContext()
170
+ const fontScale = useFontScale({ maxFontSizeMultiplier, minFontSizeMultiplier })
162
171
  const scaledAvatarSize = AVATAR_PX[size] * fontScale
163
172
 
164
173
  return <Image source={{ uri: sourceUri }} loaderSize={scaledAvatarSize} {...props} alt="" />
@@ -183,9 +192,9 @@ interface AvatarImageFallbackProps {
183
192
  }
184
193
 
185
194
  function AvatarImageFallback({ name = 'general.person' }: AvatarImageFallbackProps) {
186
- const { size, maxFontSizeMultiplier } = useAvatarContext()
187
- const styles = useStyles({ maxFontSizeMultiplier })
188
- const fontScale = useFontScale({ maxFontSizeMultiplier })
195
+ const { size, maxFontSizeMultiplier, minFontSizeMultiplier } = useAvatarContext()
196
+ const styles = useStyles({ maxFontSizeMultiplier, minFontSizeMultiplier })
197
+ const fontScale = useFontScale({ maxFontSizeMultiplier, minFontSizeMultiplier })
189
198
  const scaledIconSize = AVATAR_FALLBACK_ICON_PX[size] * fontScale
190
199
 
191
200
  return (
@@ -213,8 +222,8 @@ interface AvatarGroupProps {
213
222
  type AvatarIndex = 0 | 1 | 2 | 3
214
223
 
215
224
  function AvatarGroup({ sourceUris }: AvatarGroupProps) {
216
- const { setAllImagesLoaded, maxFontSizeMultiplier } = useAvatarContext()
217
- const styles = useStyles({ maxFontSizeMultiplier })
225
+ const { setAllImagesLoaded, maxFontSizeMultiplier, minFontSizeMultiplier } = useAvatarContext()
226
+ const styles = useStyles({ maxFontSizeMultiplier, minFontSizeMultiplier })
218
227
  const [loadingStatus, setLoadingStatus] = useState<Record<AvatarIndex, boolean>>({
219
228
  0: false,
220
229
  1: false,
@@ -323,9 +332,9 @@ AvatarGroup.displayName = 'Avatar.Group'
323
332
  // =================================
324
333
 
325
334
  function AvatarGroupLoader() {
326
- const { size, allImagesLoaded, maxFontSizeMultiplier } = useAvatarContext()
327
- const styles = useStyles({ size, maxFontSizeMultiplier })
328
- const fontScale = useFontScale({ maxFontSizeMultiplier })
335
+ const { size, allImagesLoaded, maxFontSizeMultiplier, minFontSizeMultiplier } = useAvatarContext()
336
+ const styles = useStyles({ size, maxFontSizeMultiplier, minFontSizeMultiplier })
337
+ const fontScale = useFontScale({ maxFontSizeMultiplier, minFontSizeMultiplier })
329
338
  const scaledSpinnerSize = AVATAR_PX[size] * fontScale
330
339
 
331
340
  if (allImagesLoaded) return null
@@ -348,8 +357,8 @@ interface AvatarPresenceProps extends ViewProps {
348
357
  }
349
358
 
350
359
  function AvatarPresence({ presence, ...props }: AvatarPresenceProps) {
351
- const { size, maxFontSizeMultiplier } = useAvatarContext()
352
- const styles = useStyles({ size, presence, maxFontSizeMultiplier })
360
+ const { size, maxFontSizeMultiplier, minFontSizeMultiplier } = useAvatarContext()
361
+ const styles = useStyles({ size, presence, maxFontSizeMultiplier, minFontSizeMultiplier })
353
362
 
354
363
  return <View style={styles.presence} {...props} />
355
364
  }
@@ -364,15 +373,17 @@ interface Styles {
364
373
  size?: AvatarSize
365
374
  presence?: AvatarPresenceType
366
375
  maxFontSizeMultiplier?: number
376
+ minFontSizeMultiplier?: number
367
377
  }
368
378
 
369
379
  const useStyles = ({
370
380
  size = 'md',
371
381
  presence = 'offline',
372
382
  maxFontSizeMultiplier = MAX_FONT_SIZE_MULTIPLIER,
383
+ minFontSizeMultiplier = undefined,
373
384
  }: Styles = {}) => {
374
385
  const { colors } = useTheme()
375
- const fontScale = useFontScale({ maxFontSizeMultiplier })
386
+ const fontScale = useFontScale({ maxFontSizeMultiplier, minFontSizeMultiplier })
376
387
  const PRESENCE_COLOR = {
377
388
  online: colors.fillColorInteractionOnlineDefault,
378
389
  offline: colors.iconColorDefaultDisabled,
@@ -35,6 +35,8 @@ import { CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL } from '../utils/styles'
35
35
  import { useConversationJoltEvents } from '../hooks/use_conversation_jolt_events'
36
36
  import { JumpToBottomButton } from '../components/conversation/jump_to_bottom_button'
37
37
 
38
+ export const REPLIES_FEATURE_ENABLED = false
39
+
38
40
  export type ConversationRouteProps = {
39
41
  conversation_id: number
40
42
  chat_group_graph_id?: string
@@ -5,6 +5,7 @@ export const MAX_FONT_SIZE_MULTIPLIER = 1.5
5
5
  export const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.2 // Use in headers, footers, toolbars, etc.
6
6
 
7
7
  export const CONVERSATION_MESSAGE_LIST_PADDING_HORIZONTAL = 16 // TODO: move to `screens/conversation/utils/styles` when `/screens/conversation` is created
8
+ export const MESSAGE_AUTHOR_AVATAR_COLUMN_WIDTH = 32 // TODO: move to `screens/conversation/utils/styles` when `/screens/conversation` is created
8
9
 
9
10
  export const platformFontWeightMedium = Platform.select({
10
11
  ios: tokens.fontWeightMedium,