@planningcenter/chat-react-native 3.13.2-rc.3 → 3.14.0-rc.1

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 (64) hide show
  1. package/build/components/conversation/message.d.ts.map +1 -1
  2. package/build/components/conversation/message.js +4 -0
  3. package/build/components/conversation/message.js.map +1 -1
  4. package/build/components/conversation/message_form.d.ts.map +1 -1
  5. package/build/components/conversation/message_form.js +23 -3
  6. package/build/components/conversation/message_form.js.map +1 -1
  7. package/build/components/display/toggle_button.d.ts +5 -1
  8. package/build/components/display/toggle_button.d.ts.map +1 -1
  9. package/build/components/display/toggle_button.js +8 -2
  10. package/build/components/display/toggle_button.js.map +1 -1
  11. package/build/hooks/use_attachment_uploader.d.ts +2 -1
  12. package/build/hooks/use_attachment_uploader.d.ts.map +1 -1
  13. package/build/hooks/use_attachment_uploader.js +6 -2
  14. package/build/hooks/use_attachment_uploader.js.map +1 -1
  15. package/build/hooks/use_message_draft.d.ts +13 -0
  16. package/build/hooks/use_message_draft.d.ts.map +1 -0
  17. package/build/hooks/use_message_draft.js +83 -0
  18. package/build/hooks/use_message_draft.js.map +1 -0
  19. package/build/screens/conversation_new/components/services_form.d.ts.map +1 -1
  20. package/build/screens/conversation_new/components/services_form.js +12 -8
  21. package/build/screens/conversation_new/components/services_form.js.map +1 -1
  22. package/build/screens/conversation_screen.d.ts.map +1 -1
  23. package/build/screens/conversation_screen.js +6 -1
  24. package/build/screens/conversation_screen.js.map +1 -1
  25. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.d.ts.map +1 -1
  26. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js +10 -6
  27. package/build/screens/conversation_select_recipients/conversation_select_recipients_screen.js.map +1 -1
  28. package/build/screens/design_system_screen.d.ts.map +1 -1
  29. package/build/screens/design_system_screen.js +54 -2
  30. package/build/screens/design_system_screen.js.map +1 -1
  31. package/build/screens/message_actions_screen.d.ts.map +1 -1
  32. package/build/screens/message_actions_screen.js +2 -1
  33. package/build/screens/message_actions_screen.js.map +1 -1
  34. package/build/types/resources/denormalized_attachment_resource_for_create.d.ts +1 -0
  35. package/build/types/resources/denormalized_attachment_resource_for_create.d.ts.map +1 -1
  36. package/build/types/resources/denormalized_attachment_resource_for_create.js.map +1 -1
  37. package/build/utils/native_adapters/configuration.d.ts +3 -0
  38. package/build/utils/native_adapters/configuration.d.ts.map +1 -1
  39. package/build/utils/native_adapters/configuration.js +3 -0
  40. package/build/utils/native_adapters/configuration.js.map +1 -1
  41. package/build/utils/native_adapters/haptic.d.ts +23 -0
  42. package/build/utils/native_adapters/haptic.d.ts.map +1 -0
  43. package/build/utils/native_adapters/haptic.js +22 -0
  44. package/build/utils/native_adapters/haptic.js.map +1 -0
  45. package/build/utils/native_adapters/index.d.ts +1 -0
  46. package/build/utils/native_adapters/index.d.ts.map +1 -1
  47. package/build/utils/native_adapters/index.js +1 -0
  48. package/build/utils/native_adapters/index.js.map +1 -1
  49. package/package.json +2 -2
  50. package/src/__tests__/utils/native_adapters/configuration.ts +46 -1
  51. package/src/components/conversation/message.tsx +4 -0
  52. package/src/components/conversation/message_form.tsx +25 -3
  53. package/src/components/display/toggle_button.tsx +15 -1
  54. package/src/hooks/use_attachment_uploader.ts +12 -2
  55. package/src/hooks/use_message_draft.ts +108 -0
  56. package/src/screens/conversation_new/components/services_form.tsx +4 -2
  57. package/src/screens/conversation_screen.tsx +7 -0
  58. package/src/screens/conversation_select_recipients/conversation_select_recipients_screen.tsx +4 -2
  59. package/src/screens/design_system_screen.tsx +66 -1
  60. package/src/screens/message_actions_screen.tsx +2 -1
  61. package/src/types/resources/denormalized_attachment_resource_for_create.ts +1 -0
  62. package/src/utils/native_adapters/configuration.ts +5 -0
  63. package/src/utils/native_adapters/haptic.ts +34 -0
  64. package/src/utils/native_adapters/index.ts +1 -0
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
  import { Alert, Pressable, ScrollView, StyleSheet, View } from 'react-native'
3
3
  import type { ViewStyle } from 'react-native'
4
- import { useTheme } from '../hooks'
4
+ import { useInteractionGhostBackgroundColor, useTheme } from '../hooks'
5
5
  import {
6
6
  Avatar,
7
7
  AvatarGroup,
@@ -27,6 +27,7 @@ import {
27
27
  MAX_FONT_SIZE_MULTIPLIER,
28
28
  platformPressedOpacityStyle,
29
29
  platformFontWeightMedium,
30
+ Haptic,
30
31
  } from '../utils'
31
32
  import BannerPrimitive from '../components/primitive/banner_primitive'
32
33
  import { VideoAttachmentPreview } from '../components/display/video_attachment_preview'
@@ -89,6 +90,7 @@ export function DesignSystemScreen() {
89
90
  <IndicatorsSection />
90
91
  <HeadingTextSection />
91
92
  <PressablesSection />
93
+ <HapticsSection />
92
94
  <ImageIconsSection />
93
95
  <FormControlsSection />
94
96
  <StatusComponentsSection />
@@ -678,6 +680,37 @@ function PressablesSection({ isLast }: SectionProps) {
678
680
  </CollapsableSection>
679
681
  )
680
682
  }
683
+ function HapticsSection({ isLast }: SectionProps) {
684
+ return (
685
+ <CollapsableSection title="Haptics" isLast={isLast}>
686
+ <TextGroup>
687
+ <Text>
688
+ Haptics help communicate changes and interactions in the UI by making them feel physical
689
+ and "weighty". They are a progressive enhancement and shouldn't replace visual feedback.
690
+ </Text>
691
+ </TextGroup>
692
+ <Group title="Impact" description="Communicates that a user interaction is occurring.">
693
+ <Row>
694
+ <HapticButton title="Impact Light" onPress={() => Haptic.impactLight()} />
695
+ <HapticButton title="Impact Medium" onPress={() => Haptic.impactMedium()} />
696
+ <HapticButton title="Impact Heavy" onPress={() => Haptic.impactHeavy()} />
697
+ <HapticButton title="Rigid" onPress={() => Haptic.rigid()} />
698
+ <HapticButton title="Soft" onPress={() => Haptic.soft()} />
699
+ </Row>
700
+ </Group>
701
+ <Group
702
+ title="Notification"
703
+ description="Communicates the result of a user or application action."
704
+ >
705
+ <Row>
706
+ <HapticButton title="Notification Success" onPress={() => Haptic.notificationSuccess()} />
707
+ <HapticButton title="Notification Warning" onPress={() => Haptic.notificationWarning()} />
708
+ <HapticButton title="Notification Error" onPress={() => Haptic.notificationError()} />
709
+ </Row>
710
+ </Group>
711
+ </CollapsableSection>
712
+ )
713
+ }
681
714
 
682
715
  function ImageIconsSection({ isLast }: SectionProps) {
683
716
  const styles = useStyles()
@@ -1143,14 +1176,46 @@ function TextListItem({ label, children }: TextListItemProps) {
1143
1176
  )
1144
1177
  }
1145
1178
 
1179
+ function HapticButton({ title, onPress }: { title: string; onPress: () => void }) {
1180
+ const styles = useStyles()
1181
+
1182
+ return (
1183
+ <Pressable
1184
+ onPress={onPress}
1185
+ style={({ pressed }) => ({
1186
+ ...styles.hapticButton,
1187
+ ...{ opacity: pressed ? 0.5 : 1 },
1188
+ })}
1189
+ >
1190
+ <Text style={styles.hapticButtonText}>{title}</Text>
1191
+ </Pressable>
1192
+ )
1193
+ }
1194
+
1146
1195
  // =================================
1147
1196
  // ====== Styles ===================
1148
1197
  // =================================
1149
1198
 
1150
1199
  const useStyles = () => {
1151
1200
  const { colors } = useTheme()
1201
+ const interactionGhostBackgroundColor = useInteractionGhostBackgroundColor()
1152
1202
 
1153
1203
  return StyleSheet.create({
1204
+ hapticButton: {
1205
+ flexGrow: 1,
1206
+ height: 100,
1207
+ padding: 16,
1208
+ alignItems: 'center',
1209
+ justifyContent: 'center',
1210
+ backgroundColor: interactionGhostBackgroundColor,
1211
+ borderWidth: 1,
1212
+ borderColor: colors.interaction,
1213
+ borderRadius: 8,
1214
+ },
1215
+ hapticButtonText: {
1216
+ textAlign: 'center',
1217
+ color: colors.interaction,
1218
+ },
1154
1219
  scrollView: {
1155
1220
  flex: 1,
1156
1221
  backgroundColor: colors.fillColorNeutral100Inverted,
@@ -12,7 +12,7 @@ import { useApiClient } from '../hooks/use_api_client'
12
12
  import { useConversationMessages } from '../hooks/use_conversation_messages'
13
13
  import { useMessageReactionToggle } from '../hooks/use_message_reaction_toggle'
14
14
  import { ReactionCountResource } from '../types/resources/reaction'
15
- import { Clipboard } from '../utils/native_adapters'
15
+ import { Clipboard, Haptic } from '../utils/native_adapters'
16
16
 
17
17
  export const MessageActionsScreenOptions = getFormSheetScreenOptions({
18
18
  sheetAllowedDetents: [0.5],
@@ -111,6 +111,7 @@ export function MessageActionsScreen({ route }: MessageActionsScreenProps) {
111
111
  }, [navigation, conversation_id, message_id])
112
112
 
113
113
  const handleViewReadReceiptsPress = useCallback(() => {
114
+ Haptic.impactLight()
114
115
  const params = omitBy(
115
116
  {
116
117
  conversation_id,
@@ -50,6 +50,7 @@ export interface FileAttachment {
50
50
  id?: string
51
51
  file: NativeAttachmentFile
52
52
  status: AttachmentStatus
53
+ uploadedAt: number
53
54
  }
54
55
 
55
56
  export interface FileUploadState {
@@ -5,6 +5,7 @@ import { ImagePickerAdapter } from './image_picker'
5
5
  import { VideoAdapter } from './video'
6
6
  import { Linking as RNLinking } from 'react-native'
7
7
  import { LinkingAdapter } from './linking'
8
+ import { HapticAdapter } from './haptic'
8
9
 
9
10
  type ChatConfigurations = {
10
11
  clipboard: ClipboardAdapter
@@ -13,6 +14,7 @@ type ChatConfigurations = {
13
14
  imagePicker: ImagePickerAdapter
14
15
  log?: LogAdapter
15
16
  linking?: LinkingAdapter
17
+ haptic?: HapticAdapter
16
18
  }
17
19
 
18
20
  export class ChatAdapters {
@@ -23,6 +25,7 @@ export class ChatAdapters {
23
25
  ImagePicker = configurations.imagePicker
24
26
  Log = configurations.log || new LogAdapter()
25
27
  Linking = configurations.linking || new LinkingAdapter(RNLinking)
28
+ Haptic = configurations.haptic || new HapticAdapter()
26
29
  }
27
30
  }
28
31
 
@@ -69,3 +72,5 @@ export let ImagePicker: ImagePickerAdapter = new ImagePickerAdapter({
69
72
  export let Log: LogAdapter = new LogAdapter()
70
73
 
71
74
  export let Linking: LinkingAdapter = new LinkingAdapter(RNLinking)
75
+
76
+ export let Haptic: HapticAdapter = new HapticAdapter()
@@ -0,0 +1,34 @@
1
+ import { noop } from 'lodash'
2
+
3
+ interface Haptic {
4
+ impactLight: () => void
5
+ impactMedium: () => void
6
+ impactHeavy: () => void
7
+ rigid: () => void
8
+ soft: () => void
9
+ notificationSuccess: () => void
10
+ notificationWarning: () => void
11
+ notificationError: () => void
12
+ }
13
+
14
+ export class HapticAdapter {
15
+ impactLight: () => void
16
+ impactMedium: () => void
17
+ impactHeavy: () => void
18
+ rigid: () => void
19
+ soft: () => void
20
+ notificationSuccess: () => void
21
+ notificationWarning: () => void
22
+ notificationError: () => void
23
+
24
+ constructor(methods?: Haptic) {
25
+ this.impactLight = methods?.impactLight ?? noop
26
+ this.impactMedium = methods?.impactMedium ?? noop
27
+ this.impactHeavy = methods?.impactHeavy ?? noop
28
+ this.rigid = methods?.rigid ?? noop
29
+ this.soft = methods?.soft ?? noop
30
+ this.notificationSuccess = methods?.notificationSuccess ?? noop
31
+ this.notificationWarning = methods?.notificationWarning ?? noop
32
+ this.notificationError = methods?.notificationError ?? noop
33
+ }
34
+ }
@@ -5,3 +5,4 @@ export * from './image_picker'
5
5
  export * from './linking'
6
6
  export * from './log'
7
7
  export * from './video'
8
+ export * from './haptic'