@planningcenter/chat-react-native 3.44.2-qa-staging.0 → 3.44.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 (50) hide show
  1. package/build/components/conversation/message.js +2 -2
  2. package/build/components/conversation/message.js.map +1 -1
  3. package/build/components/conversation/message_form.js +2 -2
  4. package/build/components/conversation/message_form.js.map +1 -1
  5. package/build/components/conversation/message_reaction.js +4 -4
  6. package/build/components/conversation/message_reaction.js.map +1 -1
  7. package/build/components/display/toggle_button.js +5 -9
  8. package/build/components/display/toggle_button.js.map +1 -1
  9. package/build/hooks/index.d.ts +1 -2
  10. package/build/hooks/index.d.ts.map +1 -1
  11. package/build/hooks/index.js +1 -2
  12. package/build/hooks/index.js.map +1 -1
  13. package/build/hooks/use_interaction_ghost_color.d.ts +2 -0
  14. package/build/hooks/use_interaction_ghost_color.d.ts.map +1 -0
  15. package/build/hooks/use_interaction_ghost_color.js +14 -0
  16. package/build/hooks/use_interaction_ghost_color.js.map +1 -0
  17. package/build/hooks/use_rest_away_from_dismiss_edge.d.ts +0 -4
  18. package/build/hooks/use_rest_away_from_dismiss_edge.d.ts.map +1 -1
  19. package/build/hooks/use_rest_away_from_dismiss_edge.js +0 -4
  20. package/build/hooks/use_rest_away_from_dismiss_edge.js.map +1 -1
  21. package/build/screens/design_system_screen.js +3 -3
  22. package/build/screens/design_system_screen.js.map +1 -1
  23. package/build/utils/theme.d.ts +0 -16
  24. package/build/utils/theme.d.ts.map +1 -1
  25. package/build/utils/theme.js +0 -9
  26. package/build/utils/theme.js.map +1 -1
  27. package/package.json +8 -3
  28. package/src/__tests__/utils/theme.ts +0 -23
  29. package/src/components/conversation/message.tsx +2 -2
  30. package/src/components/conversation/message_form.tsx +2 -2
  31. package/src/components/conversation/message_reaction.tsx +4 -4
  32. package/src/components/display/toggle_button.tsx +5 -9
  33. package/src/hooks/index.ts +1 -2
  34. package/src/hooks/use_interaction_ghost_color.ts +15 -0
  35. package/src/hooks/use_rest_away_from_dismiss_edge.ts +0 -4
  36. package/src/screens/design_system_screen.tsx +3 -3
  37. package/src/utils/theme.ts +0 -28
  38. package/build/hooks/use_interaction_tinted_background_color.d.ts +0 -6
  39. package/build/hooks/use_interaction_tinted_background_color.d.ts.map +0 -1
  40. package/build/hooks/use_interaction_tinted_background_color.js +0 -15
  41. package/build/hooks/use_interaction_tinted_background_color.js.map +0 -1
  42. package/build/hooks/use_selected_chip_background_color.d.ts +0 -7
  43. package/build/hooks/use_selected_chip_background_color.d.ts.map +0 -1
  44. package/build/hooks/use_selected_chip_background_color.js +0 -16
  45. package/build/hooks/use_selected_chip_background_color.js.map +0 -1
  46. package/src/__tests__/hooks/use_interaction_tinted_background_color.test.tsx +0 -67
  47. package/src/__tests__/hooks/use_selected_chip_background_color.test.tsx +0 -78
  48. package/src/components/display/__tests__/toggle_button.test.tsx +0 -135
  49. package/src/hooks/use_interaction_tinted_background_color.ts +0 -20
  50. package/src/hooks/use_selected_chip_background_color.ts +0 -21
@@ -1,135 +0,0 @@
1
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
2
- import { render } from '@testing-library/react-native'
3
- import React from 'react'
4
- import { buildTestQueryClient } from '../../../__utils__/query_client'
5
- import { ChatProvider, CreateChatThemeProps } from '../../../contexts/chat_context'
6
- import { ToggleButton } from '../toggle_button'
7
-
8
- let themeProps: CreateChatThemeProps
9
- let queryClient: QueryClient
10
-
11
- beforeEach(() => {
12
- queryClient = buildTestQueryClient({
13
- defaultOptions: {
14
- queries: {
15
- refetchInterval: false,
16
- refetchOnWindowFocus: false,
17
- refetchOnReconnect: false,
18
- },
19
- },
20
- })
21
- })
22
-
23
- afterEach(() => {
24
- queryClient.clear()
25
- queryClient.cancelQueries()
26
- queryClient.removeQueries()
27
- })
28
-
29
- const Wrapper = ({ children }: { children: React.ReactNode }) => {
30
- return (
31
- <QueryClientProvider client={queryClient}>
32
- <ChatProvider
33
- value={{
34
- token: {
35
- access_token: '',
36
- created_at: 0,
37
- expires_in: 0,
38
- scope: '',
39
- refresh_token: '',
40
- token_type: '',
41
- },
42
- onUnauthorizedResponse: () => {},
43
- theme: themeProps,
44
- }}
45
- >
46
- {children}
47
- </ChatProvider>
48
- </QueryClientProvider>
49
- )
50
- }
51
-
52
- const renderToggleButton = (active: boolean) => {
53
- const view = render(<ToggleButton active={active} accessibilityLabel="Filter" title="Filter" />, {
54
- wrapper: Wrapper,
55
- })
56
-
57
- return {
58
- button: view.getByLabelText('Filter'),
59
- text: view.getByText('Filter'),
60
- }
61
- }
62
-
63
- describe('ToggleButton chip colors', () => {
64
- describe('backward compatibility (Services / sandbox pass only colors.interaction)', () => {
65
- const distinctiveGreen = 'rgb(0, 255, 0)'
66
-
67
- beforeEach(() => {
68
- themeProps = {
69
- theme: {
70
- colors: {
71
- interaction: distinctiveGreen,
72
- },
73
- },
74
- }
75
- })
76
-
77
- test('active state derives border, fill, and text color from colors.interaction', () => {
78
- const { button, text } = renderToggleButton(true)
79
-
80
- expect(button).toHaveStyle({ borderColor: distinctiveGreen })
81
- // The active fill is the green interaction color lightened via the
82
- // chip-background hook (hsl lightness 92 in the light scheme), not
83
- // the raw interaction color — pins the hook's transform in place.
84
- expect(button).toHaveStyle({ backgroundColor: 'hsl(120, 100%, 92%)' })
85
- expect(text).toHaveStyle({ color: distinctiveGreen })
86
- })
87
-
88
- test.each([
89
- ['light', undefined, 'hsl(0, 0%, 88%)', 'hsl(0, 0%, 45%)'],
90
- ['dark', 'dark' as const, 'hsl(0, 0%, 24%)', 'hsl(0, 0%, 68%)'],
91
- ])(
92
- 'inactive state uses the static chip defaults in the %s scheme',
93
- (_label, colorScheme, borderColor, color) => {
94
- themeProps = {
95
- theme: { colors: { interaction: distinctiveGreen } },
96
- colorScheme,
97
- }
98
-
99
- const { button, text } = renderToggleButton(false)
100
-
101
- expect(button).toHaveStyle({ borderColor })
102
- expect(text).toHaveStyle({ color })
103
- }
104
- )
105
- })
106
-
107
- describe('explicit chip token overrides', () => {
108
- const explicitBorder = 'rgb(1, 2, 3)'
109
- const explicitFill = 'rgb(4, 5, 6)'
110
- const explicitText = 'rgb(7, 8, 9)'
111
-
112
- beforeEach(() => {
113
- themeProps = {
114
- theme: {
115
- colors: {
116
- interaction: 'rgb(0, 255, 0)',
117
- borderColorChipSelected: explicitBorder,
118
- fillColorChipSelected: explicitFill,
119
- textColorChipSelected: explicitText,
120
- },
121
- },
122
- }
123
- })
124
-
125
- test('active state prefers explicit chip tokens over colors.interaction', () => {
126
- const { button, text } = renderToggleButton(true)
127
-
128
- expect(button).toHaveStyle({ borderColor: explicitBorder })
129
- // fillColorChipSelected still passes through the chip-background hook's
130
- // lightness transform, so the rendered fill isn't the raw override.
131
- expect(button).toHaveStyle({ backgroundColor: 'hsl(210, 20%, 92%)' })
132
- expect(text).toHaveStyle({ color: explicitText })
133
- })
134
- })
135
- })
@@ -1,20 +0,0 @@
1
- import colorFunction from 'color'
2
- import { useMemo } from 'react'
3
- import { useTheme } from './use_theme'
4
-
5
- /**
6
- * Background color for non-chip surfaces (message bubbles, the Giphy badge)
7
- * that are tinted from `colors.interaction`. Unaffected by chip tokens.
8
- */
9
- export function useInteractionTintedBackgroundColor() {
10
- const { colors } = useTheme()
11
-
12
- return useMemo(
13
- () =>
14
- colorFunction(colors.interaction)
15
- .hsl()
16
- .lightness(colors.name === 'dark' ? 12 : 92)
17
- .string(),
18
- [colors.interaction, colors.name]
19
- )
20
- }
@@ -1,21 +0,0 @@
1
- import colorFunction from 'color'
2
- import { useMemo } from 'react'
3
- import { useTheme } from './use_theme'
4
-
5
- /**
6
- * Background color for a chip surface (filter button, reaction pill) in its
7
- * selected state. Falls back to `colors.interaction` when a consumer hasn't
8
- * supplied `colors.fillColorChipSelected`.
9
- */
10
- export function useSelectedChipBackgroundColor() {
11
- const { colors, chip } = useTheme()
12
-
13
- return useMemo(
14
- () =>
15
- colorFunction(colors.fillColorChipSelected ?? colors.interaction)
16
- .hsl()
17
- .lightness(chip.hslLightnessChipSelected)
18
- .string(),
19
- [colors.fillColorChipSelected, colors.interaction, chip.hslLightnessChipSelected]
20
- )
21
- }