@planningcenter/chat-react-native 3.9.0-rc.0 → 3.9.0-rc.2

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 (38) hide show
  1. package/build/components/conversation/message.d.ts.map +1 -1
  2. package/build/components/conversation/message.js +11 -1
  3. package/build/components/conversation/message.js.map +1 -1
  4. package/build/components/display/platform_modal_header_buttons.d.ts.map +1 -1
  5. package/build/components/display/platform_modal_header_buttons.js +2 -2
  6. package/build/components/display/platform_modal_header_buttons.js.map +1 -1
  7. package/build/components/display/text_button.d.ts +1 -2
  8. package/build/components/display/text_button.d.ts.map +1 -1
  9. package/build/components/display/text_button.js.map +1 -1
  10. package/build/components/primitive/form_sheet.d.ts +17 -4
  11. package/build/components/primitive/form_sheet.d.ts.map +1 -1
  12. package/build/components/primitive/form_sheet.js +27 -12
  13. package/build/components/primitive/form_sheet.js.map +1 -1
  14. package/build/screens/conversation/message_read_receipts_screen.d.ts.map +1 -1
  15. package/build/screens/conversation/message_read_receipts_screen.js +9 -2
  16. package/build/screens/conversation/message_read_receipts_screen.js.map +1 -1
  17. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  18. package/build/screens/conversation_details_screen.js +2 -2
  19. package/build/screens/conversation_details_screen.js.map +1 -1
  20. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.d.ts.map +1 -1
  21. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js +10 -3
  22. package/build/screens/conversation_filter_recipients/conversation_filter_recipients_screen.js.map +1 -1
  23. package/build/screens/conversation_filters_screen.d.ts.map +1 -1
  24. package/build/screens/conversation_filters_screen.js +7 -3
  25. package/build/screens/conversation_filters_screen.js.map +1 -1
  26. package/build/screens/conversation_screen.d.ts.map +1 -1
  27. package/build/screens/conversation_screen.js +4 -2
  28. package/build/screens/conversation_screen.js.map +1 -1
  29. package/package.json +2 -2
  30. package/src/components/conversation/message.tsx +16 -1
  31. package/src/components/display/platform_modal_header_buttons.tsx +2 -0
  32. package/src/components/display/text_button.tsx +1 -1
  33. package/src/components/primitive/form_sheet.tsx +83 -19
  34. package/src/screens/conversation/message_read_receipts_screen.tsx +9 -5
  35. package/src/screens/conversation_details_screen.tsx +2 -1
  36. package/src/screens/conversation_filter_recipients/conversation_filter_recipients_screen.tsx +10 -11
  37. package/src/screens/conversation_filters_screen.tsx +9 -3
  38. package/src/screens/conversation_screen.tsx +4 -1
@@ -12,7 +12,8 @@ import {
12
12
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
13
13
  import { useTheme } from '../../hooks'
14
14
  import { PlatformPressable, useHeaderHeight } from '@react-navigation/elements'
15
- import { Heading, Icon, IconString, Text } from '../display'
15
+ import { Heading, Icon, IconString, Text, Button, TextButton } from '../display'
16
+ import type { ButtonProps, TextButtonProps } from '../display'
16
17
 
17
18
  // =================================
18
19
  // ====== Exports ==================
@@ -43,16 +44,32 @@ const FormSheet = {
43
44
  Root: FormSheetRoot,
44
45
  Action: FormSheetAction,
45
46
  Header: FormSheetHeader,
47
+ HeaderTitle: FormSheetHeaderTitle,
48
+ HeaderActions: FormSheetHeaderActions,
49
+ HeaderSecondaryButton: FormSheetHeaderSecondaryButton,
50
+ HeaderPrimaryButton: FormSheetHeaderPrimaryButton,
46
51
  } as const
47
52
 
48
53
  type FormSheetComponents = {
49
54
  Root: React.FC<FormSheetRootProps>
50
55
  Action: React.FC<FormSheetActionProps>
51
56
  Header: React.FC<FormSheetHeaderProps>
57
+ HeaderTitle: React.FC<FormSheetHeaderTitleProps>
58
+ HeaderActions: React.FC<FormSheetHeaderActionsProps>
59
+ HeaderSecondaryButton: React.FC<FormSheetHeaderSecondaryButtonProps>
60
+ HeaderPrimaryButton: React.FC<FormSheetHeaderPrimaryButtonProps>
52
61
  }
53
62
 
54
63
  export default FormSheet as FormSheetComponents
55
- export type { FormSheetRootProps, FormSheetActionProps, FormSheetHeaderProps }
64
+ export type {
65
+ FormSheetRootProps,
66
+ FormSheetActionProps,
67
+ FormSheetHeaderProps,
68
+ FormSheetHeaderTitleProps,
69
+ FormSheetHeaderActionsProps,
70
+ FormSheetHeaderSecondaryButtonProps,
71
+ FormSheetHeaderPrimaryButtonProps,
72
+ }
56
73
 
57
74
  // ====================================
58
75
  // ====== ActionsFormSheetRoot ========
@@ -95,30 +112,77 @@ function AndroidSheetGrabber() {
95
112
  // ====================================
96
113
 
97
114
  interface FormSheetHeaderProps {
98
- title: string
99
- secondaryButton?: ReactNode
100
- primaryButton?: ReactNode
115
+ children: ReactNode
116
+ }
117
+
118
+ function FormSheetHeader({ children }: FormSheetHeaderProps) {
119
+ const styles = useStyles()
120
+
121
+ return <View style={styles.header}>{children}</View>
122
+ }
123
+
124
+ FormSheetHeader.displayName = 'FormSheet.Header'
125
+
126
+ // ====================================
127
+ // ====== FormSheetHeaderTitle ========
128
+ // ====================================
129
+
130
+ interface FormSheetHeaderTitleProps {
131
+ children: ReactNode
101
132
  }
102
- function FormSheetHeader({ title, secondaryButton, primaryButton }: FormSheetHeaderProps) {
133
+
134
+ function FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {
103
135
  const styles = useStyles()
104
- const hasActions = Boolean(secondaryButton) || Boolean(primaryButton)
105
136
 
106
137
  return (
107
- <View style={styles.header}>
108
- <Heading variant="h3" style={styles.headerTitle}>
109
- {title}
110
- </Heading>
111
- {hasActions && (
112
- <View style={styles.headerActions}>
113
- {secondaryButton}
114
- {primaryButton}
115
- </View>
116
- )}
117
- </View>
138
+ <Heading variant="h3" style={styles.headerTitle} maxFontSizeMultiplier={1}>
139
+ {children}
140
+ </Heading>
118
141
  )
119
142
  }
120
143
 
121
- FormSheetHeader.displayName = 'FormSheet.Header'
144
+ FormSheetHeaderTitle.displayName = 'FormSheet.HeaderTitle'
145
+
146
+ // ====================================
147
+ // ====== FormSheetHeaderActions ======
148
+ // ====================================
149
+
150
+ interface FormSheetHeaderActionsProps {
151
+ children: ReactNode
152
+ }
153
+
154
+ function FormSheetHeaderActions({ children }: FormSheetHeaderActionsProps) {
155
+ const styles = useStyles()
156
+
157
+ return <View style={styles.headerActions}>{children}</View>
158
+ }
159
+
160
+ FormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'
161
+
162
+ // ===========================================
163
+ // ====== FormSheetHeaderSecondaryButton ====
164
+ // ===========================================
165
+
166
+ interface FormSheetHeaderSecondaryButtonProps
167
+ extends Omit<TextButtonProps, 'maxFontSizeMultiplier'> {}
168
+
169
+ function FormSheetHeaderSecondaryButton(props: FormSheetHeaderSecondaryButtonProps) {
170
+ return <TextButton {...props} maxFontSizeMultiplier={1} />
171
+ }
172
+
173
+ FormSheetHeaderSecondaryButton.displayName = 'FormSheet.HeaderSecondaryButton'
174
+
175
+ // =========================================
176
+ // ====== FormSheetHeaderPrimaryButton ====
177
+ // =========================================
178
+
179
+ interface FormSheetHeaderPrimaryButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier'> {}
180
+
181
+ function FormSheetHeaderPrimaryButton(props: FormSheetHeaderPrimaryButtonProps) {
182
+ return <Button {...props} maxFontSizeMultiplier={1} />
183
+ }
184
+
185
+ FormSheetHeaderPrimaryButton.displayName = 'FormSheet.HeaderPrimaryButton'
122
186
 
123
187
  // ====================================
124
188
  // ====== ActionsFormSheetAction ======
@@ -2,7 +2,7 @@ import { StaticScreenProps, useNavigation } from '@react-navigation/native'
2
2
  import React, { memo } from 'react'
3
3
  import { Platform, StyleSheet, View } from 'react-native'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
- import { Avatar, Text, TextButton } from '../../components'
5
+ import { Avatar, Text } from '../../components'
6
6
  import { useReadReceipts } from '../../hooks/use_read_receipts'
7
7
  import { FlatList } from 'react-native-gesture-handler'
8
8
  import { ReadReceiptResource } from '../../types/resources/read_receipt'
@@ -35,10 +35,14 @@ export function MessageReadReceiptsScreen({ route }: MessageReadReceiptsScreenPr
35
35
 
36
36
  return (
37
37
  <FormSheet.Root>
38
- <FormSheet.Header
39
- title={`Read receipts (${totalCount})`}
40
- secondaryButton={<TextButton onPress={() => navigation.goBack()}>Close</TextButton>}
41
- />
38
+ <FormSheet.Header>
39
+ <FormSheet.HeaderTitle>Read receipts ({totalCount})</FormSheet.HeaderTitle>
40
+ <FormSheet.HeaderActions>
41
+ <FormSheet.HeaderSecondaryButton onPress={() => navigation.goBack()}>
42
+ Close
43
+ </FormSheet.HeaderSecondaryButton>
44
+ </FormSheet.HeaderActions>
45
+ </FormSheet.Header>
42
46
  <FlatList
43
47
  data={receipts}
44
48
  contentContainerStyle={styles.contentContainer}
@@ -176,13 +176,14 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
176
176
  (props: HeaderTitleProps) => {
177
177
  return (
178
178
  <View style={styles.headerTitleContainer}>
179
- <ElementsHeaderTitle {...props} />
179
+ <ElementsHeaderTitle maxFontSizeMultiplier={1} {...props} />
180
180
  <Badge
181
181
  variant="metaSubtle"
182
182
  label={resourceType}
183
183
  metaLabel={name}
184
184
  style={styles.headerTitleBadge}
185
185
  productLogoName={productName}
186
+ maxFontSizeMultiplier={1}
186
187
  />
187
188
  </View>
188
189
  )
@@ -3,7 +3,7 @@ import React, { useCallback } from 'react'
3
3
  import { Platform, StyleSheet } from 'react-native'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { FlatList } from 'react-native-gesture-handler'
6
- import { Button, Heading, TextButton } from '../../components'
6
+ import { Heading } from '../../components'
7
7
  import { useTheme } from '../../hooks'
8
8
  import { useFlattenedArrayOfServiceTypesWithTeams } from './hooks/use_flattened_array_of_service_types_with_teams'
9
9
  import { ConversationFilterRecipientsScreenProps, SectionTypes } from './types'
@@ -63,25 +63,24 @@ export const ConversationFilterRecipientsScreen = ({
63
63
 
64
64
  return (
65
65
  <FormSheet.Root>
66
- <FormSheet.Header
67
- title="Teams I lead"
68
- secondaryButton={
69
- <TextButton
66
+ <FormSheet.Header>
67
+ <FormSheet.HeaderTitle>Teams I lead</FormSheet.HeaderTitle>
68
+ <FormSheet.HeaderActions>
69
+ <FormSheet.HeaderSecondaryButton
70
70
  onPress={resetTeamFilters}
71
71
  accessibilityHint="Cancels any selected teams and closes this modal."
72
72
  >
73
73
  Cancel
74
- </TextButton>
75
- }
76
- primaryButton={
77
- <Button
74
+ </FormSheet.HeaderSecondaryButton>
75
+ <FormSheet.HeaderPrimaryButton
78
76
  title="Apply"
79
77
  accessibilityHint={applyButtonAccessibilityHint}
80
78
  onPress={applyTeamFilters}
81
79
  disabled={noTeamsSelected}
82
80
  />
83
- }
84
- />
81
+ </FormSheet.HeaderActions>
82
+ </FormSheet.Header>
83
+
85
84
  <FlatList
86
85
  data={data}
87
86
  ListHeaderComponent={
@@ -23,7 +23,11 @@ import { TeamFilters } from './conversation_filters/team_filters'
23
23
 
24
24
  const FilterHeaderTitle = ({ tintColor }: HeaderTitleProps) => {
25
25
  const styles = useStyles()
26
- return <HeaderTitle style={[styles.headerTitle, { color: tintColor }]}>Filters</HeaderTitle>
26
+ return (
27
+ <HeaderTitle maxFontSizeMultiplier={1} style={[styles.headerTitle, { color: tintColor }]}>
28
+ Filters
29
+ </HeaderTitle>
30
+ )
27
31
  }
28
32
 
29
33
  const HeaderRight = () => {
@@ -33,8 +37,10 @@ const HeaderRight = () => {
33
37
 
34
38
  return (
35
39
  <View style={styles.headerRight}>
36
- <TextButton onPress={resetFilter}>Reset</TextButton>
37
- <Button title="Apply" onPress={() => applyFilters(route.params)} />
40
+ <TextButton maxFontSizeMultiplier={1} onPress={resetFilter}>
41
+ Reset
42
+ </TextButton>
43
+ <Button maxFontSizeMultiplier={1} title="Apply" onPress={() => applyFilters(route.params)} />
38
44
  </View>
39
45
  )
40
46
  }
@@ -267,7 +267,9 @@ export const ConversationScreenTitle = ({
267
267
  }}
268
268
  >
269
269
  <View style={styles.titleWrapper}>
270
- <HeaderTitle style={style}>{children}</HeaderTitle>
270
+ <HeaderTitle maxFontSizeMultiplier={1} style={style}>
271
+ {children}
272
+ </HeaderTitle>
271
273
  {!deleted && <Icon name="general.downChevron" size={12} />}
272
274
  </View>
273
275
  <Badge
@@ -276,6 +278,7 @@ export const ConversationScreenTitle = ({
276
278
  label={resourceType}
277
279
  metaLabel={name}
278
280
  style={styles.badge}
281
+ maxFontSizeMultiplier={1}
279
282
  />
280
283
  </PlatformPressable>
281
284
  )