@planningcenter/chat-react-native 4.8.0-rc.10 → 4.8.0-rc.12
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.
- package/build/components/conversations/app_update_banner.d.ts +2 -0
- package/build/components/conversations/app_update_banner.d.ts.map +1 -0
- package/build/components/conversations/app_update_banner.js +52 -0
- package/build/components/conversations/app_update_banner.js.map +1 -0
- package/build/components/conversations/conversation_actions.d.ts.map +1 -1
- package/build/components/conversations/conversation_actions.js +83 -47
- package/build/components/conversations/conversation_actions.js.map +1 -1
- package/build/components/conversations/swipeable_toggle_button.d.ts +5 -1
- package/build/components/conversations/swipeable_toggle_button.d.ts.map +1 -1
- package/build/components/conversations/swipeable_toggle_button.js +96 -67
- package/build/components/conversations/swipeable_toggle_button.js.map +1 -1
- package/build/components/primitive/banner_primitive.js +7 -3
- package/build/components/primitive/banner_primitive.js.map +1 -1
- package/build/screens/conversations/conversations_screen.d.ts.map +1 -1
- package/build/screens/conversations/conversations_screen.js +47 -29
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/utils/theme.js +20 -21
- package/build/utils/theme.js.map +1 -1
- package/package.json +2 -2
- package/src/components/conversations/__tests__/app_update_banner.test.tsx +27 -0
- package/src/components/conversations/__tests__/conversation_actions.test.tsx +5 -2
- package/src/components/conversations/app_update_banner.tsx +36 -0
- package/src/components/conversations/conversation_actions.tsx +47 -31
- package/src/components/conversations/swipeable_toggle_button.tsx +45 -16
- package/src/components/primitive/banner_primitive.tsx +5 -1
- package/src/screens/conversations/__tests__/conversations_screen.test.tsx +2 -3
- package/src/screens/conversations/conversations_screen.tsx +9 -1
- package/src/utils/theme.ts +20 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations_screen.js","names":["useNavigation","React","useEffect","useLayoutEffect","useRef","StyleSheet","View","Conversations","BulkConversationActionsBar","composeOptions","withRightClose","withRightText","Toast","ConversationsContextProvider","useConversationsContext","useFilterDropdownEnabled","analyticsEvents","usePublishProductAnalyticsEvent","useSearchEnabled","FilterDropdownListHeaderComponent","ListHeaderComponent","SearchListHeaderComponent","jsx","_jsx","jsxs","_jsxs","conversationsScreenOptions","title","onClose","headerTitle","headerBackVisible","onPress","ConversationsScreen","t0","$","_c","route","styles","useStyles","Header","useListHeaderComponent","conversation_index_opened","t1","Symbol","for","throwOnError","t2","params","t3","SelectModeHeader","t4","select_conversation_id","t5","SelectModeRequest","conversationId","t6","t7","t8","args","opts","children","t9","t10","container","style","navigation","selectMode","selectedIds","clearSelection","hasEnteredSelectMode","selectedCount","length","current","setOptions","text","goBack","enterSelectMode","undefined","setParams","filterDropdownEnabled","searchEnabled","create","flex","justifyContent"],"sources":["../../../src/screens/conversations/conversations_screen.tsx"],"sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { useEffect, useLayoutEffect, useRef } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { Conversations } from '../../components'\nimport { BulkConversationActionsBar } from '../../components/conversations/bulk_conversation_actions_bar'\nimport {\n composeOptions,\n withRightClose,\n withRightText,\n} from '../../components/display/platform_modal_header_buttons'\nimport { Toast } from '../../components/display/toast'\nimport {\n ConversationsContextProvider,\n useConversationsContext,\n} from '../../contexts/conversations_context'\nimport { useFilterDropdownEnabled } from '../../hooks/use_filter_dropdown_enabled'\nimport { analyticsEvents, usePublishProductAnalyticsEvent } from '../../hooks/use_product_analytics'\nimport { useSearchEnabled } from '../../hooks/use_search_enabled'\nimport { AppName } from '../../types/resources/app_name'\nimport { GraphId } from '../../types/resources/group_resource'\nimport { FilterDropdownListHeaderComponent } from './components/filter_dropdown_list_header_component'\nimport { ListHeaderComponent } from './components/list_header_component'\nimport { SearchListHeaderComponent } from './components/search_list_header_component'\n\nexport type ConversationsScreenProps = StaticScreenProps<{\n title?: string\n chat_group_graph_id?: GraphId\n group_source_app_name?: AppName\n show_direct_messages?: boolean\n show_archived?: boolean\n show_hidden?: boolean\n show_unread?: boolean\n select_conversation_id?: number\n}>\n\nexport const conversationsScreenOptions = ({\n title,\n onClose,\n}: {\n title?: string\n onClose: () => void\n}) =>\n composeOptions(\n { headerTitle: title ?? 'Chat', headerBackVisible: false },\n withRightClose({ onPress: onClose })\n )\n\nexport function ConversationsScreen({ route }: ConversationsScreenProps) {\n const styles = useStyles()\n const Header = useListHeaderComponent()\n\n usePublishProductAnalyticsEvent(analyticsEvents.conversation_index_opened)\n\n return (\n <View style={styles.container}>\n <ConversationsContextProvider args={route.params} opts={{ throwOnError: true }}>\n <SelectModeHeader title={route.params?.title} />\n <SelectModeRequest conversationId={route.params?.select_conversation_id} />\n <Conversations ListHeaderComponent={Header} />\n <BulkConversationActionsBar />\n </ConversationsContextProvider>\n <Toast />\n </View>\n )\n}\n\nfunction SelectModeHeader({ title }: { title?: string }) {\n const navigation = useNavigation()\n const { selectMode, selectedIds, clearSelection } = useConversationsContext()\n const hasEnteredSelectMode = useRef(false)\n const selectedCount = selectedIds.length\n\n useLayoutEffect(() => {\n if (selectMode) hasEnteredSelectMode.current = true\n if (!hasEnteredSelectMode.current) return\n\n navigation.setOptions(\n selectMode\n ? composeOptions(\n {\n headerTitle: selectedCount > 0 ? `${selectedCount} selected` : 'Select conversations',\n },\n withRightText({ text: 'Cancel', onPress: clearSelection })\n )\n : conversationsScreenOptions({ title, onClose: navigation.goBack })\n )\n }, [navigation, selectMode, selectedCount, clearSelection, title])\n\n return null\n}\n\nfunction SelectModeRequest({ conversationId }: { conversationId?: number }) {\n const navigation = useNavigation()\n const { enterSelectMode } = useConversationsContext()\n\n useEffect(() => {\n if (conversationId === undefined) return\n\n enterSelectMode(conversationId)\n navigation.setParams({ select_conversation_id: undefined })\n }, [conversationId, enterSelectMode, navigation])\n\n return null\n}\n\nconst useListHeaderComponent = () => {\n const filterDropdownEnabled = useFilterDropdownEnabled()\n const searchEnabled = useSearchEnabled()\n\n if (filterDropdownEnabled) return FilterDropdownListHeaderComponent\n if (searchEnabled) return SearchListHeaderComponent\n\n return ListHeaderComponent\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n },\n })\n}\n"],"mappings":";AAAA,SAA4BA,aAAa,QAAQ,0BAA0B;AAC3E,OAAOC,KAAK,IAAIC,SAAS,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AACjE,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,0BAA0B,QAAQ,8DAA8D;AACzG,SACEC,cAAc,EACdC,cAAc,EACdC,aAAa,QACR,wDAAwD;AAC/D,SAASC,KAAK,QAAQ,gCAAgC;AACtD,SACEC,4BAA4B,EAC5BC,uBAAuB,QAClB,sCAAsC;AAC7C,SAASC,wBAAwB,QAAQ,yCAAyC;AAClF,SAASC,eAAe,EAAEC,+BAA+B,QAAQ,mCAAmC;AACpG,SAASC,gBAAgB,QAAQ,gCAAgC;AAGjE,SAASC,iCAAiC,QAAQ,oDAAoD;AACtG,SAASC,mBAAmB,QAAQ,oCAAoC;AACxE,SAASC,yBAAyB,QAAQ,2CAA2C;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAarF,OAAO,MAAMC,0BAA0B,GAAGA,CAAC;EACzCC,KAAK;EACLC;AAIF,CAAC,KACCnB,cAAc,CACZ;EAAEoB,WAAW,EAAEF,KAAK,IAAI,MAAM;EAAEG,iBAAiB,EAAE;AAAM,CAAC,EAC1DpB,cAAc,CAAC;EAAEqB,OAAO,EAAEH;AAAQ,CAAC,CACrC,CAAC;AAEH,OAAO,SAAAI,oBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAA6B;IAAAC;EAAA,IAAAH,EAAmC;EACrE,MAAAI,MAAA,GAAeC,SAAS,CAAC,CAAC;EAC1B,MAAAC,MAAA,GAAeC,sBAAsB,CAAC,CAAC;EAEvCvB,+BAA+B,CAACD,eAAe,CAAAyB,yBAA0B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AmB;AAAA,CAC3B;AAED,MAAMkB,SAAS,GAAGA,CAAA,KAAM;EACtB,OAAOjC,UAAU,CAAC4E,MAAM,CAAC;IACvBlB,SAAS,EAAE;MACTmB,IAAI,EAAE,CAAC;MACPC,cAAc,EAAE;IAClB;EACF,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"conversations_screen.js","names":["useNavigation","React","useEffect","useLayoutEffect","useRef","StyleSheet","View","Conversations","AppUpdateBanner","BulkConversationActionsBar","composeOptions","withRightClose","withRightText","Toast","ConversationsContextProvider","useConversationsContext","useFilterDropdownEnabled","analyticsEvents","usePublishProductAnalyticsEvent","useSearchEnabled","FilterDropdownListHeaderComponent","ListHeaderComponent","SearchListHeaderComponent","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","conversationsScreenOptions","title","onClose","headerTitle","headerBackVisible","onPress","ConversationsScreen","t0","$","_c","route","styles","useStyles","Header","useListHeaderComponent","conversation_index_opened","t1","Symbol","for","throwOnError","t2","params","t3","SelectModeHeader","t4","select_conversation_id","t5","SelectModeRequest","conversationId","t6","t7","t8","children","t9","t10","args","opts","t11","t12","container","style","navigation","selectMode","selectedIds","clearSelection","hasEnteredSelectMode","selectedCount","length","current","setOptions","text","goBack","enterSelectMode","undefined","setParams","filterDropdownEnabled","searchEnabled","create","flex","justifyContent"],"sources":["../../../src/screens/conversations/conversations_screen.tsx"],"sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, { useEffect, useLayoutEffect, useRef } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { Conversations } from '../../components'\nimport { AppUpdateBanner } from '../../components/conversations/app_update_banner'\nimport { BulkConversationActionsBar } from '../../components/conversations/bulk_conversation_actions_bar'\nimport {\n composeOptions,\n withRightClose,\n withRightText,\n} from '../../components/display/platform_modal_header_buttons'\nimport { Toast } from '../../components/display/toast'\nimport {\n ConversationsContextProvider,\n useConversationsContext,\n} from '../../contexts/conversations_context'\nimport { useFilterDropdownEnabled } from '../../hooks/use_filter_dropdown_enabled'\nimport { analyticsEvents, usePublishProductAnalyticsEvent } from '../../hooks/use_product_analytics'\nimport { useSearchEnabled } from '../../hooks/use_search_enabled'\nimport { AppName } from '../../types/resources/app_name'\nimport { GraphId } from '../../types/resources/group_resource'\nimport { FilterDropdownListHeaderComponent } from './components/filter_dropdown_list_header_component'\nimport { ListHeaderComponent } from './components/list_header_component'\nimport { SearchListHeaderComponent } from './components/search_list_header_component'\n\nexport type ConversationsScreenProps = StaticScreenProps<{\n title?: string\n chat_group_graph_id?: GraphId\n group_source_app_name?: AppName\n show_direct_messages?: boolean\n show_archived?: boolean\n show_hidden?: boolean\n show_unread?: boolean\n select_conversation_id?: number\n}>\n\nexport const conversationsScreenOptions = ({\n title,\n onClose,\n}: {\n title?: string\n onClose: () => void\n}) =>\n composeOptions(\n { headerTitle: title ?? 'Chat', headerBackVisible: false },\n withRightClose({ onPress: onClose })\n )\n\nexport function ConversationsScreen({ route }: ConversationsScreenProps) {\n const styles = useStyles()\n const Header = useListHeaderComponent()\n\n usePublishProductAnalyticsEvent(analyticsEvents.conversation_index_opened)\n\n return (\n <View style={styles.container}>\n <ConversationsContextProvider args={route.params} opts={{ throwOnError: true }}>\n <SelectModeHeader title={route.params?.title} />\n <SelectModeRequest conversationId={route.params?.select_conversation_id} />\n <Conversations\n ListHeaderComponent={\n <>\n <Header />\n <AppUpdateBanner />\n </>\n }\n />\n <BulkConversationActionsBar />\n </ConversationsContextProvider>\n <Toast />\n </View>\n )\n}\n\nfunction SelectModeHeader({ title }: { title?: string }) {\n const navigation = useNavigation()\n const { selectMode, selectedIds, clearSelection } = useConversationsContext()\n const hasEnteredSelectMode = useRef(false)\n const selectedCount = selectedIds.length\n\n useLayoutEffect(() => {\n if (selectMode) hasEnteredSelectMode.current = true\n if (!hasEnteredSelectMode.current) return\n\n navigation.setOptions(\n selectMode\n ? composeOptions(\n {\n headerTitle: selectedCount > 0 ? `${selectedCount} selected` : 'Select conversations',\n },\n withRightText({ text: 'Cancel', onPress: clearSelection })\n )\n : conversationsScreenOptions({ title, onClose: navigation.goBack })\n )\n }, [navigation, selectMode, selectedCount, clearSelection, title])\n\n return null\n}\n\nfunction SelectModeRequest({ conversationId }: { conversationId?: number }) {\n const navigation = useNavigation()\n const { enterSelectMode } = useConversationsContext()\n\n useEffect(() => {\n if (conversationId === undefined) return\n\n enterSelectMode(conversationId)\n navigation.setParams({ select_conversation_id: undefined })\n }, [conversationId, enterSelectMode, navigation])\n\n return null\n}\n\nconst useListHeaderComponent = () => {\n const filterDropdownEnabled = useFilterDropdownEnabled()\n const searchEnabled = useSearchEnabled()\n\n if (filterDropdownEnabled) return FilterDropdownListHeaderComponent\n if (searchEnabled) return SearchListHeaderComponent\n\n return ListHeaderComponent\n}\n\nconst useStyles = () => {\n return StyleSheet.create({\n container: {\n flex: 1,\n justifyContent: 'center',\n },\n })\n}\n"],"mappings":";AAAA,SAA4BA,aAAa,QAAQ,0BAA0B;AAC3E,OAAOC,KAAK,IAAIC,SAAS,EAAEC,eAAe,EAAEC,MAAM,QAAQ,OAAO;AACjE,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,eAAe,QAAQ,kDAAkD;AAClF,SAASC,0BAA0B,QAAQ,8DAA8D;AACzG,SACEC,cAAc,EACdC,cAAc,EACdC,aAAa,QACR,wDAAwD;AAC/D,SAASC,KAAK,QAAQ,gCAAgC;AACtD,SACEC,4BAA4B,EAC5BC,uBAAuB,QAClB,sCAAsC;AAC7C,SAASC,wBAAwB,QAAQ,yCAAyC;AAClF,SAASC,eAAe,EAAEC,+BAA+B,QAAQ,mCAAmC;AACpG,SAASC,gBAAgB,QAAQ,gCAAgC;AAGjE,SAASC,iCAAiC,QAAQ,oDAAoD;AACtG,SAASC,mBAAmB,QAAQ,oCAAoC;AACxE,SAASC,yBAAyB,QAAQ,2CAA2C;AAAA,SAAAC,GAAA,I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@ -63,20 +63,20 @@ const colorsChatLight = {
|
|
|
63
63
|
statusErrorText: tokens.textColorStatusError,
|
|
64
64
|
statusErrorBorder: tokens.borderColorStatusError,
|
|
65
65
|
statusErrorFill: tokens.fillColorStatusErrorSolid,
|
|
66
|
-
statusInfoComposedIcon: tokens.
|
|
67
|
-
statusInfoComposedText: tokens.
|
|
66
|
+
statusInfoComposedIcon: tokens.textColorStatusInfo,
|
|
67
|
+
statusInfoComposedText: tokens.colorNeutral24,
|
|
68
68
|
statusInfoComposedBackground: tokens.fillColorStatusInfoGhost,
|
|
69
|
-
statusSuccessComposedIcon: tokens.
|
|
70
|
-
statusSuccessComposedText: tokens.
|
|
69
|
+
statusSuccessComposedIcon: tokens.textColorStatusSuccess,
|
|
70
|
+
statusSuccessComposedText: tokens.colorNeutral24,
|
|
71
71
|
statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhost,
|
|
72
|
-
statusWarningComposedIcon: tokens.
|
|
73
|
-
statusWarningComposedText: tokens.
|
|
72
|
+
statusWarningComposedIcon: tokens.textColorStatusWarning,
|
|
73
|
+
statusWarningComposedText: tokens.colorNeutral24,
|
|
74
74
|
statusWarningComposedBackground: tokens.fillColorStatusWarningGhost,
|
|
75
|
-
statusErrorComposedIcon: tokens.
|
|
76
|
-
statusErrorComposedText: tokens.
|
|
75
|
+
statusErrorComposedIcon: tokens.textColorStatusError,
|
|
76
|
+
statusErrorComposedText: tokens.colorNeutral24,
|
|
77
77
|
statusErrorComposedBackground: tokens.fillColorStatusErrorGhost,
|
|
78
|
-
statusNeutralComposedIcon: tokens.
|
|
79
|
-
statusNeutralComposedText: tokens.
|
|
78
|
+
statusNeutralComposedIcon: tokens.textColorStatusNeutral,
|
|
79
|
+
statusNeutralComposedText: tokens.colorNeutral24,
|
|
80
80
|
statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhost,
|
|
81
81
|
borderColorChip: tokens.colorNeutral88,
|
|
82
82
|
fillColorChip: 'transparent',
|
|
@@ -108,21 +108,20 @@ const colorsChatDark = {
|
|
|
108
108
|
statusErrorText: tokens.textColorStatusErrorDark,
|
|
109
109
|
statusErrorBorder: tokens.borderColorStatusErrorDark,
|
|
110
110
|
statusErrorFill: tokens.fillColorStatusErrorSolidDark,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
statusInfoComposedText: tokens.textColorStatusInfoDark,
|
|
111
|
+
statusInfoComposedIcon: tokens.textColorStatusInfoDark,
|
|
112
|
+
statusInfoComposedText: tokens.colorNeutral88,
|
|
114
113
|
statusInfoComposedBackground: tokens.fillColorStatusInfoGhostDark,
|
|
115
|
-
statusSuccessComposedIcon: tokens.
|
|
116
|
-
statusSuccessComposedText: tokens.
|
|
114
|
+
statusSuccessComposedIcon: tokens.textColorStatusSuccessDark,
|
|
115
|
+
statusSuccessComposedText: tokens.colorNeutral88,
|
|
117
116
|
statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhostDark,
|
|
118
|
-
statusWarningComposedIcon: tokens.
|
|
119
|
-
statusWarningComposedText: tokens.
|
|
117
|
+
statusWarningComposedIcon: tokens.textColorStatusWarningDark,
|
|
118
|
+
statusWarningComposedText: tokens.colorNeutral88,
|
|
120
119
|
statusWarningComposedBackground: tokens.fillColorStatusWarningGhostDark,
|
|
121
|
-
statusErrorComposedIcon: tokens.
|
|
122
|
-
statusErrorComposedText: tokens.
|
|
120
|
+
statusErrorComposedIcon: tokens.textColorStatusErrorDark,
|
|
121
|
+
statusErrorComposedText: tokens.colorNeutral88,
|
|
123
122
|
statusErrorComposedBackground: tokens.fillColorStatusErrorGhostDark,
|
|
124
|
-
statusNeutralComposedIcon: tokens.
|
|
125
|
-
statusNeutralComposedText: tokens.
|
|
123
|
+
statusNeutralComposedIcon: tokens.textColorStatusNeutralDark,
|
|
124
|
+
statusNeutralComposedText: tokens.colorNeutral88,
|
|
126
125
|
statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhostDark,
|
|
127
126
|
borderColorChip: tokens.colorNeutral24,
|
|
128
127
|
fillColorChip: 'transparent',
|
package/build/utils/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","names":["Platform","PlatformColor","aliasTokensColorMap","tokens","defaultTheme","colorScheme","scheme","defaultColors","chatThemeColorMap","colors","button","borderRadius","chip","hslLightnessChipSelected","showBadgeProductLogo","iOSLinkColor","OS","undefined","colorsChatLight","name","androidModalHeaderButtonTextColor","fillColorInteractionDefault","iOSModalHeaderButtonTextColor","buttonStart","buttonEnd","interaction","androidSwitchThumbColor","conversationActionsBackground","colorNeutral100White","testColor","statusInfoIcon","iconColorStatusInfoPrimary","statusInfoText","textColorStatusInfo","statusInfoBorder","borderColorStatusInfo","statusInfoFill","fillColorStatusInfoSolid","statusSuccessIcon","iconColorStatusSuccessPrimary","statusSuccessText","textColorStatusSuccess","statusSuccessBorder","borderColorStatusSuccess","statusSuccessFill","fillColorStatusSuccessSolid","statusWarningIcon","iconColorStatusWarningPrimary","statusWarningText","textColorStatusWarning","statusWarningBorder","borderColorStatusWarning","statusWarningFill","fillColorStatusWarningSolid","statusErrorIcon","iconColorStatusErrorPrimary","statusErrorText","textColorStatusError","statusErrorBorder","borderColorStatusError","statusErrorFill","fillColorStatusErrorSolid","statusInfoComposedIcon","statusInfoComposedText","statusInfoComposedBackground","fillColorStatusInfoGhost","statusSuccessComposedIcon","statusSuccessComposedText","statusSuccessComposedBackground","fillColorStatusSuccessGhost","statusWarningComposedIcon","statusWarningComposedText","statusWarningComposedBackground","fillColorStatusWarningGhost","statusErrorComposedIcon","statusErrorComposedText","statusErrorComposedBackground","fillColorStatusErrorGhost","statusNeutralComposedIcon","iconColorStatusNeutralPrimary","statusNeutralComposedText","textColorStatusNeutral","statusNeutralComposedBackground","fillColorStatusNeutralGhost","borderColorChip","colorNeutral88","fillColorChip","textColorChip","colorNeutral45","colorsChatDark","fillColorInteractionDefaultDark","colorNeutral7","iconColorStatusInfoPrimaryDark","textColorStatusInfoDark","borderColorStatusInfoDark","fillColorStatusInfoSolidDark","iconColorStatusSuccessPrimaryDark","textColorStatusSuccessDark","borderColorStatusSuccessDark","fillColorStatusSuccessSolidDark","iconColorStatusWarningPrimaryDark","textColorStatusWarningDark","borderColorStatusWarningDark","fillColorStatusWarningSolidDark","iconColorStatusErrorPrimaryDark","textColorStatusErrorDark","borderColorStatusErrorDark","fillColorStatusErrorSolidDark","fillColorStatusInfoGhostDark","fillColorStatusSuccessGhostDark","fillColorStatusWarningGhostDark","fillColorStatusErrorGhostDark","iconColorStatusNeutralPrimaryDark","textColorStatusNeutralDark","fillColorStatusNeutralGhostDark","colorNeutral24","colorNeutral68","light","dark"],"sources":["../../src/utils/theme.ts"],"sourcesContent":["import { Platform, PlatformColor } from 'react-native'\nimport type { ColorSchemeName, ColorValue, OpaqueColorValue } from 'react-native'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n chip: {\n hslLightnessChipSelected: number\n }\n showBadgeProductLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName | null): ChatTheme => {\n const scheme: 'light' | 'dark' = colorScheme === 'dark' ? 'dark' : 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n chip: {\n hslLightnessChipSelected: scheme === 'dark' ? 12 : 92,\n },\n showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n androidModalHeaderButtonTextColor: ColorValue | string | undefined\n iOSModalHeaderButtonTextColor: OpaqueColorValue | string | undefined\n androidSwitchThumbColor: string | undefined\n conversationActionsBackground: string\n testColor: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBorder: string\n statusSuccessFill: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBorder: string\n statusInfoFill: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBorder: string\n statusWarningFill: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBorder: string\n statusErrorFill: string\n statusSuccessComposedIcon: string\n statusSuccessComposedText: string\n statusSuccessComposedBackground: string\n statusInfoComposedIcon: string\n statusInfoComposedText: string\n statusInfoComposedBackground: string\n statusWarningComposedIcon: string\n statusWarningComposedText: string\n statusWarningComposedBackground: string\n statusErrorComposedIcon: string\n statusErrorComposedText: string\n statusErrorComposedBackground: string\n statusNeutralComposedIcon: string\n statusNeutralComposedText: string\n statusNeutralComposedBackground: string\n borderColorChip: string\n fillColorChip: string\n textColorChip: string\n /**\n * Selected-chip colors (border/fill/text). Never assign a static default\n * directly — these stay optional so they always fall back to\n * `colors.interaction` via `??` at the read site. Every current consumer\n * overrides `interaction` at runtime, and a seeded default here could win\n * over that override depending on merge order.\n */\n borderColorChipSelected?: string\n fillColorChipSelected?: string\n textColorChipSelected?: string\n}\n\n// 'link' is an iOS-only semantic color name — constructing it on Android is\n// undefined behavior, so only build it when the code is actually running on iOS\nconst iOSLinkColor = Platform.OS === 'ios' ? PlatformColor('link') : undefined\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefault,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral100White,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBorder: tokens.borderColorStatusInfo,\n statusInfoFill: tokens.fillColorStatusInfoSolid,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBorder: tokens.borderColorStatusSuccess,\n statusSuccessFill: tokens.fillColorStatusSuccessSolid,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBorder: tokens.borderColorStatusWarning,\n statusWarningFill: tokens.fillColorStatusWarningSolid,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBorder: tokens.borderColorStatusError,\n statusErrorFill: tokens.fillColorStatusErrorSolid,\n statusInfoComposedIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoComposedText: tokens.textColorStatusInfo,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessComposedIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessComposedText: tokens.textColorStatusSuccess,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningComposedIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningComposedText: tokens.textColorStatusWarning,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhost,\n statusErrorComposedIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorComposedText: tokens.textColorStatusError,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralComposedIcon: tokens.iconColorStatusNeutralPrimary,\n statusNeutralComposedText: tokens.textColorStatusNeutral,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhost,\n borderColorChip: tokens.colorNeutral88,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral45,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefaultDark,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral7,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBorder: tokens.borderColorStatusInfoDark,\n statusInfoFill: tokens.fillColorStatusInfoSolidDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBorder: tokens.borderColorStatusSuccessDark,\n statusSuccessFill: tokens.fillColorStatusSuccessSolidDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBorder: tokens.borderColorStatusWarningDark,\n statusWarningFill: tokens.fillColorStatusWarningSolidDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBorder: tokens.borderColorStatusErrorDark,\n statusErrorFill: tokens.fillColorStatusErrorSolidDark,\n\n // Note: CCA inverts composed status colors in dark mode\n statusInfoComposedIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoComposedText: tokens.textColorStatusInfoDark,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessComposedIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessComposedText: tokens.textColorStatusSuccessDark,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningComposedIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningComposedText: tokens.textColorStatusWarningDark,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorComposedIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorComposedText: tokens.textColorStatusErrorDark,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralComposedIcon: tokens.iconColorStatusNeutralPrimaryDark,\n statusNeutralComposedText: tokens.textColorStatusNeutralDark,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorChip: tokens.colorNeutral24,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral68,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AAEtD,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,SAASC,MAAM,QAAQ,2BAA2B;;AAOlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,MAAMC,YAAY,GAAIC,WAAmC,IAAgB;EAC9E,MAAMC,MAAwB,GAAGD,WAAW,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;EAE1E,MAAME,aAAa,GAAG;IACpB,GAAGC,iBAAiB,CAACF,MAAM,CAAC;IAC5B,GAAGJ,mBAAmB,CAACI,MAAM;EAC/B,CAAC;EAED,OAAO;IACLG,MAAM,EAAEF,aAAa;IACrBG,MAAM,EAAE;MACNC,YAAY,EAAE;IAChB,CAAC;IACDC,IAAI,EAAE;MACJC,wBAAwB,EAAEP,MAAM,KAAK,MAAM,GAAG,EAAE,GAAG;IACrD,CAAC;IACDQ,oBAAoB,EAAE,IAAI,CAAE;EAC9B,CAAC;AACH,CAAC;AA4DD;AACA;AACA,MAAMC,YAAY,GAAGf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAGf,aAAa,CAAC,MAAM,CAAC,GAAGgB,SAAS;AAE9E,MAAMC,eAA2B,GAAG;EAClCC,IAAI,EAAE,OA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AAa,EAAEpF,MAAM,CAACiH;AACxB,CAAC;AAED,MAAM5G,iBAAiB,GAAG;EACxB6G,KAAK,EAAEnG,eAAe;EACtBoG,IAAI,EAAE7B;AACR,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"theme.js","names":["Platform","PlatformColor","aliasTokensColorMap","tokens","defaultTheme","colorScheme","scheme","defaultColors","chatThemeColorMap","colors","button","borderRadius","chip","hslLightnessChipSelected","showBadgeProductLogo","iOSLinkColor","OS","undefined","colorsChatLight","name","androidModalHeaderButtonTextColor","fillColorInteractionDefault","iOSModalHeaderButtonTextColor","buttonStart","buttonEnd","interaction","androidSwitchThumbColor","conversationActionsBackground","colorNeutral100White","testColor","statusInfoIcon","iconColorStatusInfoPrimary","statusInfoText","textColorStatusInfo","statusInfoBorder","borderColorStatusInfo","statusInfoFill","fillColorStatusInfoSolid","statusSuccessIcon","iconColorStatusSuccessPrimary","statusSuccessText","textColorStatusSuccess","statusSuccessBorder","borderColorStatusSuccess","statusSuccessFill","fillColorStatusSuccessSolid","statusWarningIcon","iconColorStatusWarningPrimary","statusWarningText","textColorStatusWarning","statusWarningBorder","borderColorStatusWarning","statusWarningFill","fillColorStatusWarningSolid","statusErrorIcon","iconColorStatusErrorPrimary","statusErrorText","textColorStatusError","statusErrorBorder","borderColorStatusError","statusErrorFill","fillColorStatusErrorSolid","statusInfoComposedIcon","statusInfoComposedText","colorNeutral24","statusInfoComposedBackground","fillColorStatusInfoGhost","statusSuccessComposedIcon","statusSuccessComposedText","statusSuccessComposedBackground","fillColorStatusSuccessGhost","statusWarningComposedIcon","statusWarningComposedText","statusWarningComposedBackground","fillColorStatusWarningGhost","statusErrorComposedIcon","statusErrorComposedText","statusErrorComposedBackground","fillColorStatusErrorGhost","statusNeutralComposedIcon","textColorStatusNeutral","statusNeutralComposedText","statusNeutralComposedBackground","fillColorStatusNeutralGhost","borderColorChip","colorNeutral88","fillColorChip","textColorChip","colorNeutral45","colorsChatDark","fillColorInteractionDefaultDark","colorNeutral7","iconColorStatusInfoPrimaryDark","textColorStatusInfoDark","borderColorStatusInfoDark","fillColorStatusInfoSolidDark","iconColorStatusSuccessPrimaryDark","textColorStatusSuccessDark","borderColorStatusSuccessDark","fillColorStatusSuccessSolidDark","iconColorStatusWarningPrimaryDark","textColorStatusWarningDark","borderColorStatusWarningDark","fillColorStatusWarningSolidDark","iconColorStatusErrorPrimaryDark","textColorStatusErrorDark","borderColorStatusErrorDark","fillColorStatusErrorSolidDark","fillColorStatusInfoGhostDark","fillColorStatusSuccessGhostDark","fillColorStatusWarningGhostDark","fillColorStatusErrorGhostDark","textColorStatusNeutralDark","fillColorStatusNeutralGhostDark","colorNeutral68","light","dark"],"sources":["../../src/utils/theme.ts"],"sourcesContent":["import { Platform, PlatformColor } from 'react-native'\nimport type { ColorSchemeName, ColorValue, OpaqueColorValue } from 'react-native'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n chip: {\n hslLightnessChipSelected: number\n }\n showBadgeProductLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName | null): ChatTheme => {\n const scheme: 'light' | 'dark' = colorScheme === 'dark' ? 'dark' : 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n chip: {\n hslLightnessChipSelected: scheme === 'dark' ? 12 : 92,\n },\n showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n androidModalHeaderButtonTextColor: ColorValue | string | undefined\n iOSModalHeaderButtonTextColor: OpaqueColorValue | string | undefined\n androidSwitchThumbColor: string | undefined\n conversationActionsBackground: string\n testColor: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBorder: string\n statusSuccessFill: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBorder: string\n statusInfoFill: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBorder: string\n statusWarningFill: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBorder: string\n statusErrorFill: string\n statusSuccessComposedIcon: string\n statusSuccessComposedText: string\n statusSuccessComposedBackground: string\n statusInfoComposedIcon: string\n statusInfoComposedText: string\n statusInfoComposedBackground: string\n statusWarningComposedIcon: string\n statusWarningComposedText: string\n statusWarningComposedBackground: string\n statusErrorComposedIcon: string\n statusErrorComposedText: string\n statusErrorComposedBackground: string\n statusNeutralComposedIcon: string\n statusNeutralComposedText: string\n statusNeutralComposedBackground: string\n borderColorChip: string\n fillColorChip: string\n textColorChip: string\n /**\n * Selected-chip colors (border/fill/text). Never assign a static default\n * directly — these stay optional so they always fall back to\n * `colors.interaction` via `??` at the read site. Every current consumer\n * overrides `interaction` at runtime, and a seeded default here could win\n * over that override depending on merge order.\n */\n borderColorChipSelected?: string\n fillColorChipSelected?: string\n textColorChipSelected?: string\n}\n\n// 'link' is an iOS-only semantic color name — constructing it on Android is\n// undefined behavior, so only build it when the code is actually running on iOS\nconst iOSLinkColor = Platform.OS === 'ios' ? PlatformColor('link') : undefined\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefault,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral100White,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBorder: tokens.borderColorStatusInfo,\n statusInfoFill: tokens.fillColorStatusInfoSolid,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBorder: tokens.borderColorStatusSuccess,\n statusSuccessFill: tokens.fillColorStatusSuccessSolid,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBorder: tokens.borderColorStatusWarning,\n statusWarningFill: tokens.fillColorStatusWarningSolid,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBorder: tokens.borderColorStatusError,\n statusErrorFill: tokens.fillColorStatusErrorSolid,\n statusInfoComposedIcon: tokens.textColorStatusInfo,\n statusInfoComposedText: tokens.colorNeutral24,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessComposedIcon: tokens.textColorStatusSuccess,\n statusSuccessComposedText: tokens.colorNeutral24,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningComposedIcon: tokens.textColorStatusWarning,\n statusWarningComposedText: tokens.colorNeutral24,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhost,\n statusErrorComposedIcon: tokens.textColorStatusError,\n statusErrorComposedText: tokens.colorNeutral24,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralComposedIcon: tokens.textColorStatusNeutral,\n statusNeutralComposedText: tokens.colorNeutral24,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhost,\n borderColorChip: tokens.colorNeutral88,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral45,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n androidModalHeaderButtonTextColor: tokens.fillColorInteractionDefaultDark,\n iOSModalHeaderButtonTextColor: iOSLinkColor,\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n androidSwitchThumbColor: undefined,\n conversationActionsBackground: tokens.colorNeutral7,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBorder: tokens.borderColorStatusInfoDark,\n statusInfoFill: tokens.fillColorStatusInfoSolidDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBorder: tokens.borderColorStatusSuccessDark,\n statusSuccessFill: tokens.fillColorStatusSuccessSolidDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBorder: tokens.borderColorStatusWarningDark,\n statusWarningFill: tokens.fillColorStatusWarningSolidDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBorder: tokens.borderColorStatusErrorDark,\n statusErrorFill: tokens.fillColorStatusErrorSolidDark,\n\n statusInfoComposedIcon: tokens.textColorStatusInfoDark,\n statusInfoComposedText: tokens.colorNeutral88,\n statusInfoComposedBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessComposedIcon: tokens.textColorStatusSuccessDark,\n statusSuccessComposedText: tokens.colorNeutral88,\n statusSuccessComposedBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningComposedIcon: tokens.textColorStatusWarningDark,\n statusWarningComposedText: tokens.colorNeutral88,\n statusWarningComposedBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorComposedIcon: tokens.textColorStatusErrorDark,\n statusErrorComposedText: tokens.colorNeutral88,\n statusErrorComposedBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralComposedIcon: tokens.textColorStatusNeutralDark,\n statusNeutralComposedText: tokens.colorNeutral88,\n statusNeutralComposedBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorChip: tokens.colorNeutral24,\n fillColorChip: 'transparent',\n textColorChip: tokens.colorNeutral68,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AAEtD,SAASC,mBAAmB,QAAQ,2CAA2C;AAC/E,SAASC,MAAM,QAAQ,2BAA2B;;AAOlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAO,MAAMC,YAAY,GAAIC,WAAmC,IAAgB;EAC9E,MAAMC,MAAwB,GAAGD,WAAW,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO;EAE1E,MAAME,aAAa,GAAG;IACpB,GAAGC,iBAAiB,CAACF,MAAM,CAAC;IAC5B,GAAGJ,mBAAmB,CAACI,MAAM;EAC/B,CAAC;EAED,OAAO;IACLG,MAAM,EAAEF,aAAa;IACrBG,MAAM,EAAE;MACNC,YAAY,EAAE;IAChB,CAAC;IACDC,IAAI,EAAE;MACJC,wBAAwB,EAAEP,MAAM,KAAK,MAAM,GAAG,EAAE,GAAG;IACrD,CAAC;IACDQ,oBAAoB,EAAE,IAAI,CAAE;EAC9B,CAAC;AACH,CAAC;AA4DD;AACA;AACA,MAAMC,YAAY,GAAGf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAGf,aAAa,CAAC,MAAM,CAAC,GAAGgB,SAAS;AAE9E,MAAMC,eAA2B,GAAG;EAClCC,IAAI,EAAE,OAAO;EACbC,iCAAiC,EAAEjB,MAAM,CAACkB,2BAA2B;EACrEC,6BAA6B,EAAEP,YAAY;EAC3CQ,WAAW,EA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oreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "4.8.0-rc.
|
|
3
|
+
"version": "4.8.0-rc.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"sf-symbols-typescript": "^2.2.0",
|
|
85
85
|
"typescript": "~6.0.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "ea83ef4187974d52daf67ae6f7778129cbc94caa"
|
|
88
88
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Updates, UpdatesAdapter } from '../../../utils/native_adapters'
|
|
4
|
+
import { AppUpdateBanner } from '../app_update_banner'
|
|
5
|
+
|
|
6
|
+
jest.mock('../../../utils/native_adapters', () => ({
|
|
7
|
+
...jest.requireActual('../../../utils/native_adapters'),
|
|
8
|
+
Updates: { useDownloadedUpdateId: jest.fn(), restart: jest.fn() },
|
|
9
|
+
}))
|
|
10
|
+
|
|
11
|
+
const mockUpdates = Updates as jest.Mocked<UpdatesAdapter>
|
|
12
|
+
|
|
13
|
+
describe('AppUpdateBanner', () => {
|
|
14
|
+
it('stays hidden until an update has downloaded', () => {
|
|
15
|
+
mockUpdates.useDownloadedUpdateId.mockReturnValue(undefined)
|
|
16
|
+
|
|
17
|
+
expect(render(<AppUpdateBanner />).queryByText('Chat update available')).toBeNull()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('reloads through the adapter', () => {
|
|
21
|
+
mockUpdates.useDownloadedUpdateId.mockReturnValue('update-1')
|
|
22
|
+
|
|
23
|
+
fireEvent.press(render(<AppUpdateBanner />).getByText('Reload'))
|
|
24
|
+
|
|
25
|
+
expect(mockUpdates.restart).toHaveBeenCalledTimes(1)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
@@ -13,10 +13,13 @@ jest.mock('react-native-gesture-handler/ReanimatedSwipeable', () => {
|
|
|
13
13
|
renderLeftActions,
|
|
14
14
|
}: {
|
|
15
15
|
children: React.ReactNode
|
|
16
|
-
renderLeftActions: (
|
|
16
|
+
renderLeftActions: (
|
|
17
|
+
progress: { value: number },
|
|
18
|
+
translation: { value: number }
|
|
19
|
+
) => React.ReactNode
|
|
17
20
|
}) => (
|
|
18
21
|
<MockView>
|
|
19
|
-
{renderLeftActions()}
|
|
22
|
+
{renderLeftActions({ value: 1 }, { value: 360 })}
|
|
20
23
|
{children}
|
|
21
24
|
</MockView>
|
|
22
25
|
),
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet, View } from 'react-native'
|
|
3
|
+
import { Updates } from '../../utils/native_adapters'
|
|
4
|
+
import { Banner } from '../display/banner'
|
|
5
|
+
import BannerPrimitive from '../primitive/banner_primitive'
|
|
6
|
+
|
|
7
|
+
export function AppUpdateBanner() {
|
|
8
|
+
const styles = useStyles()
|
|
9
|
+
const downloadedUpdateId = Updates.useDownloadedUpdateId()
|
|
10
|
+
|
|
11
|
+
if (!downloadedUpdateId) return null
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<View style={styles.container}>
|
|
15
|
+
<Banner
|
|
16
|
+
appearance="info"
|
|
17
|
+
heading="Chat update available"
|
|
18
|
+
description={
|
|
19
|
+
<BannerPrimitive.Text>
|
|
20
|
+
<BannerPrimitive.Link onPress={Updates.restart}>Reload</BannerPrimitive.Link> to get the
|
|
21
|
+
latest fixes and improvements.
|
|
22
|
+
</BannerPrimitive.Text>
|
|
23
|
+
}
|
|
24
|
+
/>
|
|
25
|
+
</View>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const useStyles = () => {
|
|
30
|
+
return StyleSheet.create({
|
|
31
|
+
container: {
|
|
32
|
+
paddingHorizontal: 16,
|
|
33
|
+
paddingVertical: 12,
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import ReanimatedSwipeable, {
|
|
13
13
|
SwipeableMethods,
|
|
14
14
|
} from 'react-native-gesture-handler/ReanimatedSwipeable'
|
|
15
|
+
import Animated, { SharedValue, useAnimatedStyle } from 'react-native-reanimated'
|
|
15
16
|
import { useConversationsContext } from '../../contexts/conversations_context'
|
|
16
17
|
import { useTheme, useCreateAndroidRippleColor } from '../../hooks'
|
|
17
18
|
import {
|
|
@@ -24,7 +25,7 @@ import { ConversationResource } from '../../types'
|
|
|
24
25
|
import { isArchivedConversation, platformPressedOpacityStyle } from '../../utils'
|
|
25
26
|
import { Haptic } from '../../utils/native_adapters'
|
|
26
27
|
import { tokens } from '../../vendor/tapestry/tokens'
|
|
27
|
-
import { SwipeableToggleButton } from './swipeable_toggle_button'
|
|
28
|
+
import { SWIPEABLE_TOGGLE_BUTTON_WIDTH, SwipeableToggleButton } from './swipeable_toggle_button'
|
|
28
29
|
|
|
29
30
|
export function ConversationActions({
|
|
30
31
|
children,
|
|
@@ -186,8 +187,10 @@ export function ConversationActions({
|
|
|
186
187
|
onSwipeableOpenStartDrag={handleSwipeableOpen}
|
|
187
188
|
onSwipeableClose={() => setDisabled(false)}
|
|
188
189
|
renderRightActions={() => <></>}
|
|
189
|
-
renderLeftActions={() => (
|
|
190
|
+
renderLeftActions={(progress, translation) => (
|
|
190
191
|
<LeftActions
|
|
192
|
+
progress={progress}
|
|
193
|
+
translation={translation}
|
|
191
194
|
isConversationEmpty={isConversationEmpty}
|
|
192
195
|
canMute={canMute}
|
|
193
196
|
canHide={canHide}
|
|
@@ -222,6 +225,8 @@ export function ConversationActions({
|
|
|
222
225
|
}
|
|
223
226
|
|
|
224
227
|
interface LeftActionsProps {
|
|
228
|
+
progress: SharedValue<number>
|
|
229
|
+
translation: SharedValue<number>
|
|
225
230
|
isConversationEmpty: boolean
|
|
226
231
|
canMute: boolean
|
|
227
232
|
canHide: boolean
|
|
@@ -237,6 +242,8 @@ interface LeftActionsProps {
|
|
|
237
242
|
}
|
|
238
243
|
|
|
239
244
|
function LeftActions({
|
|
245
|
+
progress,
|
|
246
|
+
translation,
|
|
240
247
|
isConversationEmpty,
|
|
241
248
|
canMute,
|
|
242
249
|
canHide,
|
|
@@ -251,6 +258,9 @@ function LeftActions({
|
|
|
251
258
|
isMarkReadPending,
|
|
252
259
|
}: LeftActionsProps) {
|
|
253
260
|
const styles = useStyles({ actionButtonCount: 1 + Number(canMute) + Number(canHide) })
|
|
261
|
+
// The buttons split whatever the drag has uncovered, so every action is on screen from the
|
|
262
|
+
// first few points and grows with the drag, instead of the last one waiting for a full open.
|
|
263
|
+
const revealStyle = useAnimatedStyle(() => ({ width: Math.max(translation.value, 0) }))
|
|
254
264
|
|
|
255
265
|
const muteToggleContent = {
|
|
256
266
|
true: { iconName: 'general.bell', label: 'Enable' },
|
|
@@ -269,38 +279,41 @@ function LeftActions({
|
|
|
269
279
|
|
|
270
280
|
return (
|
|
271
281
|
<View style={styles.actionButtonContainer}>
|
|
272
|
-
<
|
|
273
|
-
loading={isMarkReadPending}
|
|
274
|
-
disabled={isConversationEmpty}
|
|
275
|
-
toggled={!read}
|
|
276
|
-
onPress={handleLatestMessageUnread}
|
|
277
|
-
toggleContent={latestMessageUnreadToggleContent}
|
|
278
|
-
backgroundColor={tokens.fillColorInteractionSwipeDefault}
|
|
279
|
-
/>
|
|
280
|
-
{canMute && (
|
|
282
|
+
<Animated.View style={[styles.actionButtonReveal, revealStyle]}>
|
|
281
283
|
<SwipeableToggleButton
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
284
|
+
progress={progress}
|
|
285
|
+
loading={isMarkReadPending}
|
|
286
|
+
disabled={isConversationEmpty}
|
|
287
|
+
toggled={!read}
|
|
288
|
+
onPress={handleLatestMessageUnread}
|
|
289
|
+
toggleContent={latestMessageUnreadToggleContent}
|
|
290
|
+
backgroundColor={tokens.fillColorInteractionSwipeDefault}
|
|
287
291
|
/>
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
292
|
+
{canMute && (
|
|
293
|
+
<SwipeableToggleButton
|
|
294
|
+
progress={progress}
|
|
295
|
+
loading={isMutedPending}
|
|
296
|
+
toggled={muted}
|
|
297
|
+
onPress={handleMute}
|
|
298
|
+
toggleContent={muteToggleContent}
|
|
299
|
+
backgroundColor={tokens.fillColorInteractionSwipeSecondary}
|
|
300
|
+
/>
|
|
301
|
+
)}
|
|
302
|
+
{canHide && (
|
|
303
|
+
<SwipeableToggleButton
|
|
304
|
+
progress={progress}
|
|
305
|
+
loading={isHiddenPending}
|
|
306
|
+
toggled={hidden}
|
|
307
|
+
onPress={handleHide}
|
|
308
|
+
toggleContent={hideToggleContent}
|
|
309
|
+
backgroundColor={tokens.colorNeutral45}
|
|
310
|
+
/>
|
|
311
|
+
)}
|
|
312
|
+
</Animated.View>
|
|
298
313
|
</View>
|
|
299
314
|
)
|
|
300
315
|
}
|
|
301
316
|
|
|
302
|
-
const ACTION_BUTTON_WIDTH = 120
|
|
303
|
-
|
|
304
317
|
const useStyles = ({ actionButtonCount = 2 }: { actionButtonCount?: number } = {}) => {
|
|
305
318
|
const { colors } = useTheme()
|
|
306
319
|
return StyleSheet.create({
|
|
@@ -308,10 +321,13 @@ const useStyles = ({ actionButtonCount = 2 }: { actionButtonCount?: number } = {
|
|
|
308
321
|
backgroundColor: colors.conversationActionsBackground,
|
|
309
322
|
},
|
|
310
323
|
actionButtonContainer: {
|
|
324
|
+
// Fixed at the fully open width: the swipeable measures this to find its snap point.
|
|
325
|
+
width: SWIPEABLE_TOGGLE_BUTTON_WIDTH * actionButtonCount,
|
|
326
|
+
height: '100%',
|
|
327
|
+
},
|
|
328
|
+
actionButtonReveal: {
|
|
311
329
|
flexDirection: 'row',
|
|
312
|
-
|
|
313
|
-
width: ACTION_BUTTON_WIDTH * actionButtonCount,
|
|
314
|
-
alignContent: 'stretch',
|
|
330
|
+
height: '100%',
|
|
315
331
|
},
|
|
316
332
|
swipeableContainer: {
|
|
317
333
|
backgroundColor: colors.surfaceColor090,
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { StyleSheet } from 'react-native'
|
|
2
|
+
import { StyleSheet, View } from 'react-native'
|
|
3
3
|
import { Pressable, type PressableProps } from 'react-native-gesture-handler'
|
|
4
|
+
import Animated, {
|
|
5
|
+
Extrapolation,
|
|
6
|
+
SharedValue,
|
|
7
|
+
interpolate,
|
|
8
|
+
useAnimatedStyle,
|
|
9
|
+
} from 'react-native-reanimated'
|
|
4
10
|
import { useCreateAndroidRippleColor, useTheme } from '../../hooks'
|
|
5
11
|
import { Haptic } from '../../utils/native_adapters/configuration'
|
|
6
12
|
import {
|
|
@@ -11,8 +17,12 @@ import {
|
|
|
11
17
|
import { tokens } from '../../vendor/tapestry/tokens'
|
|
12
18
|
import { Icon, IconString, Spinner, Text } from '../display'
|
|
13
19
|
|
|
20
|
+
export const SWIPEABLE_TOGGLE_BUTTON_WIDTH = 120
|
|
21
|
+
|
|
14
22
|
interface SwipeableToggleButtonProps extends PressableProps {
|
|
15
23
|
backgroundColor: string
|
|
24
|
+
/** How far the swipe is open, 0 (closed) to 1 (fully open). */
|
|
25
|
+
progress: SharedValue<number>
|
|
16
26
|
toggled: boolean
|
|
17
27
|
toggleContent: {
|
|
18
28
|
true: { iconName: IconString; label: string }
|
|
@@ -24,6 +34,7 @@ interface SwipeableToggleButtonProps extends PressableProps {
|
|
|
24
34
|
export function SwipeableToggleButton({
|
|
25
35
|
backgroundColor,
|
|
26
36
|
onPress,
|
|
37
|
+
progress,
|
|
27
38
|
toggleContent,
|
|
28
39
|
disabled = false,
|
|
29
40
|
toggled,
|
|
@@ -37,6 +48,13 @@ export function SwipeableToggleButton({
|
|
|
37
48
|
|
|
38
49
|
const { iconName, label } = toggleContent[toggled ? 'true' : 'false']
|
|
39
50
|
|
|
51
|
+
const iconStyle = useAnimatedStyle(() => ({
|
|
52
|
+
transform: [{ scale: interpolate(progress.value, [0, 1], [0.7, 1], Extrapolation.CLAMP) }],
|
|
53
|
+
}))
|
|
54
|
+
const labelStyle = useAnimatedStyle(() => ({
|
|
55
|
+
opacity: interpolate(progress.value, [0.5, 1], [0, 1], Extrapolation.CLAMP),
|
|
56
|
+
}))
|
|
57
|
+
|
|
40
58
|
return (
|
|
41
59
|
<Pressable
|
|
42
60
|
onPress={event => {
|
|
@@ -53,20 +71,24 @@ export function SwipeableToggleButton({
|
|
|
53
71
|
{loading ? (
|
|
54
72
|
<Spinner size={20} />
|
|
55
73
|
) : (
|
|
56
|
-
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
<View style={styles.content}>
|
|
75
|
+
<Animated.View style={iconStyle}>
|
|
76
|
+
<Icon
|
|
77
|
+
name={iconName}
|
|
78
|
+
style={styles.icon}
|
|
79
|
+
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}
|
|
80
|
+
/>
|
|
81
|
+
</Animated.View>
|
|
82
|
+
<Animated.View style={labelStyle}>
|
|
83
|
+
<Text
|
|
84
|
+
variant="footnote"
|
|
85
|
+
style={styles.text}
|
|
86
|
+
maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER}
|
|
87
|
+
>
|
|
88
|
+
{label}
|
|
89
|
+
</Text>
|
|
90
|
+
</Animated.View>
|
|
91
|
+
</View>
|
|
70
92
|
)}
|
|
71
93
|
</Pressable>
|
|
72
94
|
)
|
|
@@ -85,10 +107,17 @@ const useStyles = ({ backgroundColor, disabled }: Partial<SwipeableToggleButtonP
|
|
|
85
107
|
flexDirection: 'column',
|
|
86
108
|
alignItems: 'center',
|
|
87
109
|
justifyContent: 'center',
|
|
88
|
-
gap: 4,
|
|
89
110
|
height: '100%',
|
|
111
|
+
overflow: 'hidden',
|
|
90
112
|
backgroundColor: buttonBackgroundColor,
|
|
91
113
|
},
|
|
114
|
+
// Laid out at the fully open width and clipped by the button, so the icon and label stay
|
|
115
|
+
// centered and never reflow while the button is narrower than that.
|
|
116
|
+
content: {
|
|
117
|
+
width: SWIPEABLE_TOGGLE_BUTTON_WIDTH,
|
|
118
|
+
alignItems: 'center',
|
|
119
|
+
gap: 4,
|
|
120
|
+
},
|
|
92
121
|
icon: {
|
|
93
122
|
fontSize: 20,
|
|
94
123
|
color: fillColor,
|
|
@@ -249,7 +249,7 @@ function BannerLink({ children, onPress }: BannerLinkProps) {
|
|
|
249
249
|
const styles = useStyles({ appearance })
|
|
250
250
|
|
|
251
251
|
return (
|
|
252
|
-
<TextInlineButton variant="tertiary" style={styles.
|
|
252
|
+
<TextInlineButton variant="tertiary" style={styles.link} onPress={onPress}>
|
|
253
253
|
{children}
|
|
254
254
|
</TextInlineButton>
|
|
255
255
|
)
|
|
@@ -295,5 +295,9 @@ const useStyles = ({ appearance = 'neutral' }: Styles = {}) => {
|
|
|
295
295
|
text: {
|
|
296
296
|
color: statusColorMap[appearance].text,
|
|
297
297
|
},
|
|
298
|
+
link: {
|
|
299
|
+
color: statusColorMap[appearance].text,
|
|
300
|
+
textDecorationColor: statusColorMap[appearance].text,
|
|
301
|
+
},
|
|
298
302
|
})
|
|
299
303
|
}
|
|
@@ -34,9 +34,8 @@ jest.mock('../../../contexts/conversations_context', () => ({
|
|
|
34
34
|
}),
|
|
35
35
|
}))
|
|
36
36
|
jest.mock('../../../components', () => ({
|
|
37
|
-
Conversations: ({ ListHeaderComponent }: { ListHeaderComponent: React.
|
|
38
|
-
|
|
39
|
-
),
|
|
37
|
+
Conversations: ({ ListHeaderComponent }: { ListHeaderComponent: React.ReactElement }) =>
|
|
38
|
+
ListHeaderComponent,
|
|
40
39
|
}))
|
|
41
40
|
jest.mock('../../../components/display/toast', () => ({ Toast: () => null }))
|
|
42
41
|
jest.mock('../../../components/conversations/bulk_conversation_actions_bar', () => ({
|
|
@@ -2,6 +2,7 @@ import { StaticScreenProps, useNavigation } from '@react-navigation/native'
|
|
|
2
2
|
import React, { useEffect, useLayoutEffect, useRef } from 'react'
|
|
3
3
|
import { StyleSheet, View } from 'react-native'
|
|
4
4
|
import { Conversations } from '../../components'
|
|
5
|
+
import { AppUpdateBanner } from '../../components/conversations/app_update_banner'
|
|
5
6
|
import { BulkConversationActionsBar } from '../../components/conversations/bulk_conversation_actions_bar'
|
|
6
7
|
import {
|
|
7
8
|
composeOptions,
|
|
@@ -56,7 +57,14 @@ export function ConversationsScreen({ route }: ConversationsScreenProps) {
|
|
|
56
57
|
<ConversationsContextProvider args={route.params} opts={{ throwOnError: true }}>
|
|
57
58
|
<SelectModeHeader title={route.params?.title} />
|
|
58
59
|
<SelectModeRequest conversationId={route.params?.select_conversation_id} />
|
|
59
|
-
<Conversations
|
|
60
|
+
<Conversations
|
|
61
|
+
ListHeaderComponent={
|
|
62
|
+
<>
|
|
63
|
+
<Header />
|
|
64
|
+
<AppUpdateBanner />
|
|
65
|
+
</>
|
|
66
|
+
}
|
|
67
|
+
/>
|
|
60
68
|
<BulkConversationActionsBar />
|
|
61
69
|
</ConversationsContextProvider>
|
|
62
70
|
<Toast />
|