@planningcenter/chat-react-native 3.15.0-rc.0 → 3.15.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 (57) hide show
  1. package/build/components/conversations/conversation_preview.d.ts.map +1 -1
  2. package/build/components/conversations/conversation_preview.js +9 -5
  3. package/build/components/conversations/conversation_preview.js.map +1 -1
  4. package/build/components/conversations/mute_indicator.d.ts.map +1 -1
  5. package/build/components/conversations/mute_indicator.js +3 -1
  6. package/build/components/conversations/mute_indicator.js.map +1 -1
  7. package/build/components/conversations/swipeable_toggle_button.d.ts.map +1 -1
  8. package/build/components/conversations/swipeable_toggle_button.js +6 -3
  9. package/build/components/conversations/swipeable_toggle_button.js.map +1 -1
  10. package/build/components/conversations/unread_count_badge.js +9 -6
  11. package/build/components/conversations/unread_count_badge.js.map +1 -1
  12. package/build/components/display/action_button.d.ts.map +1 -1
  13. package/build/components/display/action_button.js +2 -4
  14. package/build/components/display/action_button.js.map +1 -1
  15. package/build/components/display/badge.d.ts +5 -1
  16. package/build/components/display/badge.d.ts.map +1 -1
  17. package/build/components/display/badge.js +2 -2
  18. package/build/components/display/badge.js.map +1 -1
  19. package/build/components/display/toggle_button.d.ts +3 -1
  20. package/build/components/display/toggle_button.d.ts.map +1 -1
  21. package/build/components/display/toggle_button.js +1 -1
  22. package/build/components/display/toggle_button.js.map +1 -1
  23. package/build/components/primitive/form_sheet.d.ts +3 -2
  24. package/build/components/primitive/form_sheet.d.ts.map +1 -1
  25. package/build/components/primitive/form_sheet.js +5 -3
  26. package/build/components/primitive/form_sheet.js.map +1 -1
  27. package/build/hooks/index.d.ts +1 -0
  28. package/build/hooks/index.d.ts.map +1 -1
  29. package/build/hooks/index.js +1 -0
  30. package/build/hooks/index.js.map +1 -1
  31. package/build/hooks/use_scalable_number_of_lines.d.ts +2 -0
  32. package/build/hooks/use_scalable_number_of_lines.d.ts.map +1 -0
  33. package/build/hooks/use_scalable_number_of_lines.js +9 -0
  34. package/build/hooks/use_scalable_number_of_lines.js.map +1 -0
  35. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  36. package/build/screens/conversations/components/list_header_component.js +2 -2
  37. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  38. package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
  39. package/build/screens/conversations/conversations_screen.js +1 -1
  40. package/build/screens/conversations/conversations_screen.js.map +1 -1
  41. package/build/utils/styles.d.ts +1 -1
  42. package/build/utils/styles.js +1 -1
  43. package/build/utils/styles.js.map +1 -1
  44. package/package.json +2 -2
  45. package/src/components/conversations/conversation_preview.tsx +15 -4
  46. package/src/components/conversations/mute_indicator.tsx +9 -1
  47. package/src/components/conversations/swipeable_toggle_button.tsx +18 -3
  48. package/src/components/conversations/unread_count_badge.tsx +9 -6
  49. package/src/components/display/action_button.tsx +3 -4
  50. package/src/components/display/badge.tsx +6 -1
  51. package/src/components/display/toggle_button.tsx +12 -1
  52. package/src/components/primitive/form_sheet.tsx +33 -5
  53. package/src/hooks/index.ts +1 -0
  54. package/src/hooks/use_scalable_number_of_lines.ts +10 -0
  55. package/src/screens/conversations/components/list_header_component.tsx +3 -1
  56. package/src/screens/conversations/conversations_screen.tsx +2 -0
  57. package/src/utils/styles.ts +1 -1
@@ -91,6 +91,10 @@ export interface BadgeProps {
91
91
  * Callback function when the badge is pressed.
92
92
  */
93
93
  onPress?: () => void
94
+ /**
95
+ * Specifies the number of lines for the meta label before truncating.
96
+ */
97
+ numberOfLinesMetaLabel?: number
94
98
  }
95
99
 
96
100
  export function Badge({
@@ -103,6 +107,7 @@ export function Badge({
103
107
  productLogoName,
104
108
  variant = 'default',
105
109
  maxFontSizeMultiplier,
110
+ numberOfLinesMetaLabel = 1,
106
111
  onPress,
107
112
  }: BadgeProps) {
108
113
  const styles = useStyles({ appearance, maxFontSizeMultiplier, variant })
@@ -134,7 +139,7 @@ export function Badge({
134
139
  <Text
135
140
  variant="footnote"
136
141
  style={styles.metaLabel}
137
- numberOfLines={1}
142
+ numberOfLines={numberOfLinesMetaLabel}
138
143
  maxFontSizeMultiplier={maxFontSizeMultiplier}
139
144
  >
140
145
  {metaLabel}
@@ -17,11 +17,20 @@ import { Icon, IconString } from './icon'
17
17
  import { tokens } from '../../vendor/tapestry/tokens'
18
18
  import { Haptic } from '../../utils/native_adapters/configuration'
19
19
 
20
+ // =================================
21
+ // ====== Constants ================
22
+ // =================================
23
+
24
+ // We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.
25
+ // This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.
26
+ // Triggering this prop will display an almost full screen iOS a11y button.
27
+ type RestrictedPressableProps = Omit<PressableProps, 'onLongPress'>
28
+
20
29
  // =================================
21
30
  // ====== Component ================
22
31
  // =================================
23
32
 
24
- export interface ToggleButtonProps extends PressableProps {
33
+ export interface ToggleButtonProps extends RestrictedPressableProps {
25
34
  /**
26
35
  * Pressable container styles
27
36
  */
@@ -102,6 +111,8 @@ export function ToggleButton({
102
111
  accessibilityState={{ checked: active }}
103
112
  android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}
104
113
  onPress={handlePress}
114
+ accessibilityShowsLargeContentViewer
115
+ accessibilityLargeContentTitle={title}
105
116
  {...props}
106
117
  >
107
118
  {iconNameLeft && (
@@ -14,6 +14,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'
14
14
  import { useTheme } from '../../hooks'
15
15
  import type { ButtonProps, TextButtonProps } from '../display'
16
16
  import { Button, Heading, Icon, IconString, Text, TextButton } from '../display'
17
+ import { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../utils'
17
18
 
18
19
  // =================================
19
20
  // ====== Exports ==================
@@ -146,7 +147,11 @@ function FormSheetHeaderTitle({ children }: FormSheetHeaderTitleProps) {
146
147
  const styles = useStyles()
147
148
 
148
149
  return (
149
- <Heading variant="h3" style={styles.headerTitle} maxFontSizeMultiplier={1}>
150
+ <Heading
151
+ variant="h3"
152
+ style={styles.headerTitle}
153
+ maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
154
+ >
150
155
  {children}
151
156
  </Heading>
152
157
  )
@@ -174,10 +179,23 @@ FormSheetHeaderActions.displayName = 'FormSheet.HeaderActions'
174
179
  // ====== FormSheetHeaderTextButton ==========
175
180
  // ===========================================
176
181
 
177
- interface FormSheetHeaderTextButtonProps extends Omit<TextButtonProps, 'maxFontSizeMultiplier'> {}
182
+ // We are omitting `onLongPress` because we are instead supporting `accessibilityShowsLargeContentViewer`.
183
+ // This is triggered by an `onLongPress` event when an iOS device is in Apple's accessible font scale range.
184
+ // Triggering this prop will display an almost full screen iOS a11y button.
185
+ interface FormSheetHeaderTextButtonProps
186
+ extends Omit<TextButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {
187
+ children: string
188
+ }
178
189
 
179
190
  function FormSheetHeaderTextButton(props: FormSheetHeaderTextButtonProps) {
180
- return <TextButton {...props} maxFontSizeMultiplier={1} />
191
+ return (
192
+ <TextButton
193
+ {...props}
194
+ maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
195
+ accessibilityShowsLargeContentViewer
196
+ accessibilityLargeContentTitle={props.children}
197
+ />
198
+ )
181
199
  }
182
200
 
183
201
  FormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'
@@ -186,10 +204,19 @@ FormSheetHeaderTextButton.displayName = 'FormSheet.HeaderTextButton'
186
204
  // ====== FormSheetHeaderButton ============
187
205
  // =========================================
188
206
 
189
- interface FormSheetHeaderButtonProps extends Omit<ButtonProps, 'maxFontSizeMultiplier'> {}
207
+ // Same `onLongPress`note as `FormSheetHeaderTextButtonProps`
208
+ interface FormSheetHeaderButtonProps
209
+ extends Omit<ButtonProps, 'maxFontSizeMultiplier' | 'onLongPress'> {}
190
210
 
191
211
  function FormSheetHeaderButton(props: FormSheetHeaderButtonProps) {
192
- return <Button {...props} maxFontSizeMultiplier={1} />
212
+ return (
213
+ <Button
214
+ {...props}
215
+ maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
216
+ accessibilityShowsLargeContentViewer
217
+ accessibilityLargeContentTitle={props.title}
218
+ />
219
+ )
193
220
  }
194
221
 
195
222
  FormSheetHeaderButton.displayName = 'FormSheet.HeaderButton'
@@ -324,6 +351,7 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
324
351
  },
325
352
  headerTitle: {
326
353
  textAlign: 'left',
354
+ flex: 1,
327
355
  },
328
356
  headerActions: {
329
357
  flexDirection: 'row',
@@ -13,3 +13,4 @@ export * from './use_api_client'
13
13
  export * from './use_message_reaction_toggle'
14
14
  export * from './use_interaction_ghost_color'
15
15
  export * from './use_at_font_scale_breakpoint'
16
+ export * from './use_scalable_number_of_lines'
@@ -0,0 +1,10 @@
1
+ import { useAtFontScaleBreakpoint } from './use_at_font_scale_breakpoint'
2
+
3
+ export const useScalableNumberOfLines = (numberOfLines?: number): number | undefined => {
4
+ const atFontScaleBreakpoint = useAtFontScaleBreakpoint()
5
+
6
+ if (!numberOfLines) return undefined
7
+
8
+ const numberOfLinesDoubled = numberOfLines + 1
9
+ return atFontScaleBreakpoint ? numberOfLinesDoubled : numberOfLines
10
+ }
@@ -68,6 +68,8 @@ export const ListHeaderComponent = () => {
68
68
  onPress={alertMarkAllRead}
69
69
  disabled={isPending}
70
70
  maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
71
+ accessibilityShowsLargeContentViewer
72
+ accessibilityLargeContentTitle="Mark all read"
71
73
  >
72
74
  Mark all read
73
75
  </TextButton>
@@ -153,7 +155,7 @@ const useStyles = () => {
153
155
  rowGap: 8,
154
156
  columnGap: 16,
155
157
  paddingTop: 8,
156
- paddingBottom: atFontScaleBreakpoint ? 8 : 0,
158
+ paddingBottom: atFontScaleBreakpoint ? 4 : 0,
157
159
  paddingHorizontal: ROW_PADDING_HORIZONTAL,
158
160
  },
159
161
  filterRow: {
@@ -73,6 +73,8 @@ export function ConversationsScreen({ route }: ConversationsScreenProps) {
73
73
  variant="tertiary"
74
74
  onPress={reportABug}
75
75
  maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}
76
+ accessibilityShowsLargeContentViewer
77
+ accessibilityLargeContentTitle="Report a bug"
76
78
  >
77
79
  Report a bug
78
80
  </TextButton>
@@ -2,7 +2,7 @@ import { Platform } from 'react-native'
2
2
  import { tokens } from '../vendor/tapestry/tokens'
3
3
 
4
4
  export const MAX_FONT_SIZE_MULTIPLIER = 1.5
5
- export const MAX_FONT_SIZE_MULTIPLIER_LANDMARK = 1.3 // Use in headers, footers, toolbars, etc.
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
8