@planningcenter/chat-react-native 3.2.0-rc.1 → 3.2.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.
- package/build/components/conversation/message_form.js.map +1 -1
- package/build/components/conversation/message_reaction.d.ts +2 -2
- package/build/components/conversations/action_toggle_button.d.ts +21 -0
- package/build/components/conversations/action_toggle_button.d.ts.map +1 -0
- package/build/components/conversations/action_toggle_button.js +47 -0
- package/build/components/conversations/action_toggle_button.js.map +1 -0
- package/build/components/conversations/conversation_actions.d.ts +10 -0
- package/build/components/conversations/conversation_actions.d.ts.map +1 -0
- package/build/components/conversations/conversation_actions.js +70 -0
- package/build/components/conversations/conversation_actions.js.map +1 -0
- package/build/components/conversations/conversation_preview.d.ts +2 -1
- package/build/components/conversations/conversation_preview.d.ts.map +1 -1
- package/build/components/conversations/conversation_preview.js +27 -9
- package/build/components/conversations/conversation_preview.js.map +1 -1
- package/build/components/conversations/conversations.d.ts +5 -3
- package/build/components/conversations/conversations.d.ts.map +1 -1
- package/build/components/conversations/conversations.js +11 -7
- package/build/components/conversations/conversations.js.map +1 -1
- package/build/components/conversations/mute_indicator.d.ts +5 -0
- package/build/components/conversations/mute_indicator.d.ts.map +1 -0
- package/build/components/conversations/mute_indicator.js +19 -0
- package/build/components/conversations/mute_indicator.js.map +1 -0
- package/build/components/conversations/unread_count_badge.d.ts +2 -1
- package/build/components/conversations/unread_count_badge.d.ts.map +1 -1
- package/build/components/conversations/unread_count_badge.js +9 -1
- package/build/components/conversations/unread_count_badge.js.map +1 -1
- package/build/components/display/badge.d.ts +5 -4
- package/build/components/display/badge.d.ts.map +1 -1
- package/build/components/display/badge.js +5 -2
- package/build/components/display/badge.js.map +1 -1
- package/build/components/display/button.d.ts +3 -2
- package/build/components/display/button.d.ts.map +1 -1
- package/build/components/display/button.js.map +1 -1
- package/build/components/display/icon.d.ts +14 -1
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +9 -0
- package/build/components/display/icon.js.map +1 -1
- package/build/components/display/icon_button.d.ts +2 -2
- package/build/components/display/icon_button.d.ts.map +1 -1
- package/build/components/display/icon_button.js.map +1 -1
- package/build/components/display/text.js.map +1 -1
- package/build/components/display/toggle_button.d.ts +3 -2
- package/build/components/display/toggle_button.d.ts.map +1 -1
- package/build/components/display/toggle_button.js.map +1 -1
- package/build/components/display/utils/button_colors.d.ts +3 -3
- package/build/components/display/utils/button_colors.d.ts.map +1 -1
- package/build/components/display/utils/button_colors.js +1 -1
- package/build/components/display/utils/button_colors.js.map +1 -1
- package/build/components/page/error_boundary.d.ts +1 -1
- package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
- package/build/components/primitive/avatar_primitive.js +3 -2
- package/build/components/primitive/avatar_primitive.js.map +1 -1
- package/build/components/primitive/banner_primitive.d.ts +2 -1
- package/build/components/primitive/banner_primitive.d.ts.map +1 -1
- package/build/components/primitive/banner_primitive.js.map +1 -1
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/swipeable_active_conversation.d.ts +11 -0
- package/build/contexts/swipeable_active_conversation.d.ts.map +1 -0
- package/build/contexts/swipeable_active_conversation.js +16 -0
- package/build/contexts/swipeable_active_conversation.js.map +1 -0
- package/build/hooks/use_conversation.d.ts +1 -1
- package/build/hooks/use_conversation.d.ts.map +1 -1
- package/build/hooks/use_conversation.js +1 -1
- package/build/hooks/use_conversation.js.map +1 -1
- package/build/hooks/use_create_android_ripple_color.d.ts +1 -1
- package/build/hooks/use_create_android_ripple_color.d.ts.map +1 -1
- package/build/hooks/use_jolt.js +1 -1
- package/build/hooks/use_jolt.js.map +1 -1
- package/build/navigation/index.d.ts +8 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +12 -0
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_filters/components/conversation_filters.js.map +1 -1
- package/build/screens/conversation_filters/components/rows.d.ts +2 -1
- package/build/screens/conversation_filters/components/rows.d.ts.map +1 -1
- package/build/screens/conversation_filters/components/rows.js +19 -14
- package/build/screens/conversation_filters/components/rows.js.map +1 -1
- package/build/screens/conversations/components/chat_group_badge.js +1 -1
- package/build/screens/conversations/components/chat_group_badge.js.map +1 -1
- package/build/screens/conversations/components/list_header_component.js +1 -1
- package/build/screens/conversations/components/list_header_component.js.map +1 -1
- package/build/screens/conversations/conversations_screen.js +2 -2
- package/build/screens/conversations/conversations_screen.js.map +1 -1
- package/build/screens/create/conversation_create_screen.d.ts.map +1 -1
- package/build/screens/create/conversation_create_screen.js +0 -1
- package/build/screens/create/conversation_create_screen.js.map +1 -1
- package/build/screens/design_system_screen.js +1 -0
- package/build/screens/design_system_screen.js.map +1 -1
- package/build/screens/message_actions_screen.js +1 -1
- package/build/screens/message_actions_screen.js.map +1 -1
- package/build/utils/client/client.d.ts +2 -2
- package/build/utils/client/client.d.ts.map +1 -1
- package/build/utils/client/client.js +12 -4
- package/build/utils/client/client.js.map +1 -1
- package/build/utils/client/request_helpers.d.ts +15 -8
- package/build/utils/client/request_helpers.d.ts.map +1 -1
- package/build/utils/client/request_helpers.js +2 -1
- package/build/utils/client/request_helpers.js.map +1 -1
- package/build/utils/client/transform_request_data.d.ts +11 -6
- package/build/utils/client/transform_request_data.d.ts.map +1 -1
- package/build/utils/client/transform_request_data.js +1 -1
- package/build/utils/client/transform_request_data.js.map +1 -1
- package/build/utils/client/transform_response.d.ts +1 -1
- package/build/utils/client/transform_response.d.ts.map +1 -1
- package/build/utils/client/transform_response.js +2 -0
- package/build/utils/client/transform_response.js.map +1 -1
- package/build/utils/client/utils.d.ts +3 -3
- package/build/utils/client/utils.d.ts.map +1 -1
- package/build/utils/client/utils.js +6 -6
- package/build/utils/client/utils.js.map +1 -1
- package/build/utils/date.d.ts.map +1 -1
- package/build/utils/date.js +1 -0
- package/build/utils/date.js.map +1 -1
- package/build/utils/deepCamelCaseKeys.d.ts.map +1 -1
- package/build/utils/deepCamelCaseKeys.js +3 -1
- package/build/utils/deepCamelCaseKeys.js.map +1 -1
- package/build/utils/parse_simple_markdown.d.ts +1 -1
- package/build/utils/parse_simple_markdown.d.ts.map +1 -1
- package/build/utils/parse_simple_markdown.js +2 -1
- package/build/utils/parse_simple_markdown.js.map +1 -1
- package/build/utils/space.js.map +1 -1
- package/build/utils/uri.d.ts +2 -2
- package/build/utils/uri.d.ts.map +1 -1
- package/build/utils/uri.js +2 -2
- package/build/utils/uri.js.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts +8 -0
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.js +8 -0
- package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -1
- package/build/vendor/tapestry/tokens.d.ts +2 -0
- package/build/vendor/tapestry/tokens.d.ts.map +1 -1
- package/build/vendor/tapestry/tokens.js +2 -0
- package/build/vendor/tapestry/tokens.js.map +1 -1
- package/package.json +8 -6
- package/src/components/conversation/message_form.tsx +1 -1
- package/src/components/conversations/action_toggle_button.tsx +83 -0
- package/src/components/conversations/conversation_actions.tsx +119 -0
- package/src/components/conversations/conversation_preview.tsx +46 -16
- package/src/components/conversations/conversations.tsx +38 -30
- package/src/components/conversations/mute_indicator.tsx +21 -0
- package/src/components/conversations/unread_count_badge.tsx +8 -1
- package/src/components/display/badge.tsx +12 -8
- package/src/components/display/button.tsx +3 -3
- package/src/components/display/icon.tsx +16 -3
- package/src/components/display/icon_button.tsx +2 -2
- package/src/components/display/text.tsx +1 -1
- package/src/components/display/toggle_button.tsx +3 -3
- package/src/components/display/utils/button_colors.ts +8 -3
- package/src/components/primitive/avatar_primitive.tsx +5 -3
- package/src/components/primitive/banner_primitive.tsx +2 -2
- package/src/contexts/api_provider.tsx +1 -1
- package/src/contexts/swipeable_active_conversation.tsx +27 -0
- package/src/hooks/use_conversation.ts +5 -5
- package/src/hooks/use_jolt.ts +2 -2
- package/src/navigation/index.tsx +18 -0
- package/src/screens/conversation_filters/components/conversation_filters.tsx +1 -1
- package/src/screens/conversation_filters/components/rows.tsx +44 -14
- package/src/screens/conversations/components/chat_group_badge.tsx +1 -1
- package/src/screens/conversations/components/list_header_component.tsx +1 -1
- package/src/screens/conversations/conversations_screen.tsx +2 -2
- package/src/screens/create/conversation_create_screen.tsx +7 -4
- package/src/screens/design_system_screen.tsx +1 -0
- package/src/screens/message_actions_screen.tsx +2 -2
- package/src/utils/client/client.ts +15 -7
- package/src/utils/client/request_helpers.ts +15 -6
- package/src/utils/client/transform_request_data.ts +13 -4
- package/src/utils/client/transform_response.ts +3 -0
- package/src/utils/client/types.d.ts +2 -1
- package/src/utils/client/utils.ts +13 -12
- package/src/utils/date.ts +1 -0
- package/src/utils/deepCamelCaseKeys.ts +3 -2
- package/src/utils/parse_simple_markdown.ts +3 -1
- package/src/utils/space.ts +1 -1
- package/src/utils/uri.ts +2 -2
- package/src/vendor/tapestry/alias_tokens_color_map.ts +12 -0
- package/src/vendor/tapestry/tokens.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_form.js","sourceRoot":"","sources":["../../../src/components/conversation/message_form.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AACzE,OAAO,EAAgB,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAa,MAAM,cAAc,CAAA;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AAEnG,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAA;AAE7D,MAAM,CAAC,MAA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CAAC,IAAI,CACT,UAAU,CAAC,SAAS,CACpB,IAAI,CAAC,CAAC,mBAAmB,CAAC,EAC1B,CACH,CAAA;AACH,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO,CACL,CAAC,UAAU,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,cAAc,CAAC,EAAG,CAChG,CAAA;AACH,CAAC;AAED,MAAM,oBAAoB,GAAG,GAAG,EAAE;IAChC,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAA;IAE5C,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,kBAAkB,EAAE;YAClB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;YACjD,cAAc,EAAE,CAAC;YACjB,OAAO,EAAE,EAAE;YACX,eAAe,EAAE,eAAe,CAAC,MAAM,CAAC,IAAI;YAC5C,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;SACR;QACD,SAAS,EAAE;YACT,YAAY,EAAE,EAAE;YAChB,WAAW,EAAE,CAAC;YACd,OAAO,EAAE,EAAE;YACX,iBAAiB,EAAE,EAAE;YACrB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,uBAAuB;YACjD,IAAI,EAAE,CAAC;SACR;QACD,aAAa,EAAE;YACb,YAAY,EAAE,EAAE;YAChB,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,mBAAmB;SAClD;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useTheme as useNavigationTheme } from '@react-navigation/native'\nimport { InfiniteData, useMutation, useQueryClient } from '@tanstack/react-query'\nimport React from 'react'\nimport { StyleSheet, TextInput, View, ViewProps } from 'react-native'\nimport { IconButton } from '../../components'\nimport { useTheme } from '../../hooks'\nimport { useApiClient } from '../../hooks/use_api_client'\nimport { getMessagesQueryKey, getMessagesRequestArgs } from '../../hooks/use_conversation_messages'\nimport { ApiCollection, ApiResource, ConversationResource, MessageResource } from '../../types'\nimport { updateOrCreateRecordInPagesData } from '../../utils'\n\nexport const MessageForm = {\n Root: MessageFormRoot,\n TextInput: MessageFormInput,\n SubmitButton: MessageFormSubmitBtn,\n AttachmentPicker: MessageFormAttachmentPicker,\n Commands: MessageFormCommands,\n}\n\ninterface MessagesFormRootProps extends ViewProps {\n conversation: ConversationResource\n}\n\nconst MessageFormContext = React.createContext({\n text: '',\n setText: (_text: string) => {},\n onSubmit: () => {},\n disabled: false,\n})\n\nfunction MessageFormRoot({ conversation, children }: MessagesFormRootProps) {\n const styles = useMessageFormStyles()\n const [text, setText] = React.useState('')\n const apiClient = useApiClient()\n const queryClient = useQueryClient()\n\n const { mutate, isPending } = useMutation({\n mutationFn: async () => {\n const requestParams = getMessagesRequestArgs({ conversation_id: conversation.id })\n const fieldsWithValueJoined = Object.fromEntries(\n Object.entries(requestParams.data.fields).map(([k, v]) => [k, v.join(',')])\n )\n\n return apiClient.chat.post<ApiResource<MessageResource>>({\n url: `/me/conversations/${conversation.id}/messages`,\n data: {\n ...requestParams.data,\n data: {\n type: 'Message',\n attributes: { text },\n },\n fields: fieldsWithValueJoined,\n },\n })\n },\n onSuccess: (result: ApiResource<MessageResource>) => {\n const updatedMessage = result.data\n type QueryData = InfiniteData<ApiCollection<MessageResource>>\n const queryKey = getMessagesQueryKey({ conversation_id: conversation.id })\n\n setText('')\n queryClient.setQueryData<QueryData>(queryKey, data =>\n updateOrCreateRecordInPagesData({\n data,\n record: updatedMessage,\n })\n )\n },\n })\n\n return (\n <MessageFormContext.Provider\n value={{ text, setText, onSubmit: () => mutate(), disabled: isPending }}\n >\n <View style={styles.textInputContainer}>{children}</View>\n </MessageFormContext.Provider>\n )\n}\n\nfunction MessageFormInput() {\n const styles = useMessageFormStyles()\n const { text, setText, onSubmit } = React.useContext(MessageFormContext)\n\n return (\n <TextInput\n aria-disabled={true}\n placeholder=\"Send a message\"\n onChangeText={setText}\n value={text}\n style={styles.textInput}\n onSubmitEditing={onSubmit}\n />\n )\n}\n\nfunction MessageFormSubmitBtn() {\n const styles = useMessageFormStyles()\n const { onSubmit, disabled } = React.useContext(MessageFormContext)\n\n return (\n <IconButton\n disabled={disabled}\n accessibilityLabel=\"Send message\"\n size=\"md\"\n appearance=\"neutral\"\n style={styles.textInputSend}\n name={'general.upArrow'}\n onPress={onSubmit}\n />\n )\n}\n\nfunction MessageFormAttachmentPicker() {\n return (\n <IconButton\n accessibilityLabel=\"Shazam\"\n size=\"md\"\n appearance=\"neutral\"\n name={'general.paperclip'}\n />\n )\n}\n\nfunction MessageFormCommands() {\n return (\n <IconButton accessibilityLabel=\"Shazam\" size=\"md\" appearance=\"neutral\" name={'general.bolt'} />\n )\n}\n\nconst useMessageFormStyles = () => {\n const theme = useTheme()\n const navigationTheme = useNavigationTheme()\n\n return StyleSheet.create({\n textInputContainer: {\n borderColor: theme.colors.fillColorNeutral050Base,\n borderTopWidth: 1,\n padding: 12,\n backgroundColor: navigationTheme.colors.card,\n flexDirection: 'row',\n alignItems: 'center',\n gap: 12,\n },\n textInput: {\n borderRadius: 24,\n borderWidth: 1,\n padding: 12,\n paddingHorizontal: 20,\n borderColor: theme.colors.fillColorNeutral050Base,\n flex: 1,\n },\n textInputSend: {\n borderRadius: 24,\n height: 36,\n width: 36,\n backgroundColor: theme.colors.fillColorNeutral040,\n },\n })\n}\n"]}
|
|
@@ -10,8 +10,8 @@ export declare const useReactionStyles: ({ mine }: {
|
|
|
10
10
|
}) => {
|
|
11
11
|
reaction: {
|
|
12
12
|
borderWidth: number;
|
|
13
|
-
borderColor:
|
|
14
|
-
backgroundColor:
|
|
13
|
+
borderColor: string;
|
|
14
|
+
backgroundColor: string;
|
|
15
15
|
borderRadius: number;
|
|
16
16
|
paddingVertical: number;
|
|
17
17
|
paddingHorizontal: number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type PressableProps } from 'react-native';
|
|
3
|
+
import { IconString } from '../display';
|
|
4
|
+
interface ActionToggleButtonProps extends PressableProps {
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
toggled: boolean;
|
|
7
|
+
toggleContent: {
|
|
8
|
+
true: {
|
|
9
|
+
iconName: IconString;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
false: {
|
|
13
|
+
iconName: IconString;
|
|
14
|
+
label: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function ActionToggleButton({ backgroundColor, onPress, toggleContent, disabled, toggled, loading, ...props }: ActionToggleButtonProps): React.JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=action_toggle_button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action_toggle_button.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/action_toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,EAAQ,UAAU,EAAiB,MAAM,YAAY,CAAA;AAI5D,UAAU,uBAAwB,SAAQ,cAAc;IACtD,eAAe,EAAE,MAAM,CAAA;IACvB,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE;QACb,IAAI,EAAE;YAAE,QAAQ,EAAE,UAAU,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;QAC7C,KAAK,EAAE;YAAE,QAAQ,EAAE,UAAU,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAC/C,CAAA;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,eAAe,EACf,OAAO,EACP,aAAa,EACb,QAAgB,EAChB,OAAO,EACP,OAAe,EACf,GAAG,KAAK,EACT,EAAE,uBAAuB,qBA8BzB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, StyleSheet } from 'react-native';
|
|
3
|
+
import { Icon, Spinner, Text } from '../display';
|
|
4
|
+
import { useCreateAndroidRippleColor, useTheme } from '../../hooks';
|
|
5
|
+
import { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils/styles';
|
|
6
|
+
export function ActionToggleButton({ backgroundColor, onPress, toggleContent, disabled = false, toggled, loading = false, ...props }) {
|
|
7
|
+
const styles = useStyles({ backgroundColor, disabled });
|
|
8
|
+
const androidRippleColor = useCreateAndroidRippleColor({
|
|
9
|
+
color: backgroundColor,
|
|
10
|
+
});
|
|
11
|
+
const { iconName, label } = toggleContent[toggled ? 'true' : 'false'];
|
|
12
|
+
return (<Pressable onPress={onPress} style={({ pressed }) => [styles.button, pressed && platformPressedOpacityStyle]} android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }} disabled={disabled || loading} accessibilityRole="togglebutton" accessibilityState={{ checked: toggled }} {...props}>
|
|
13
|
+
{loading ? (<Spinner size={20}/>) : (<>
|
|
14
|
+
<Icon name={iconName} style={styles.icon} size={20}/>
|
|
15
|
+
<Text variant="footnote" style={styles.text}>
|
|
16
|
+
{label}
|
|
17
|
+
</Text>
|
|
18
|
+
</>)}
|
|
19
|
+
</Pressable>);
|
|
20
|
+
}
|
|
21
|
+
const useStyles = ({ backgroundColor, disabled }) => {
|
|
22
|
+
const { colors } = useTheme();
|
|
23
|
+
const fillColor = disabled ? colors.textColorDefaultDisabled : colors.fillColorNeutral100Inverted;
|
|
24
|
+
const buttonBackgroundColor = disabled
|
|
25
|
+
? colors.fillColorButtonNeutralSolidDisabled
|
|
26
|
+
: backgroundColor;
|
|
27
|
+
return StyleSheet.create({
|
|
28
|
+
button: {
|
|
29
|
+
flex: 1,
|
|
30
|
+
flexDirection: 'column',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
justifyContent: 'center',
|
|
33
|
+
gap: 4,
|
|
34
|
+
height: '100%',
|
|
35
|
+
backgroundColor: buttonBackgroundColor,
|
|
36
|
+
},
|
|
37
|
+
icon: {
|
|
38
|
+
color: fillColor,
|
|
39
|
+
marginTop: 4,
|
|
40
|
+
},
|
|
41
|
+
text: {
|
|
42
|
+
color: fillColor,
|
|
43
|
+
fontWeight: platformFontWeightMedium,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=action_toggle_button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action_toggle_button.js","sourceRoot":"","sources":["../../../src/components/conversations/action_toggle_button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAuB,MAAM,cAAc,CAAA;AACzE,OAAO,EAAE,IAAI,EAAc,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAY1F,MAAM,UAAU,kBAAkB,CAAC,EACjC,eAAe,EACf,OAAO,EACP,aAAa,EACb,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,OAAO,GAAG,KAAK,EACf,GAAG,KAAK,EACgB;IACxB,MAAM,MAAM,GAAG,SAAS,CAAC,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,CAAA;IACvD,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;QACrD,KAAK,EAAE,eAAe;KACvB,CAAC,CAAA;IAEF,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,O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,qBAAqB,GAAG,QAAQ;QACpC,CAAC,CAAC,MAAM,CAAC,mCAAmC;QAC5C,CAAC,CAAC,eAAe,CAAA;IAEnB,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,CAAC;YACP,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,MAAM;YACd,eAAe,EAAE,qBAAqB;SACvC;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,SAAS,EAAE,CAAC;SACb;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,UAAU,EAAE,wBAAwB;SACrC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Pressable, StyleSheet, type PressableProps } from 'react-native'\nimport { Icon, IconString, Spinner, Text } from '../display'\nimport { useCreateAndroidRippleColor, useTheme } from '../../hooks'\nimport { platformFontWeightMedium, platformPressedOpacityStyle } from '../../utils/styles'\n\ninterface ActionToggleButtonProps extends PressableProps {\n backgroundColor: string\n toggled: boolean\n toggleContent: {\n true: { iconName: IconString; label: string }\n false: { iconName: IconString; label: string }\n }\n loading?: boolean\n}\n\nexport function ActionToggleButton({\n backgroundColor,\n onPress,\n toggleContent,\n disabled = false,\n toggled,\n loading = false,\n ...props\n}: ActionToggleButtonProps) {\n const styles = useStyles({ backgroundColor, disabled })\n const androidRippleColor = useCreateAndroidRippleColor({\n color: backgroundColor,\n })\n\n const { iconName, label } = toggleContent[toggled ? 'true' : 'false']\n\n return (\n <Pressable\n onPress={onPress}\n style={({ pressed }) => [styles.button, pressed && platformPressedOpacityStyle]}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n disabled={disabled || loading}\n accessibilityRole=\"togglebutton\"\n accessibilityState={{ checked: toggled }}\n {...props}\n >\n {loading ? (\n <Spinner size={20} />\n ) : (\n <>\n <Icon name={iconName} style={styles.icon} size={20} />\n <Text variant=\"footnote\" style={styles.text}>\n {label}\n </Text>\n </>\n )}\n </Pressable>\n )\n}\n\nconst useStyles = ({ backgroundColor, disabled }: Partial<ActionToggleButtonProps>) => {\n const { colors } = useTheme()\n const fillColor = disabled ? colors.textColorDefaultDisabled : colors.fillColorNeutral100Inverted\n const buttonBackgroundColor = disabled\n ? colors.fillColorButtonNeutralSolidDisabled\n : backgroundColor\n\n return StyleSheet.create({\n button: {\n flex: 1,\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 4,\n height: '100%',\n backgroundColor: buttonBackgroundColor,\n },\n icon: {\n color: fillColor,\n marginTop: 4,\n },\n text: {\n color: fillColor,\n fontWeight: platformFontWeightMedium,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
import { ConversationResource } from '../../types';
|
|
4
|
+
export declare function ConversationActions({ children, conversation, style, onPress, }: {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
conversation: ConversationResource;
|
|
7
|
+
onPress: () => void;
|
|
8
|
+
style?: ViewStyle;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
//# sourceMappingURL=conversation_actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation_actions.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversation_actions.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAClF,OAAO,EAA8B,SAAS,EAAa,MAAM,cAAc,CAAA;AAO/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAGlD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,EAAE,oBAAoB,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,qBA+CA"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Platform, View, StyleSheet, Pressable } from 'react-native';
|
|
3
|
+
import ReanimatedSwipeable from 'react-native-gesture-handler/ReanimatedSwipeable';
|
|
4
|
+
import { useTheme } from '../../hooks';
|
|
5
|
+
import { ActionToggleButton } from './action_toggle_button';
|
|
6
|
+
import { tokens } from '../../vendor/tapestry/tokens';
|
|
7
|
+
import { useConversationActionsContext } from '../../contexts/swipeable_active_conversation';
|
|
8
|
+
export function ConversationActions({ children, conversation, style, onPress, }) {
|
|
9
|
+
const swipeableRef = useRef(null);
|
|
10
|
+
const styles = useStyles();
|
|
11
|
+
const { activeConversationId, setActiveConversationId } = useConversationActionsContext();
|
|
12
|
+
const [disabled, setDisabled] = useState(false);
|
|
13
|
+
const overshootLeft = Platform.OS === 'ios';
|
|
14
|
+
const handleSwipeableClose = () => {
|
|
15
|
+
setDisabled(false);
|
|
16
|
+
swipeableRef.current?.close();
|
|
17
|
+
};
|
|
18
|
+
const handleSwipeableOpen = () => {
|
|
19
|
+
setDisabled(true);
|
|
20
|
+
setActiveConversationId(conversation.id);
|
|
21
|
+
};
|
|
22
|
+
const handlePress = useCallback(() => {
|
|
23
|
+
if (disabled || !onPress)
|
|
24
|
+
return;
|
|
25
|
+
onPress();
|
|
26
|
+
}, [disabled, onPress]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (activeConversationId === conversation.id)
|
|
29
|
+
return;
|
|
30
|
+
handleSwipeableClose();
|
|
31
|
+
}, [activeConversationId, conversation.id]);
|
|
32
|
+
return (<ReanimatedSwipeable ref={swipeableRef} childrenContainerStyle={styles.swipeableChildContainer} containerStyle={styles.swipeableContainer} overshootFriction={8} overshootLeft={overshootLeft} overshootRight={false} onSwipeableOpenStartDrag={handleSwipeableOpen} onSwipeableClose={() => setDisabled(false)} renderLeftActions={() => (<LeftActions conversation={conversation} onClose={handleSwipeableClose}/>)}>
|
|
33
|
+
<Pressable onPress={handlePress} style={style}>
|
|
34
|
+
{children}
|
|
35
|
+
</Pressable>
|
|
36
|
+
</ReanimatedSwipeable>);
|
|
37
|
+
}
|
|
38
|
+
function LeftActions({ conversation, onClose }) {
|
|
39
|
+
const styles = useStyles();
|
|
40
|
+
const [muted, setMuted] = useState(conversation.muted);
|
|
41
|
+
const handleMute = useCallback(() => {
|
|
42
|
+
setMuted(!muted);
|
|
43
|
+
onClose();
|
|
44
|
+
}, [muted, onClose]);
|
|
45
|
+
return (<View style={styles.actionButtonContainer}>
|
|
46
|
+
<ActionToggleButton loading={false} toggled={muted} toggleContent={{
|
|
47
|
+
true: { iconName: 'general.bellMuted', label: 'Mute' },
|
|
48
|
+
false: { iconName: 'general.bell', label: 'Unmute' },
|
|
49
|
+
}} onPress={() => handleMute()} backgroundColor={tokens.fillColorInteractionSwipeSecondary}/>
|
|
50
|
+
</View>);
|
|
51
|
+
}
|
|
52
|
+
const ACTION_BUTTON_WIDTH = 120;
|
|
53
|
+
const useStyles = () => {
|
|
54
|
+
const { colors } = useTheme();
|
|
55
|
+
return StyleSheet.create({
|
|
56
|
+
swipeableChildContainer: {
|
|
57
|
+
backgroundColor: colors.surfaceColor100,
|
|
58
|
+
},
|
|
59
|
+
actionButtonContainer: {
|
|
60
|
+
flexDirection: 'row',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
width: ACTION_BUTTON_WIDTH,
|
|
63
|
+
alignContent: 'stretch',
|
|
64
|
+
},
|
|
65
|
+
swipeableContainer: {
|
|
66
|
+
backgroundColor: colors.surfaceColor090,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=conversation_actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation_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State } from 'react'\nimport { Platform, View, StyleSheet, ViewStyle, Pressable } from 'react-native'\nimport ReanimatedSwipeable, {\n SwipeableMethods,\n} from 'react-native-gesture-handler/ReanimatedSwipeable'\nimport { useTheme } from '../../hooks'\nimport { ActionToggleButton } from './action_toggle_button'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { ConversationResource } from '../../types'\nimport { useConversationActionsContext } from '../../contexts/swipeable_active_conversation'\n\nexport function ConversationActions({\n children,\n conversation,\n style,\n onPress,\n}: {\n children: ReactNode\n conversation: ConversationResource\n onPress: () => void\n style?: ViewStyle\n}) {\n const swipeableRef = useRef<SwipeableMethods>(null)\n const styles = useStyles()\n const { activeConversationId, setActiveConversationId } = useConversationActionsContext()\n const [disabled, setDisabled] = useState(false)\n const overshootLeft = Platform.OS === 'ios'\n\n const handleSwipeableClose = () => {\n setDisabled(false)\n swipeableRef.current?.close()\n }\n\n const handleSwipeableOpen = () => {\n setDisabled(true)\n setActiveConversationId(conversation.id)\n }\n\n const handlePress = useCallback(() => {\n if (disabled || !onPress) return\n onPress()\n }, [disabled, onPress])\n\n useEffect(() => {\n if (activeConversationId === conversation.id) return\n\n handleSwipeableClose()\n }, [activeConversationId, conversation.id])\n\n return (\n <ReanimatedSwipeable\n ref={swipeableRef}\n childrenContainerStyle={styles.swipeableChildContainer}\n containerStyle={styles.swipeableContainer}\n overshootFriction={8}\n overshootLeft={overshootLeft}\n overshootRight={false}\n onSwipeableOpenStartDrag={handleSwipeableOpen}\n onSwipeableClose={() => setDisabled(false)}\n renderLeftActions={() => (\n <LeftActions conversation={conversation} onClose={handleSwipeableClose} />\n )}\n >\n <Pressable onPress={handlePress} style={style}>\n {children}\n </Pressable>\n </ReanimatedSwipeable>\n )\n}\n\ninterface LeftActionsProps {\n conversation: ConversationResource\n onClose: () => void\n}\n\nfunction LeftActions({ conversation, onClose }: LeftActionsProps) {\n const styles = useStyles()\n const [muted, setMuted] = useState(conversation.muted)\n\n const handleMute = useCallback(() => {\n setMuted(!muted)\n onClose()\n }, [muted, onClose])\n\n return (\n <View style={styles.actionButtonContainer}>\n <ActionToggleButton\n loading={false}\n toggled={muted}\n toggleContent={{\n true: { iconName: 'general.bellMuted', label: 'Mute' },\n false: { iconName: 'general.bell', label: 'Unmute' },\n }}\n onPress={() => handleMute()}\n backgroundColor={tokens.fillColorInteractionSwipeSecondary}\n />\n </View>\n )\n}\n\nconst ACTION_BUTTON_WIDTH = 120\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n swipeableChildContainer: {\n backgroundColor: colors.surfaceColor100,\n },\n actionButtonContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n width: ACTION_BUTTON_WIDTH,\n alignContent: 'stretch',\n },\n swipeableContainer: {\n backgroundColor: colors.surfaceColor090,\n },\n })\n}\n"]}
|
|
@@ -3,7 +3,8 @@ import { ConversationResource } from '../../types';
|
|
|
3
3
|
interface ConversationPreviewProps {
|
|
4
4
|
conversation: ConversationResource;
|
|
5
5
|
onPress: () => void;
|
|
6
|
+
showBadges?: boolean;
|
|
6
7
|
}
|
|
7
|
-
export declare const ConversationPreview: ({ conversation, onPress }: ConversationPreviewProps) => React.JSX.Element;
|
|
8
|
+
export declare const ConversationPreview: ({ conversation, onPress, showBadges, }: ConversationPreviewProps) => React.JSX.Element;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=conversation_preview.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_preview.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversation_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"conversation_preview.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversation_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAQlD,UAAU,wBAAwB;IAChC,YAAY,EAAE,oBAAoB,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,eAAO,MAAM,mBAAmB,2CAI7B,wBAAwB,sBAkC1B,CAAA"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import { AvatarGroup, Heading, Text, Badge } from '../display';
|
|
4
4
|
import { formatDatePreview } from '../../utils/date';
|
|
5
5
|
import { useTheme } from '../../hooks';
|
|
6
6
|
import { UnreadCountBadge } from './unread_count_badge';
|
|
7
|
-
|
|
7
|
+
import { ConversationActions } from './conversation_actions';
|
|
8
|
+
import { MuteIndicator } from './mute_indicator';
|
|
9
|
+
export const ConversationPreview = ({ conversation, onPress, showBadges = true, }) => {
|
|
8
10
|
const styles = useStyles();
|
|
9
|
-
const { lastMessageAuthorName, lastMessageCreatedAt, lastMessageTextPreview, previewAvatarUrls, title, unreadCount, badges, } = conversation;
|
|
10
|
-
return (<
|
|
11
|
+
const { lastMessageAuthorName, lastMessageCreatedAt, lastMessageTextPreview, previewAvatarUrls, title, unreadCount, badges, muted, } = conversation;
|
|
12
|
+
return (<ConversationActions conversation={conversation} style={styles.previewRow} onPress={onPress}>
|
|
11
13
|
<AvatarGroup size="lg" sourceUris={previewAvatarUrls || []}/>
|
|
12
14
|
<View style={styles.conversationBody}>
|
|
13
15
|
<Heading numberOfLines={1} variant="h3" style={styles.title}>
|
|
@@ -16,15 +18,25 @@ export const ConversationPreview = ({ conversation, onPress }) => {
|
|
|
16
18
|
<Text variant="tertiary" numberOfLines={2}>
|
|
17
19
|
{lastMessageAuthorName}: {lastMessageTextPreview}
|
|
18
20
|
</Text>
|
|
19
|
-
<
|
|
20
|
-
{badges?.map(badge => (<Badge key={badge.text} variant="meta" productLogoName={badge.appName} label={badge.pcoResourceType} metaLabel={badge.text || ''}/>))}
|
|
21
|
-
</View>
|
|
21
|
+
<ConversationBadges visible={showBadges} badges={badges}/>
|
|
22
22
|
</View>
|
|
23
23
|
<View style={styles.metaContainer}>
|
|
24
24
|
<Text variant="tertiary">{formatDatePreview(lastMessageCreatedAt)}</Text>
|
|
25
|
-
<
|
|
25
|
+
<View style={styles.statusContainer}>
|
|
26
|
+
<UnreadCountBadge count={unreadCount} showDot={muted}/>
|
|
27
|
+
<MuteIndicator muted={muted}/>
|
|
28
|
+
</View>
|
|
26
29
|
</View>
|
|
27
|
-
</
|
|
30
|
+
</ConversationActions>);
|
|
31
|
+
};
|
|
32
|
+
const ConversationBadges = ({ visible, badges }) => {
|
|
33
|
+
const styles = useStyles();
|
|
34
|
+
if (!visible || !badges || badges.length === 0) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return (<View style={styles.badges}>
|
|
38
|
+
{badges.map(badge => (<Badge key={badge.text} variant="meta" productLogoName={badge.appName} label={badge.pcoResourceType} metaLabel={badge.text || ''}/>))}
|
|
39
|
+
</View>);
|
|
28
40
|
};
|
|
29
41
|
const useStyles = () => {
|
|
30
42
|
const { colors } = useTheme();
|
|
@@ -48,11 +60,17 @@ const useStyles = () => {
|
|
|
48
60
|
},
|
|
49
61
|
metaContainer: {
|
|
50
62
|
rowGap: 4,
|
|
63
|
+
alignItems: 'flex-end',
|
|
51
64
|
},
|
|
52
65
|
badges: {
|
|
53
66
|
marginTop: 4,
|
|
54
67
|
alignItems: 'flex-start',
|
|
55
68
|
},
|
|
69
|
+
statusContainer: {
|
|
70
|
+
flexDirection: 'row',
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
gap: 4,
|
|
73
|
+
},
|
|
56
74
|
});
|
|
57
75
|
};
|
|
58
76
|
//# sourceMappingURL=conversation_preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_preview.js","sourceRoot":"","sources":["../../../src/components/conversations/conversation_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"conversation_preview.js","sourceRoot":"","sources":["../../../src/components/conversations/conversation_preview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAQhD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,YAAY,EACZ,OAAO,EACP,UAAU,GAAG,IAAI,GACQ,EAAE,EAAE;IAC7B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EACJ,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,MAAM,EACN,KAAK,GACN,GAAG,YAAY,CAAA;IAEhB,OAAO,CACL,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAC1F;MAAA,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,iBAAiB,IAAI,EAAE,CAAC,EAC3D;MAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,g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A","sourcesContent":["import React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { ConversationResource } from '../../types'\nimport { AvatarGroup, Heading, Text, Badge } from '../display'\nimport { formatDatePreview } from '../../utils/date'\nimport { useTheme } from '../../hooks'\nimport { UnreadCountBadge } from './unread_count_badge'\nimport { ConversationActions } from './conversation_actions'\nimport { MuteIndicator } from './mute_indicator'\n\ninterface ConversationPreviewProps {\n conversation: ConversationResource\n onPress: () => void\n showBadges?: boolean\n}\n\nexport const ConversationPreview = ({\n conversation,\n onPress,\n showBadges = true,\n}: ConversationPreviewProps) => {\n const styles = useStyles()\n const {\n lastMessageAuthorName,\n lastMessageCreatedAt,\n lastMessageTextPreview,\n previewAvatarUrls,\n title,\n unreadCount,\n badges,\n muted,\n } = conversation\n\n return (\n <ConversationActions conversation={conversation} style={styles.previewRow} onPress={onPress}>\n <AvatarGroup size=\"lg\" sourceUris={previewAvatarUrls || []} />\n <View style={styles.conversationBody}>\n <Heading numberOfLines={1} variant=\"h3\" style={styles.title}>\n {title}\n </Heading>\n <Text variant=\"tertiary\" numberOfLines={2}>\n {lastMessageAuthorName}: {lastMessageTextPreview}\n </Text>\n <ConversationBadges visible={showBadges} badges={badges} />\n </View>\n <View style={styles.metaContainer}>\n <Text variant=\"tertiary\">{formatDatePreview(lastMessageCreatedAt)}</Text>\n <View style={styles.statusContainer}>\n <UnreadCountBadge count={unreadCount} showDot={muted} />\n <MuteIndicator muted={muted} />\n </View>\n </View>\n </ConversationActions>\n )\n}\n\nconst ConversationBadges = ({ visible, badges }: { visible: boolean; badges?: any[] }) => {\n const styles = useStyles()\n\n if (!visible || !badges || badges.length === 0) {\n return null\n }\n\n return (\n <View style={styles.badges}>\n {badges.map(badge => (\n <Badge\n key={badge.text}\n variant=\"meta\"\n productLogoName={badge.appName}\n label={badge.pcoResourceType}\n metaLabel={badge.text || ''}\n />\n ))}\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n previewRow: {\n flexDirection: 'row',\n gap: 8,\n borderBottomWidth: 1,\n borderBottomColor: colors.borderColorDefaultDim,\n paddingTop: 12,\n paddingBottom: 12,\n paddingHorizontal: 16,\n },\n title: {\n fontSize: 16,\n color: colors.textColorDefaultPrimary,\n },\n conversationBody: {\n flex: 1,\n rowGap: 2,\n },\n metaContainer: {\n rowGap: 4,\n alignItems: 'flex-end',\n },\n badges: {\n marginTop: 4,\n alignItems: 'flex-start',\n },\n statusContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n })\n}\n"]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ConversationRequestArgs } from '../../utils/request/conversation';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type ListHeaderComponent = React.ComponentType<any> | React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
4
|
+
interface ConversationsProps extends Partial<Omit<ConversationRequestArgs, 'group'>> {
|
|
5
|
+
chat_group_graph_id?: string;
|
|
6
|
+
ListHeaderComponent?: ListHeaderComponent;
|
|
5
7
|
}
|
|
6
|
-
export declare const Conversations: ({ ListHeaderComponent, filter,
|
|
8
|
+
export declare const Conversations: ({ ListHeaderComponent, filter, chat_group_graph_id, gids, group_source_app_name, }: ConversationsProps) => React.JSX.Element;
|
|
7
9
|
export {};
|
|
8
10
|
//# sourceMappingURL=conversations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAI1E,KAAK,mBAAmB,GACpB,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,GACxB,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,GAClE,IAAI,CAAA;AAER,UAAU,kBAAmB,SAAQ,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAClF,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;CAC1C;AAED,eAAO,MAAM,aAAa,uFAMvB,kBAAkB,sBA0CpB,CAAA"}
|
|
@@ -7,21 +7,25 @@ import { useConversationsJoltEvents } from '../../hooks/use_conversation_jolt_ev
|
|
|
7
7
|
import { useConversations } from '../../hooks/use_conversations';
|
|
8
8
|
import { Text } from '../display';
|
|
9
9
|
import { ConversationPreview } from './conversation_preview';
|
|
10
|
-
|
|
10
|
+
import { ConversationActionsProvider } from '../../contexts/swipeable_active_conversation';
|
|
11
|
+
export const Conversations = ({ ListHeaderComponent, filter, chat_group_graph_id, gids, group_source_app_name, }) => {
|
|
11
12
|
const styles = useStyles();
|
|
12
13
|
const { conversations, fetchNextPage, refetch, isRefetching, isFetched } = useConversations({
|
|
13
14
|
filter,
|
|
14
|
-
group,
|
|
15
|
+
group: chat_group_graph_id,
|
|
15
16
|
gids,
|
|
16
17
|
group_source_app_name,
|
|
17
18
|
});
|
|
18
19
|
const navigation = useNavigation();
|
|
19
20
|
useConversationsJoltEvents();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const showBadges = !chat_group_graph_id;
|
|
22
|
+
return (<ConversationActionsProvider>
|
|
23
|
+
<View style={styles.container}>
|
|
24
|
+
<FlashList data={conversations} estimatedItemSize={97} contentContainerStyle={styles.contentContainer} onRefresh={refetch} refreshing={!isFetched && isRefetching} ListHeaderComponent={ListHeaderComponent} ListEmptyComponent={<View style={styles.listEmpty}>
|
|
25
|
+
<Text variant="secondary">No conversations found</Text>
|
|
26
|
+
</View>} renderItem={({ item }) => (<ConversationPreview conversation={item} onPress={() => navigation.navigate('Conversation', { conversation_id: item.id })} showBadges={showBadges}/>)} onEndReached={() => fetchNextPage()}/>
|
|
27
|
+
</View>
|
|
28
|
+
</ConversationActionsProvider>);
|
|
25
29
|
};
|
|
26
30
|
const useStyles = () => {
|
|
27
31
|
const { colors } = useTheme();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAA;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../../src/components/conversations/conversations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,0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AW,CAAC,sBAAsB,EAAE,IAAI,CACxD;YAAA,EAAE,IAAI,CACR,CAAC,CACD,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACxB,CAAC,mBAAmB,CAClB,YAAY,CAAC,CAAC,IAAI,CAAC,CACnB,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CACjF,UAAU,CAAC,CAAC,UAAU,CAAC,EACvB,CACH,CAAC,CACF,YAAY,CAAC,CAAC,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,EAExC;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,2BAA2B,CAAC,CAC/B,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;QACtB,gBAAgB,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE;QACzC,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,mBAAmB,EAAE;QAC/C,SAAS,EAAE;YACT,IAAI,EAAE,CAAC;YACP,cAAc,EAAE,QAAQ;YACxB,UAAU,EAAE,QAAQ;YACpB,eAAe,EAAE,EAAE;SACpB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport { FlashList } from '@shopify/flash-list'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { useTheme } from '../../hooks'\nimport { useConversationsJoltEvents } from '../../hooks/use_conversation_jolt_events'\nimport { useConversations } from '../../hooks/use_conversations'\nimport { Text } from '../display'\nimport { ConversationRequestArgs } from '../../utils/request/conversation'\nimport { ConversationPreview } from './conversation_preview'\nimport { ConversationActionsProvider } from '../../contexts/swipeable_active_conversation'\n\ntype ListHeaderComponent =\n | React.ComponentType<any>\n | React.ReactElement<any, string | React.JSXElementConstructor<any>>\n | null\n\ninterface ConversationsProps extends Partial<Omit<ConversationRequestArgs, 'group'>> {\n chat_group_graph_id?: string\n ListHeaderComponent?: ListHeaderComponent\n}\n\nexport const Conversations = ({\n ListHeaderComponent,\n filter,\n chat_group_graph_id,\n gids,\n group_source_app_name,\n}: ConversationsProps) => {\n const styles = useStyles()\n\n const { conversations, fetchNextPage, refetch, isRefetching, isFetched } = useConversations({\n filter,\n group: chat_group_graph_id,\n gids,\n group_source_app_name,\n })\n const navigation = useNavigation()\n\n useConversationsJoltEvents()\n\n const showBadges = !chat_group_graph_id\n\n return (\n <ConversationActionsProvider>\n <View style={styles.container}>\n <FlashList\n data={conversations}\n estimatedItemSize={97}\n contentContainerStyle={styles.contentContainer}\n onRefresh={refetch}\n refreshing={!isFetched && isRefetching}\n ListHeaderComponent={ListHeaderComponent}\n ListEmptyComponent={\n <View style={styles.listEmpty}>\n <Text variant=\"secondary\">No conversations found</Text>\n </View>\n }\n renderItem={({ item }) => (\n <ConversationPreview\n conversation={item}\n onPress={() => navigation.navigate('Conversation', { conversation_id: item.id })}\n showBadges={showBadges}\n />\n )}\n onEndReached={() => fetchNextPage()}\n />\n </View>\n </ConversationActionsProvider>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: { flex: 1 },\n contentContainer: { paddingVertical: 16 },\n listItem: { color: colors.fillColorNeutral020 },\n listEmpty: {\n flex: 1,\n justifyContent: 'center',\n alignItems: 'center',\n paddingVertical: 16,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mute_indicator.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/mute_indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,eAAO,MAAM,aAAa,cAAe;IAAE,KAAK,EAAE,OAAO,CAAA;CAAE,6BAM1D,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { Icon } from '../display';
|
|
4
|
+
import { useTheme } from '../../hooks';
|
|
5
|
+
export const MuteIndicator = ({ muted }) => {
|
|
6
|
+
const styles = useStyles();
|
|
7
|
+
if (!muted)
|
|
8
|
+
return null;
|
|
9
|
+
return <Icon name="general.bellMuted" size={16} style={styles.mutedIcon}/>;
|
|
10
|
+
};
|
|
11
|
+
const useStyles = () => {
|
|
12
|
+
const { colors } = useTheme();
|
|
13
|
+
return StyleSheet.create({
|
|
14
|
+
mutedIcon: {
|
|
15
|
+
color: colors.iconColorDefaultDim,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=mute_indicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mute_indicator.js","sourceRoot":"","sources":["../../../src/components/conversations/mute_indicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,KAAK,EAAsB,EAAE,EAAE;IAC7D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,EAAG,CAAA;AAC7E,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,mBAAmB;SAClC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { StyleSheet } from 'react-native'\nimport { Icon } from '../display'\nimport { useTheme } from '../../hooks'\n\nexport const MuteIndicator = ({ muted }: { muted: boolean }) => {\n const styles = useStyles()\n\n if (!muted) return null\n\n return <Icon name=\"general.bellMuted\" size={16} style={styles.mutedIcon} />\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n mutedIcon: {\n color: colors.iconColorDefaultDim,\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unread_count_badge.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/unread_count_badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"unread_count_badge.d.ts","sourceRoot":"","sources":["../../../src/components/conversations/unread_count_badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,eAAO,MAAM,gBAAgB,uBAAwB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,6BAcvF,CAAA"}
|
|
@@ -3,11 +3,13 @@ import { StyleSheet, View } from 'react-native';
|
|
|
3
3
|
import { Text } from '../display';
|
|
4
4
|
import { useTheme } from '../../hooks';
|
|
5
5
|
import { platformFontWeightBold } from '../../utils';
|
|
6
|
-
export const UnreadCountBadge = ({ count }) => {
|
|
6
|
+
export const UnreadCountBadge = ({ count, showDot }) => {
|
|
7
7
|
const styles = useStyles();
|
|
8
8
|
const displayCount = count > 99 ? '99+' : count;
|
|
9
9
|
if (count === 0)
|
|
10
10
|
return null;
|
|
11
|
+
if (showDot)
|
|
12
|
+
return <View style={styles.dot}/>;
|
|
11
13
|
return (<View style={styles.badge}>
|
|
12
14
|
<Text variant="footnote" style={styles.count}>
|
|
13
15
|
{displayCount}
|
|
@@ -28,6 +30,12 @@ const useStyles = () => {
|
|
|
28
30
|
fontWeight: platformFontWeightBold,
|
|
29
31
|
color: 'white',
|
|
30
32
|
},
|
|
33
|
+
dot: {
|
|
34
|
+
width: 8,
|
|
35
|
+
height: 8,
|
|
36
|
+
borderRadius: 8,
|
|
37
|
+
backgroundColor: colors.fillColorInteractionDefault,
|
|
38
|
+
},
|
|
31
39
|
});
|
|
32
40
|
};
|
|
33
41
|
//# sourceMappingURL=unread_count_badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unread_count_badge.js","sourceRoot":"","sources":["../../../src/components/conversations/unread_count_badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"unread_count_badge.js","sourceRoot":"","sources":["../../../src/components/conversations/unread_count_badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAEpD,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Text } from '../display'\nimport { useTheme } from '../../hooks'\nimport { platformFontWeightBold } from '../../utils'\n\nexport const UnreadCountBadge = ({ count, showDot }: { count: number; showDot: boolean }) => {\n const styles = useStyles()\n const displayCount = count > 99 ? '99+' : count\n\n if (count === 0) return null\n if (showDot) return <View style={styles.dot} />\n\n return (\n <View style={styles.badge}>\n <Text variant=\"footnote\" style={styles.count}>\n {displayCount}\n </Text>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n badge: {\n alignSelf: 'flex-end',\n backgroundColor: colors.fillColorInteractionDefault,\n paddingVertical: 2,\n paddingHorizontal: 8,\n borderRadius: 24,\n },\n count: {\n fontWeight: platformFontWeightBold,\n color: 'white',\n },\n dot: {\n width: 8,\n height: 8,\n borderRadius: 8,\n backgroundColor: colors.fillColorInteractionDefault,\n },\n })\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { JSX } from 'react';
|
|
2
2
|
import type { ViewStyle } from 'react-native';
|
|
3
|
+
import { IconString } from './icon';
|
|
3
4
|
import { type StatusAppearanceUnion } from './utils/status_colors';
|
|
4
5
|
declare const VARIANTS: {
|
|
5
6
|
readonly default: "default";
|
|
@@ -32,11 +33,11 @@ interface BadgeProps {
|
|
|
32
33
|
/**
|
|
33
34
|
* Shows an icon of the user choice to the left of the text.
|
|
34
35
|
*/
|
|
35
|
-
iconName?:
|
|
36
|
+
iconName?: IconString;
|
|
36
37
|
/**
|
|
37
38
|
* Shows an icon of the user choice to the right of the text.
|
|
38
39
|
*/
|
|
39
|
-
iconNameRight?:
|
|
40
|
+
iconNameRight?: IconString;
|
|
40
41
|
/**
|
|
41
42
|
* Styles badge wrapper.
|
|
42
43
|
*/
|
|
@@ -50,6 +51,6 @@ interface BadgeProps {
|
|
|
50
51
|
*/
|
|
51
52
|
onPress?: () => void;
|
|
52
53
|
}
|
|
53
|
-
export declare function Badge({ appearance, metaLabel, style, iconName, iconNameRight, label, productLogoName, variant, maxFontSizeMultiplier, onPress, }: BadgeProps):
|
|
54
|
+
export declare function Badge({ appearance, metaLabel, style, iconName, iconNameRight, label, productLogoName, variant, maxFontSizeMultiplier, onPress, }: BadgeProps): JSX.Element;
|
|
54
55
|
export {};
|
|
55
56
|
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/display/badge.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/display/badge.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,KAAK,EAAwB,SAAS,EAAE,MAAM,cAAc,CAAA;AAMnE,OAAO,EAAQ,UAAU,EAAE,MAAM,QAAQ,CAAA;AAEzC,OAAO,EAA+B,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAM/F,QAAA,MAAM,QAAQ;;;;CAIJ,CAAA;AAEV,KAAK,YAAY,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAA;AAiB5D,KAAK,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAA;AAcpE,UAAU,UAAU;IAClB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAA;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,wBAAgB,KAAK,CAAC,EACpB,UAAsB,EACtB,SAAS,EACT,KAAK,EACL,QAAQ,EACR,aAAa,EACb,KAAK,EACL,eAAe,EACf,OAAmB,EACnB,qBAAqB,EACrB,OAAO,GACR,EAAE,UAAU,eA4BZ"}
|