@planningcenter/chat-react-native 3.1.0-rc.3 → 3.1.0-rc.4
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/screens/conversation_details_screen.d.ts.map +1 -1
- package/build/screens/conversation_details_screen.js +47 -17
- package/build/screens/conversation_details_screen.js.map +1 -1
- package/build/utils/theme.d.ts +1 -0
- package/build/utils/theme.d.ts.map +1 -1
- package/build/utils/theme.js +2 -0
- package/build/utils/theme.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 +2 -2
- package/src/screens/conversation_details_screen.tsx +64 -14
- package/src/utils/theme.ts +3 -0
- package/src/vendor/tapestry/tokens.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_details_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_details_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,
|
|
1
|
+
{"version":3,"file":"conversation_details_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_details_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAQN,MAAM,OAAO,CAAA;AAqDd,MAAM,MAAM,8BAA8B,GAAG,iBAAiB,CAAC;IAC7D,eAAe,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF,wBAAgB,yBAAyB,CAAC,EAAE,KAAK,EAAE,EAAE,8BAA8B,qBA8HlF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useNavigation } from '@react-navigation/native';
|
|
2
|
-
import React, { useCallback, useEffect, useState, } from 'react';
|
|
3
|
-
import { StyleSheet, TextInput, View, } from 'react-native';
|
|
2
|
+
import React, { useCallback, useEffect, useState, useRef, } from 'react';
|
|
3
|
+
import { StyleSheet, TextInput, View, Pressable, } from 'react-native';
|
|
4
4
|
import { Heading, Icon, Person, Switch, Text } from '../components';
|
|
5
5
|
import { useSuspenseGet, useTheme } from '../hooks';
|
|
6
6
|
import { useConversation, useConversationMute, useConversationUpdate, } from '../hooks/use_conversation';
|
|
@@ -8,6 +8,7 @@ import { isDefined } from '../types';
|
|
|
8
8
|
import { HeaderRightButton } from '../navigation/header';
|
|
9
9
|
import { FlashList } from '@shopify/flash-list';
|
|
10
10
|
import { space } from '../utils';
|
|
11
|
+
import { tokens } from '../vendor/tapestry/tokens';
|
|
11
12
|
// =========================================
|
|
12
13
|
// ====== Factory Constants & Types ========
|
|
13
14
|
// =========================================
|
|
@@ -26,6 +27,8 @@ export function ConversationDetailsScreen({ route }) {
|
|
|
26
27
|
const [title, setTitle] = useState(conversation.title);
|
|
27
28
|
const { muted, setMuted } = useConversationMute(route.params);
|
|
28
29
|
const { mutate: saveTitle } = useConversationUpdate(route.params);
|
|
30
|
+
const trimmedTitle = title.trim();
|
|
31
|
+
const emptyTitle = trimmedTitle === '' || title === null;
|
|
29
32
|
const canUpdate = conversation.memberAbility?.canUpdate || false;
|
|
30
33
|
const { data: members } = useSuspenseGet({
|
|
31
34
|
url: `/me/conversations/${route.params.conversation_id}/members`,
|
|
@@ -42,12 +45,12 @@ export function ConversationDetailsScreen({ route }) {
|
|
|
42
45
|
}));
|
|
43
46
|
const HeaderRight = useCallback(() => {
|
|
44
47
|
return (<HeaderRightButton onPress={() => {
|
|
45
|
-
saveTitle({ title });
|
|
48
|
+
saveTitle({ title: trimmedTitle || conversation.title });
|
|
46
49
|
navigation.goBack();
|
|
47
50
|
}}>
|
|
48
51
|
Done
|
|
49
52
|
</HeaderRightButton>);
|
|
50
|
-
}, [navigation, saveTitle,
|
|
53
|
+
}, [conversation.title, navigation, saveTitle, trimmedTitle]);
|
|
51
54
|
useEffect(() => {
|
|
52
55
|
navigation.setOptions({
|
|
53
56
|
headerRight: HeaderRight,
|
|
@@ -57,8 +60,7 @@ export function ConversationDetailsScreen({ route }) {
|
|
|
57
60
|
{
|
|
58
61
|
type: SectionTypes.view,
|
|
59
62
|
data: {
|
|
60
|
-
children: <TitleInput canUpdate={canUpdate} title={title} setTitle={setTitle}
|
|
61
|
-
style: styles.titleContainer,
|
|
63
|
+
children: (<TitleInput canUpdate={canUpdate} title={title} setTitle={setTitle} isEmpty={emptyTitle}/>),
|
|
62
64
|
},
|
|
63
65
|
},
|
|
64
66
|
{
|
|
@@ -121,15 +123,27 @@ function SectionHeading({ title }) {
|
|
|
121
123
|
<Heading variant="h3">{title}</Heading>
|
|
122
124
|
</View>);
|
|
123
125
|
}
|
|
124
|
-
function TitleInput({ canUpdate, title, setTitle }) {
|
|
126
|
+
function TitleInput({ canUpdate, title, setTitle, style, isEmpty }) {
|
|
125
127
|
const styles = useStyles();
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
const textRef = useRef(null);
|
|
129
|
+
const handleFocus = () => {
|
|
130
|
+
if (textRef.current) {
|
|
131
|
+
textRef.current.focus();
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
return (<Pressable style={[styles.titleContainer, style]} onPress={() => handleFocus()}>
|
|
135
|
+
<View style={styles.titleLabelContainer}>
|
|
136
|
+
<Text variant="tertiary" style={styles.titleLabel}>
|
|
137
|
+
Title
|
|
138
|
+
</Text>
|
|
139
|
+
{!canUpdate && <Icon name="general.lock" style={styles.titleDisabledIcon}/>}
|
|
130
140
|
</View>
|
|
131
|
-
<TextInput editable={canUpdate} onChangeText={setTitle} style={[styles.titleInput, !canUpdate && styles.titleInputDisabled]} value={title}
|
|
132
|
-
|
|
141
|
+
<TextInput ref={textRef} editable={canUpdate} onChangeText={setTitle} style={[styles.titleInput, !canUpdate && styles.titleInputDisabled]} value={title} multiline maxLength={255} // Matches Chat Web
|
|
142
|
+
enterKeyHint="done" submitBehavior="blurAndSubmit"/>
|
|
143
|
+
{isEmpty && (<Text variant="footnote" style={styles.inputValidationText}>
|
|
144
|
+
A title is required for your conversation.
|
|
145
|
+
</Text>)}
|
|
146
|
+
</Pressable>);
|
|
133
147
|
}
|
|
134
148
|
function SettingRow({ title, style, titleStyle = {}, subtitle, rightItem, rightItemStyle = {}, }) {
|
|
135
149
|
const styles = useStyles();
|
|
@@ -172,17 +186,33 @@ const useStyles = ({ isStart, isEnd } = {}) => {
|
|
|
172
186
|
addBottomBorder: {
|
|
173
187
|
borderBottomWidth: isEnd ? 0 : 1,
|
|
174
188
|
},
|
|
175
|
-
titleContainer: {
|
|
176
|
-
|
|
189
|
+
titleContainer: {
|
|
190
|
+
gap: 4,
|
|
191
|
+
},
|
|
177
192
|
titleLabelContainer: {
|
|
178
193
|
flexDirection: 'row',
|
|
179
194
|
alignItems: 'center',
|
|
180
|
-
gap:
|
|
195
|
+
gap: 4,
|
|
196
|
+
},
|
|
197
|
+
titleLabel: {
|
|
198
|
+
color: colors.textColorDefaultSecondary,
|
|
199
|
+
},
|
|
200
|
+
titleDisabledIcon: {
|
|
201
|
+
color: colors.iconColorDefaultSecondary,
|
|
181
202
|
},
|
|
182
203
|
titleInput: {
|
|
183
204
|
color: colors.textColorDefaultPrimary,
|
|
205
|
+
fontSize: tokens.fontSizeMd,
|
|
206
|
+
},
|
|
207
|
+
titleInputDisabled: {
|
|
208
|
+
color: colors.textColorDefaultSecondary,
|
|
209
|
+
},
|
|
210
|
+
inputValidationText: {
|
|
211
|
+
color: colors.statusErrorText,
|
|
212
|
+
paddingTop: 8,
|
|
213
|
+
borderTopWidth: 1,
|
|
214
|
+
borderColor: colors.borderColorStatusError,
|
|
184
215
|
},
|
|
185
|
-
titleInputDisabled: { opacity: 0.7 },
|
|
186
216
|
header: {
|
|
187
217
|
paddingVertical: space(1.5),
|
|
188
218
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation_details_screen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} from '@react-navigation/native'\nimport React, {\n useCallback,\n useEffect,\n useState,\n type SetStateAction,\n type Dispatch,\n type ReactNode,\n} from 'react'\nimport {\n StyleSheet,\n TextInput,\n View,\n type TextStyle,\n type ViewStyle,\n type ViewProps,\n} from 'react-native'\nimport { Heading, Icon, Person, Switch, Text } from '../components'\nimport { useSuspenseGet, useTheme } from '../hooks'\nimport {\n useConversation,\n useConversationMute,\n useConversationUpdate,\n} from '../hooks/use_conversation'\nimport { MemberResource, isDefined } from '../types'\nimport { HeaderRightButton } from '../navigation/header'\nimport { FlashList } from '@shopify/flash-list'\nimport { space } from '../utils'\n\n// =========================================\n// ====== Factory Constants & Types ========\n// =========================================\n\nenum SectionTypes {\n header,\n hidden,\n members,\n setting,\n view,\n}\n\ntype SectionListData = Array<\n | DataItem<{ title: string }, SectionTypes.header>\n | DataItem<MemberResource, SectionTypes.members>\n | DataItem<ViewProps, SectionTypes.view>\n | DataItem<{ title: string }, SectionTypes.setting>\n | DataItem<any, SectionTypes.hidden>\n>\n\ninterface DataItem<T, TName extends SectionTypes> {\n type: TName\n data: T\n sectionStyle?: ViewStyle\n}\n\n// =================================\n// ====== Components ===============\n// =================================\n\nexport type ConversationDetailsScreenProps = StaticScreenProps<{\n conversation_id: number\n}>\n\nexport function ConversationDetailsScreen({ route }: ConversationDetailsScreenProps) {\n const navigation = useNavigation()\n const styles = useStyles()\n\n const { data: conversation } = useConversation(route.params)\n const [title, setTitle] = useState(conversation.title)\n const { muted, setMuted } = useConversationMute(route.params)\n const { mutate: saveTitle } = useConversationUpdate(route.params)\n\n const canUpdate = conversation.memberAbility?.canUpdate || false\n const { data: members } = useSuspenseGet<MemberResource[]>({\n url: `/me/conversations/${route.params.conversation_id}/members`,\n data: {\n include: ['person'],\n fields: {\n Member: ['avatar', 'name', 'first_name', 'last_name', 'child', 'badges'],\n },\n },\n })\n\n const memberItems = members.map(data => ({\n type: SectionTypes.members,\n data,\n }))\n\n const HeaderRight = useCallback(() => {\n return (\n <HeaderRightButton\n onPress={() => {\n saveTitle({ title })\n navigation.goBack()\n }}\n >\n Done\n </HeaderRightButton>\n )\n }, [navigation, saveTitle, title])\n\n useEffect(() => {\n navigation.setOptions({\n headerRight: HeaderRight,\n })\n }, [HeaderRight, navigation])\n\n const listData = [\n {\n type: SectionTypes.view,\n data: {\n children: <TitleInput canUpdate={canUpdate} title={title} setTitle={setTitle} />,\n style: styles.titleContainer,\n },\n },\n {\n type: SectionTypes.header,\n data: { title: 'Settings' },\n sectionStyle: styles.addBottomBorder,\n },\n {\n type: SectionTypes.setting,\n data: {\n title: 'Mute',\n rightItem: <Switch value={muted} onChange={() => setMuted(!muted)} />,\n },\n },\n {\n type: SectionTypes.header,\n data: { title: 'Members' },\n },\n ...memberItems,\n ].filter(item => item.type !== SectionTypes.hidden)\n\n const headerIndices = listData\n .map(({ type }, index) => (type === SectionTypes.header ? index : undefined))\n .filter(isDefined)\n\n return (\n <FlashList\n data={listData as SectionListData}\n estimatedItemSize={52}\n contentContainerStyle={styles.contentContainer}\n renderItem={({ item, index }) => {\n const [isStart, isEnd] = [\n index === 0 || headerIndices.includes(index),\n index === listData.length - 1 || headerIndices.includes(index + 1),\n ]\n\n switch (item.type) {\n case SectionTypes.header:\n return (\n <ListSection isStart={isStart} isEnd={isEnd} style={item?.sectionStyle}>\n <SectionHeading title={item.data.title} />\n </ListSection>\n )\n case SectionTypes.members:\n return (\n <ListSection isStart={isStart} isEnd={isEnd} style={item?.sectionStyle}>\n <Person person={{ ...item.data }} />\n </ListSection>\n )\n case SectionTypes.setting:\n return (\n <ListSection isStart={isStart} isEnd={isEnd} style={item?.sectionStyle}>\n <SettingRow {...item.data} />\n </ListSection>\n )\n case SectionTypes.view:\n return (\n <ListSection isStart={isStart} isEnd={isEnd} style={item?.sectionStyle}>\n <View {...item.data} style={item.data.style} />\n </ListSection>\n )\n default:\n return null\n }\n }}\n />\n )\n}\n\ninterface ListSectionProps {\n isStart?: boolean\n isEnd?: boolean\n style?: ViewStyle\n children: ReactNode\n}\n\nfunction ListSection({ isStart, isEnd, style, children }: ListSectionProps) {\n const styles = useStyles({ isStart, isEnd })\n\n return (\n <View style={styles.sectionOuter}>\n <View style={[styles.sectionInner, style]}>{children}</View>\n </View>\n )\n}\n\ninterface SectionHeadingProps {\n title: string\n}\n\nfunction SectionHeading({ title }: SectionHeadingProps) {\n const styles = useStyles()\n\n return (\n <View style={styles.header}>\n <Heading variant=\"h3\">{title}</Heading>\n </View>\n )\n}\n\ninterface InputProps {\n canUpdate: boolean\n title: string\n setTitle: Dispatch<SetStateAction<string>>\n}\n\nfunction TitleInput({ canUpdate, title, setTitle }: InputProps) {\n const styles = useStyles()\n return (\n <>\n <View style={[styles.titleLabelContainer, !canUpdate && styles.titleInputDisabled]}>\n <Text variant=\"tertiary\">Title</Text>\n {!canUpdate && <Icon name=\"general.lock\" />}\n </View>\n <TextInput\n editable={canUpdate}\n onChangeText={setTitle}\n style={[styles.titleInput, !canUpdate && styles.titleInputDisabled]}\n value={title}\n />\n </>\n )\n}\n\ninterface SettingRowProps {\n title: string\n style?: ViewStyle\n rightItem?: ReactNode\n titleStyle?: TextStyle\n subtitle?: string\n rightItemStyle?: ViewStyle\n}\n\nfunction SettingRow({\n title,\n style,\n titleStyle = {},\n subtitle,\n rightItem,\n rightItemStyle = {},\n}: SettingRowProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.settingRow, style]}>\n <View style={styles.settingRowContent}>\n <Text variant=\"plain\" style={[styles.settingRowText, titleStyle]}>\n {title}\n </Text>\n {Boolean(subtitle) && <Text variant=\"footnote\">{subtitle}</Text>}\n </View>\n {Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}\n </View>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({ isStart, isEnd }: { isStart?: boolean; isEnd?: boolean } = {}) => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n contentContainer: {\n backgroundColor: colors.fillColorNeutral080,\n padding: space(2),\n },\n sectionOuter: {\n paddingTop: space(1),\n paddingLeft: space(2),\n backgroundColor: colors.fillColorNeutral100Inverted,\n borderTopLeftRadius: isStart ? space(1) : 0,\n borderTopRightRadius: isStart ? space(1) : 0,\n borderBottomLeftRadius: isEnd ? space(1) : 0,\n borderBottomRightRadius: isEnd ? space(1) : 0,\n marginBottom: isEnd ? space(2) : 0,\n },\n sectionInner: {\n borderBottomWidth: 0,\n borderBottomColor: colors.borderColorDefaultBase,\n paddingRight: space(2),\n paddingBottom: space(1),\n },\n addBottomBorder: {\n borderBottomWidth: isEnd ? 0 : 1,\n },\n titleContainer: {},\n titleLabel: {},\n titleLabelContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n },\n titleInput: {\n color: colors.textColorDefaultPrimary,\n },\n titleInputDisabled: { opacity: 0.7 },\n header: {\n paddingVertical: space(1.5),\n },\n settingRow: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n gap: space(1),\n },\n settingRowContent: {\n flex: 1,\n },\n settingRowText: {\n lineHeight: 20,\n },\n member: {\n flexDirection: 'row',\n gap: space(1),\n },\n memberBody: {\n gap: space(0.5),\n },\n memberName: {\n lineHeight: space(2),\n },\n memberBadges: {\n flexDirection: 'row',\n gap: space(1),\n },\n memberBadge: {},\n })\n}\n"]}
|
|
1
|
+
{"version":3,"file":"conversation_details_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_details_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,EAAE,EACZ,WAAW,EACX,SAAS,EACT,QAAQ,EAIR,MAAM,GACP,MAAM,OAAO,CAAA;AACd,OAAO,EACL,UAAU,EACV,SAAS,EACT,IAAI,EAIJ,SAAS,GACV,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,E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MAAM,CAAC,UAAU;SAC5B;QACD,kBAAkB,EAAE;YAClB,KAAK,EAAE,MAAM,CAAC,yBAAyB;SACxC;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,MAAM,CAAC,eAAe;YAC7B,UAAU,EAAE,CAAC;YACb,cAAc,EAAE,CAAC;YACjB,WAAW,EAAE,MAAM,CAAC,sBAAsB;SAC3C;QACD,MAAM,EAAE;YACN,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC;SAC5B;QACD,UAAU,EAAE;YACV,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,eAAe;YAC/B,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;SACd;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,CAAC;SACR;QACD,cAAc,EAAE;YACd,UAAU,EAAE,EAAE;SACf;QACD,MAAM,EAAE;YACN,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;SACd;QACD,UAAU,EAAE;YACV,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;SAChB;QACD,UAAU,EAAE;YACV,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;SACrB;QACD,YAAY,EAAE;YACZ,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;SACd;QACD,WAAW,EAAE,EAAE;KAChB,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React, {\n useCallback,\n useEffect,\n useState,\n type SetStateAction,\n type Dispatch,\n type ReactNode,\n useRef,\n} from 'react'\nimport {\n StyleSheet,\n TextInput,\n View,\n type TextStyle,\n type ViewStyle,\n type ViewProps,\n Pressable,\n} from 'react-native'\nimport { Heading, Icon, Person, Switch, Text } from '../components'\nimport { useSuspenseGet, useTheme } from '../hooks'\nimport {\n useConversation,\n useConversationMute,\n useConversationUpdate,\n} from '../hooks/use_conversation'\nimport { MemberResource, isDefined } from '../types'\nimport { HeaderRightButton } from '../navigation/header'\nimport { FlashList } from '@shopify/flash-list'\nimport { space } from '../utils'\nimport { tokens } from '../vendor/tapestry/tokens'\n\n// =========================================\n// ====== Factory Constants & Types ========\n// =========================================\n\nenum SectionTypes {\n header,\n hidden,\n members,\n setting,\n view,\n}\n\ntype SectionListData = Array<\n | DataItem<{ title: string }, SectionTypes.header>\n | DataItem<MemberResource, SectionTypes.members>\n | DataItem<ViewProps, SectionTypes.view>\n | DataItem<{ title: string }, SectionTypes.setting>\n | DataItem<any, SectionTypes.hidden>\n>\n\ninterface DataItem<T, TName extends SectionTypes> {\n type: TName\n data: T\n sectionStyle?: ViewStyle\n}\n\n// =================================\n// ====== Components ===============\n// =================================\n\nexport type ConversationDetailsScreenProps = StaticScreenProps<{\n conversation_id: number\n}>\n\nexport function ConversationDetailsScreen({ route }: ConversationDetailsScreenProps) {\n const navigation = useNavigation()\n const styles = useStyles()\n\n const { data: conversation } = useConversation(route.params)\n const [title, setTitle] = useState(conversation.title)\n const { muted, setMuted } = useConversationMute(route.params)\n const { mutate: saveTitle } = useConversationUpdate(route.params)\n\n const trimmedTitle = title.trim()\n const emptyTitle = trimmedTitle === '' || title === null\n\n const canUpdate = conversation.memberAbility?.canUpdate || false\n const { data: members } = useSuspenseGet<MemberResource[]>({\n url: `/me/conversations/${route.params.conversation_id}/members`,\n data: {\n include: ['person'],\n fields: {\n Member: ['avatar', 'name', 'first_name', 'last_name', 'child', 'badges'],\n },\n },\n })\n\n const memberItems = members.map(data => ({\n type: SectionTypes.members,\n data,\n }))\n\n const HeaderRight = useCallback(() => {\n return (\n <HeaderRightButton\n onPress={() => {\n saveTitle({ title: trimmedTitle || conversation.title })\n navigation.goBack()\n }}\n >\n Done\n </HeaderRightButton>\n )\n }, [conversation.title, navigation, saveTitle, trimmedTitle])\n\n useEffect(() => {\n navigation.setOptions({\n headerRight: HeaderRight,\n })\n }, [HeaderRight, navigation])\n\n const listData = [\n {\n type: SectionTypes.view,\n data: {\n children: (\n <TitleInput\n canUpdate={canUpdate}\n title={title}\n setTitle={setTitle}\n isEmpty={emptyTitle}\n />\n ),\n },\n },\n {\n type: SectionTypes.header,\n data: { title: 'Settings' },\n sectionStyle: styles.addBottomBorder,\n },\n {\n type: SectionTypes.setting,\n data: {\n title: 'Mute',\n rightItem: <Switch value={muted} onChange={() => setMuted(!muted)} />,\n },\n },\n {\n type: SectionTypes.header,\n data: { title: 'Members' },\n },\n ...memberItems,\n ].filter(item => item.type !== SectionTypes.hidden)\n\n const headerIndices = listData\n .map(({ type }, index) => (type === SectionTypes.header ? index : undefined))\n .filter(isDefined)\n\n return (\n <FlashList\n data={listData as SectionListData}\n estimatedItemSize={52}\n contentContainerStyle={styles.contentContainer}\n renderItem={({ item, index }) => {\n const [isStart, isEnd] = [\n index === 0 || headerIndices.includes(index),\n index === listData.length - 1 || headerIndices.includes(index + 1),\n ]\n\n switch (item.type) {\n case SectionTypes.header:\n return (\n <ListSection isStart={isStart} isEnd={isEnd} style={item?.sectionStyle}>\n <SectionHeading title={item.data.title} />\n </ListSection>\n )\n case SectionTypes.members:\n return (\n <ListSection isStart={isStart} isEnd={isEnd} style={item?.sectionStyle}>\n <Person person={{ ...item.data }} />\n </ListSection>\n )\n case SectionTypes.setting:\n return (\n <ListSection isStart={isStart} isEnd={isEnd} style={item?.sectionStyle}>\n <SettingRow {...item.data} />\n </ListSection>\n )\n case SectionTypes.view:\n return (\n <ListSection isStart={isStart} isEnd={isEnd} style={item?.sectionStyle}>\n <View {...item.data} style={item.data.style} />\n </ListSection>\n )\n default:\n return null\n }\n }}\n />\n )\n}\n\ninterface ListSectionProps {\n isStart?: boolean\n isEnd?: boolean\n style?: ViewStyle\n children: ReactNode\n}\n\nfunction ListSection({ isStart, isEnd, style, children }: ListSectionProps) {\n const styles = useStyles({ isStart, isEnd })\n\n return (\n <View style={styles.sectionOuter}>\n <View style={[styles.sectionInner, style]}>{children}</View>\n </View>\n )\n}\n\ninterface SectionHeadingProps {\n title: string\n}\n\nfunction SectionHeading({ title }: SectionHeadingProps) {\n const styles = useStyles()\n\n return (\n <View style={styles.header}>\n <Heading variant=\"h3\">{title}</Heading>\n </View>\n )\n}\n\ninterface InputProps {\n canUpdate: boolean\n title: string\n setTitle: Dispatch<SetStateAction<string>>\n style?: ViewStyle\n isEmpty: boolean\n}\n\nfunction TitleInput({ canUpdate, title, setTitle, style, isEmpty }: InputProps) {\n const styles = useStyles()\n const textRef = useRef<TextInput>(null)\n\n const handleFocus = () => {\n if (textRef.current) {\n textRef.current.focus()\n }\n }\n\n return (\n <Pressable style={[styles.titleContainer, style]} onPress={() => handleFocus()}>\n <View style={styles.titleLabelContainer}>\n <Text variant=\"tertiary\" style={styles.titleLabel}>\n Title\n </Text>\n {!canUpdate && <Icon name=\"general.lock\" style={styles.titleDisabledIcon} />}\n </View>\n <TextInput\n ref={textRef}\n editable={canUpdate}\n onChangeText={setTitle}\n style={[styles.titleInput, !canUpdate && styles.titleInputDisabled]}\n value={title}\n multiline\n maxLength={255} // Matches Chat Web\n enterKeyHint=\"done\"\n submitBehavior=\"blurAndSubmit\"\n />\n {isEmpty && (\n <Text variant=\"footnote\" style={styles.inputValidationText}>\n A title is required for your conversation.\n </Text>\n )}\n </Pressable>\n )\n}\n\ninterface SettingRowProps {\n title: string\n style?: ViewStyle\n rightItem?: ReactNode\n titleStyle?: TextStyle\n subtitle?: string\n rightItemStyle?: ViewStyle\n}\n\nfunction SettingRow({\n title,\n style,\n titleStyle = {},\n subtitle,\n rightItem,\n rightItemStyle = {},\n}: SettingRowProps) {\n const styles = useStyles()\n\n return (\n <View style={[styles.settingRow, style]}>\n <View style={styles.settingRowContent}>\n <Text variant=\"plain\" style={[styles.settingRowText, titleStyle]}>\n {title}\n </Text>\n {Boolean(subtitle) && <Text variant=\"footnote\">{subtitle}</Text>}\n </View>\n {Boolean(rightItem) && <View style={rightItemStyle}>{rightItem}</View>}\n </View>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({ isStart, isEnd }: { isStart?: boolean; isEnd?: boolean } = {}) => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n contentContainer: {\n backgroundColor: colors.fillColorNeutral080,\n padding: space(2),\n },\n sectionOuter: {\n paddingTop: space(1),\n paddingLeft: space(2),\n backgroundColor: colors.fillColorNeutral100Inverted,\n borderTopLeftRadius: isStart ? space(1) : 0,\n borderTopRightRadius: isStart ? space(1) : 0,\n borderBottomLeftRadius: isEnd ? space(1) : 0,\n borderBottomRightRadius: isEnd ? space(1) : 0,\n marginBottom: isEnd ? space(2) : 0,\n },\n sectionInner: {\n borderBottomWidth: 0,\n borderBottomColor: colors.borderColorDefaultBase,\n paddingRight: space(2),\n paddingBottom: space(1),\n },\n addBottomBorder: {\n borderBottomWidth: isEnd ? 0 : 1,\n },\n titleContainer: {\n gap: 4,\n },\n titleLabelContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 4,\n },\n titleLabel: {\n color: colors.textColorDefaultSecondary,\n },\n titleDisabledIcon: {\n color: colors.iconColorDefaultSecondary,\n },\n titleInput: {\n color: colors.textColorDefaultPrimary,\n fontSize: tokens.fontSizeMd,\n },\n titleInputDisabled: {\n color: colors.textColorDefaultSecondary,\n },\n inputValidationText: {\n color: colors.statusErrorText,\n paddingTop: 8,\n borderTopWidth: 1,\n borderColor: colors.borderColorStatusError,\n },\n header: {\n paddingVertical: space(1.5),\n },\n settingRow: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n gap: space(1),\n },\n settingRowContent: {\n flex: 1,\n },\n settingRowText: {\n lineHeight: 20,\n },\n member: {\n flexDirection: 'row',\n gap: space(1),\n },\n memberBody: {\n gap: space(0.5),\n },\n memberName: {\n lineHeight: space(2),\n },\n memberBadges: {\n flexDirection: 'row',\n gap: space(1),\n },\n memberBadge: {},\n })\n}\n"]}
|
package/build/utils/theme.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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E,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,sBAAsB,EAAE,MAAM,CAAA;CAC/B"}
|
package/build/utils/theme.js
CHANGED
|
@@ -38,6 +38,7 @@ const colorsChatLight = {
|
|
|
38
38
|
statusNeutralIcon: tokens.iconColorStatusNeutralPrimary,
|
|
39
39
|
statusNeutralText: tokens.textColorStatusNeutral,
|
|
40
40
|
statusNeutralBackground: tokens.fillColorStatusNeutralGhost,
|
|
41
|
+
borderColorStatusError: tokens.borderColorStatusError,
|
|
41
42
|
};
|
|
42
43
|
const colorsChatDark = {
|
|
43
44
|
name: 'dark',
|
|
@@ -63,6 +64,7 @@ const colorsChatDark = {
|
|
|
63
64
|
statusNeutralIcon: tokens.iconColorStatusNeutralPrimaryDark,
|
|
64
65
|
statusNeutralText: tokens.textColorStatusNeutralDark,
|
|
65
66
|
statusNeutralBackground: tokens.fillColorStatusNeutralGhostDark,
|
|
67
|
+
borderColorStatusError: tokens.borderColorStatusErrorDark,
|
|
66
68
|
};
|
|
67
69
|
const chatThemeColorMap = {
|
|
68
70
|
light: colorsChatLight,
|
package/build/utils/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MA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AA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,eAAe,EAAE,MAAM,CAAC,+BAA+B;IACvD,eAAe,EAAE,MAAM,CAAC,wBAAwB;IAChD,qBAAqB,EAAE,MAAM,CAAC,6BAA6B;IAC3D,iBAAiB,EAAE,MAAM,CAAC,iCAAiC;IAC3D,iBAAiB,EAAE,MAAM,CAAC,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,sBAAsB,EAAE,MAAM,CAAC,0BAA0B;CAC1D,CAAA;AAED,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;CACrB,CAAA","sourcesContent":["import { ColorSchemeName } from 'react-native'\nimport { tokens } from '../vendor/tapestry/tokens'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\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 showBadgeLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName): ChatTheme => {\n const scheme = colorScheme || '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 showBadgeLogo: 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 switchTrackTrue: string | undefined\n switchTrackFalse: string | undefined\n switchThumbColor: string | undefined\n testColor: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBackground: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBackground: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBackground: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBackground: string\n statusNeutralIcon: string\n statusNeutralText: string\n statusNeutralBackground: string\n borderColorStatusError: string\n}\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n switchTrackTrue: undefined,\n switchTrackFalse: undefined,\n switchThumbColor: undefined,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBackground: tokens.fillColorStatusWarningGhost,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimary,\n statusNeutralText: tokens.textColorStatusNeutral,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhost,\n borderColorStatusError: tokens.borderColorStatusError,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n switchTrackTrue: undefined,\n switchTrackFalse: undefined,\n switchThumbColor: undefined,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimaryDark,\n statusNeutralText: tokens.textColorStatusNeutralDark,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorStatusError: tokens.borderColorStatusErrorDark,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"]}
|
|
@@ -49,6 +49,8 @@ export declare const tokens: {
|
|
|
49
49
|
colorNeutral95: "hsl(0, 0%, 95%)";
|
|
50
50
|
colorNeutral97: "hsl(0, 0%, 97%)";
|
|
51
51
|
colorNeutral98: "hsl(0, 0%, 98%)";
|
|
52
|
+
borderColorStatusError: "hsl(8, 60%, 47%)";
|
|
53
|
+
borderColorStatusErrorDark: "hsl(8, 60%, 55%)";
|
|
52
54
|
colorNeutral100White: "hsl(0, 0%, 100%)";
|
|
53
55
|
fillColorInteractionDefault: "hsl(204, 100%, 40%)";
|
|
54
56
|
fillColorStatusNeutralGhost: "hsl(0, 0%, 93%)";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"AAuHA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKlB,CAAA"}
|
|
@@ -19,6 +19,8 @@ const colorPrimitives = {
|
|
|
19
19
|
colorNeutral95: 'hsl(0, 0%, 95%)',
|
|
20
20
|
colorNeutral97: 'hsl(0, 0%, 97%)',
|
|
21
21
|
colorNeutral98: 'hsl(0, 0%, 98%)',
|
|
22
|
+
borderColorStatusError: 'hsl(8, 60%, 47%)',
|
|
23
|
+
borderColorStatusErrorDark: 'hsl(8, 60%, 55%)',
|
|
22
24
|
colorNeutral100White: 'hsl(0, 0%, 100%)',
|
|
23
25
|
fillColorInteractionDefault: 'hsl(204, 100%, 40%)',
|
|
24
26
|
fillColorStatusNeutralGhost: 'hsl(0, 0%, 93%)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,2FAA2F;AAC3F,0GAA0G;AAE1G,MAAM,eAAe,GAAG;IACtB,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,oBAAoB,EAAE,kBAAkB;IACxC,2BAA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;IACnB,GAAG,cAAc;IACjB,GAAG,eAAe;CACnB,CAAA","sourcesContent":["// Copied from `@planningcenter/tapestry` package.\n// Defining these tokens locally is a temporary solution until the package supports mobile.\n// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs\n\nconst colorPrimitives = {\n colorNeutral7: 'hsl(0, 0%, 7%)',\n colorNeutral12: 'hsl(0, 0%, 12%)',\n colorNeutral15: 'hsl(0, 0%, 15%)',\n colorNeutral17: 'hsl(0, 0%, 17%)',\n colorNeutral19: 'hsl(0, 0%, 19%)',\n colorNeutral24: 'hsl(0, 0%, 24%)',\n colorNeutral32: 'hsl(0, 0%, 32%)',\n colorNeutral45: 'hsl(0, 0%, 45%)',\n colorNeutral50: 'hsl(0, 0%, 50%)',\n colorNeutral58: 'hsl(0, 0%, 58%)',\n colorNeutral68: 'hsl(0, 0%, 68%)',\n colorNeutral81: 'hsl(0, 0%, 81%)',\n colorNeutral88: 'hsl(0, 0%, 88%)',\n colorNeutral93: 'hsl(0, 0%, 93%)',\n colorNeutral95: 'hsl(0, 0%, 95%)',\n colorNeutral97: 'hsl(0, 0%, 97%)',\n colorNeutral98: 'hsl(0, 0%, 98%)',\n colorNeutral100White: 'hsl(0, 0%, 100%)',\n fillColorInteractionDefault: 'hsl(204, 100%, 40%)',\n fillColorStatusNeutralGhost: 'hsl(0, 0%, 93%)',\n fillColorStatusNeutralGhostDark: 'hsl(0, 0%, 18%)',\n textColorStatusNeutral: 'hsl(0, 0%, 24%)',\n textColorStatusNeutralDark: 'hsl(0, 0%, 80%)',\n iconColorStatusNeutralPrimary: 'hsl(0, 0%, 45%)',\n iconColorStatusNeutralPrimaryDark: 'hsl(0, 0%, 54%)',\n fillColorStatusErrorGhost: 'hsl(9, 59%, 93%)',\n fillColorStatusErrorGhostDark: 'hsl(8, 20%, 16%)',\n textColorStatusError: 'hsl(8, 60%, 45%)',\n textColorStatusErrorDark: 'hsl(8, 61%, 61%)',\n iconColorStatusErrorPrimary: 'hsl(8, 60%, 47%)',\n iconColorStatusErrorPrimaryDark: 'hsl(8, 60%, 55%)',\n fillColorStatusWarningGhost: 'hsl(42, 87%, 94%)',\n fillColorStatusWarningGhostDark: 'hsl(41, 18%, 17%)',\n textColorStatusWarning: 'hsl(42, 100%, 29%)',\n textColorStatusWarningDark: 'hsl(42, 84%, 55%)',\n iconColorStatusWarningPrimary: 'hsl(42, 84%, 49%)',\n iconColorStatusWarningPrimaryDark: 'hsl(42, 84%, 49%)',\n fillColorStatusSuccessGhost: 'hsl(97, 57%, 90%)',\n fillColorStatusSuccessGhostDark: 'hsl(125, 17%, 15%)',\n textColorStatusSuccess: 'hsl(97, 57%, 28%)',\n textColorStatusSuccessDark: 'hsl(97, 57%, 41%)',\n iconColorStatusSuccessPrimary: 'hsl(96, 57%, 33%)',\n iconColorStatusSuccessPrimaryDark: 'hsl(96, 57%, 41%)',\n fillColorStatusInfoGhost: 'hsl(203, 94%, 94%)',\n fillColorStatusInfoGhostDark: 'hsl(204, 32%, 15%)',\n textColorStatusInfo: 'hsl(204, 100%, 35%)',\n textColorStatusInfoDark: 'hsl(204, 68%, 55%)',\n iconColorStatusInfoPrimary: 'hsl(204, 100%, 40%)',\n iconColorStatusInfoPrimaryDark: 'hsl(204, 78%, 38%)',\n fillColorTransparencyLight010: 'hsla(0, 0%, 100%, 0.1)',\n fillColorTransparencyLight020: 'hsla(0, 0%, 100%, 0.2)',\n fillColorTransparencyLight030: 'hsla(0, 0%, 100%, 0.3)',\n fillColorTransparencyLight040: 'hsla(0, 0%, 100%, 0.4)',\n fillColorTransparencyLight050: 'hsla(0, 0%, 100%, 0.5)',\n fillColorTransparencyLight060: 'hsla(0, 0%, 100%, 0.6)',\n fillColorTransparencyLight070: 'hsla(0, 0%, 100%, 0.7)',\n fillColorTransparencyLight080: 'hsla(0, 0%, 100%, 0.8)',\n fillColorTransparencyLight090: 'hsla(0, 0%, 100%, 0.9)',\n fillColorTransparencyDark010: 'hsla(0, 0%, 0%, 0.1)',\n fillColorTransparencyDark020: 'hsla(0, 0%, 0%, 0.2)',\n fillColorTransparencyDark030: 'hsla(0, 0%, 0%, 0.3)',\n fillColorTransparencyDark040: 'hsla(0, 0%, 0%, 0.4)',\n fillColorTransparencyDark050: 'hsla(0, 0%, 0%, 0.5)',\n fillColorTransparencyDark060: 'hsla(0, 0%, 0%, 0.6)',\n fillColorTransparencyDark070: 'hsla(0, 0%, 0%, 0.7)',\n fillColorTransparencyDark080: 'hsla(0, 0%, 0%, 0.8)',\n fillColorTransparencyDark090: 'hsla(0, 0%, 0%, 0.9)',\n} as const\n\nconst numericPrimtives = {\n spacingFourth: 2,\n spacingHalf: 4,\n spacing1: 8,\n spacing2: 16,\n spacing3: 24,\n spacing4: 32,\n spacing5: 40,\n spacing6: 48,\n spacing7: 56,\n borderRadiusSm: 2,\n borderRadiusMd: 4,\n borderRadiusLg: 8,\n borderRadiusXl: 16,\n borderRadiusRound: 56,\n borderSizeDefault: 1,\n borderSizeThick: 2,\n fontWeightNormal: '400',\n fontWeightMedium: '500',\n fontWeightSemiBold: '600',\n fontWeightBold: '700',\n fontSize4xl: 32,\n fontSize3xl: 28,\n fontSize2xl: 24,\n fontSizeXl: 20,\n fontSizeLg: 18,\n fontSizeMd: 16,\n fontSizeSm: 14,\n fontSizeXs: 12,\n fontSize2xs: 10,\n} as const\n\nconst numericAliases = {\n borderRadiusDefault: numericPrimtives.borderRadiusMd,\n} as const\n\n// These tokens are specfic to Chat will not be replaced by the Tapestry library\nconst localChatTokens = {\n colorInteractionOnlineDefault: 'hsl(123, 38%, 57%)',\n fillColorInteractionDefaultDark: 'hsl(204, 100%, 40%)',\n fillColorStatusErrorMedium: 'hsl(0, 72%, 45%)',\n} as const\n\nexport const tokens = {\n ...colorPrimitives,\n ...numericPrimtives,\n ...numericAliases,\n ...localChatTokens,\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"A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AE,CAAC;IAClB,gBAAgB,EAAE,KAAK;IACvB,gBAAgB,EAAE,KAAK;IACvB,kBAAkB,EAAE,KAAK;IACzB,cAAc,EAAE,KAAK;IACrB,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;IACf,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,EAAE;CACP,CAAA;AAEV,MAAM,cAAc,GAAG;IACrB,mBAAmB,EAAE,gBAAgB,CAAC,cAAc;CAC5C,CAAA;AAEV,gFAAgF;AAChF,MAAM,eAAe,GAAG;IACtB,6BAA6B,EAAE,oBAAoB;IACnD,+BAA+B,EAAE,qBAAqB;IACtD,0BAA0B,EAAE,kBAAkB;CACtC,CAAA;AAEV,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,GAAG,eAAe;IAClB,GAAG,gBAAgB;IACnB,GAAG,cAAc;IACjB,GAAG,eAAe;CACnB,CAAA","sourcesContent":["// Copied from `@planningcenter/tapestry` package.\n// Defining these tokens locally is a temporary solution until the package supports mobile.\n// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs\n\nconst colorPrimitives = {\n colorNeutral7: 'hsl(0, 0%, 7%)',\n colorNeutral12: 'hsl(0, 0%, 12%)',\n colorNeutral15: 'hsl(0, 0%, 15%)',\n colorNeutral17: 'hsl(0, 0%, 17%)',\n colorNeutral19: 'hsl(0, 0%, 19%)',\n colorNeutral24: 'hsl(0, 0%, 24%)',\n colorNeutral32: 'hsl(0, 0%, 32%)',\n colorNeutral45: 'hsl(0, 0%, 45%)',\n colorNeutral50: 'hsl(0, 0%, 50%)',\n colorNeutral58: 'hsl(0, 0%, 58%)',\n colorNeutral68: 'hsl(0, 0%, 68%)',\n colorNeutral81: 'hsl(0, 0%, 81%)',\n colorNeutral88: 'hsl(0, 0%, 88%)',\n colorNeutral93: 'hsl(0, 0%, 93%)',\n colorNeutral95: 'hsl(0, 0%, 95%)',\n colorNeutral97: 'hsl(0, 0%, 97%)',\n colorNeutral98: 'hsl(0, 0%, 98%)',\n borderColorStatusError: 'hsl(8, 60%, 47%)',\n borderColorStatusErrorDark: 'hsl(8, 60%, 55%)',\n colorNeutral100White: 'hsl(0, 0%, 100%)',\n fillColorInteractionDefault: 'hsl(204, 100%, 40%)',\n fillColorStatusNeutralGhost: 'hsl(0, 0%, 93%)',\n fillColorStatusNeutralGhostDark: 'hsl(0, 0%, 18%)',\n textColorStatusNeutral: 'hsl(0, 0%, 24%)',\n textColorStatusNeutralDark: 'hsl(0, 0%, 80%)',\n iconColorStatusNeutralPrimary: 'hsl(0, 0%, 45%)',\n iconColorStatusNeutralPrimaryDark: 'hsl(0, 0%, 54%)',\n fillColorStatusErrorGhost: 'hsl(9, 59%, 93%)',\n fillColorStatusErrorGhostDark: 'hsl(8, 20%, 16%)',\n textColorStatusError: 'hsl(8, 60%, 45%)',\n textColorStatusErrorDark: 'hsl(8, 61%, 61%)',\n iconColorStatusErrorPrimary: 'hsl(8, 60%, 47%)',\n iconColorStatusErrorPrimaryDark: 'hsl(8, 60%, 55%)',\n fillColorStatusWarningGhost: 'hsl(42, 87%, 94%)',\n fillColorStatusWarningGhostDark: 'hsl(41, 18%, 17%)',\n textColorStatusWarning: 'hsl(42, 100%, 29%)',\n textColorStatusWarningDark: 'hsl(42, 84%, 55%)',\n iconColorStatusWarningPrimary: 'hsl(42, 84%, 49%)',\n iconColorStatusWarningPrimaryDark: 'hsl(42, 84%, 49%)',\n fillColorStatusSuccessGhost: 'hsl(97, 57%, 90%)',\n fillColorStatusSuccessGhostDark: 'hsl(125, 17%, 15%)',\n textColorStatusSuccess: 'hsl(97, 57%, 28%)',\n textColorStatusSuccessDark: 'hsl(97, 57%, 41%)',\n iconColorStatusSuccessPrimary: 'hsl(96, 57%, 33%)',\n iconColorStatusSuccessPrimaryDark: 'hsl(96, 57%, 41%)',\n fillColorStatusInfoGhost: 'hsl(203, 94%, 94%)',\n fillColorStatusInfoGhostDark: 'hsl(204, 32%, 15%)',\n textColorStatusInfo: 'hsl(204, 100%, 35%)',\n textColorStatusInfoDark: 'hsl(204, 68%, 55%)',\n iconColorStatusInfoPrimary: 'hsl(204, 100%, 40%)',\n iconColorStatusInfoPrimaryDark: 'hsl(204, 78%, 38%)',\n fillColorTransparencyLight010: 'hsla(0, 0%, 100%, 0.1)',\n fillColorTransparencyLight020: 'hsla(0, 0%, 100%, 0.2)',\n fillColorTransparencyLight030: 'hsla(0, 0%, 100%, 0.3)',\n fillColorTransparencyLight040: 'hsla(0, 0%, 100%, 0.4)',\n fillColorTransparencyLight050: 'hsla(0, 0%, 100%, 0.5)',\n fillColorTransparencyLight060: 'hsla(0, 0%, 100%, 0.6)',\n fillColorTransparencyLight070: 'hsla(0, 0%, 100%, 0.7)',\n fillColorTransparencyLight080: 'hsla(0, 0%, 100%, 0.8)',\n fillColorTransparencyLight090: 'hsla(0, 0%, 100%, 0.9)',\n fillColorTransparencyDark010: 'hsla(0, 0%, 0%, 0.1)',\n fillColorTransparencyDark020: 'hsla(0, 0%, 0%, 0.2)',\n fillColorTransparencyDark030: 'hsla(0, 0%, 0%, 0.3)',\n fillColorTransparencyDark040: 'hsla(0, 0%, 0%, 0.4)',\n fillColorTransparencyDark050: 'hsla(0, 0%, 0%, 0.5)',\n fillColorTransparencyDark060: 'hsla(0, 0%, 0%, 0.6)',\n fillColorTransparencyDark070: 'hsla(0, 0%, 0%, 0.7)',\n fillColorTransparencyDark080: 'hsla(0, 0%, 0%, 0.8)',\n fillColorTransparencyDark090: 'hsla(0, 0%, 0%, 0.9)',\n} as const\n\nconst numericPrimtives = {\n spacingFourth: 2,\n spacingHalf: 4,\n spacing1: 8,\n spacing2: 16,\n spacing3: 24,\n spacing4: 32,\n spacing5: 40,\n spacing6: 48,\n spacing7: 56,\n borderRadiusSm: 2,\n borderRadiusMd: 4,\n borderRadiusLg: 8,\n borderRadiusXl: 16,\n borderRadiusRound: 56,\n borderSizeDefault: 1,\n borderSizeThick: 2,\n fontWeightNormal: '400',\n fontWeightMedium: '500',\n fontWeightSemiBold: '600',\n fontWeightBold: '700',\n fontSize4xl: 32,\n fontSize3xl: 28,\n fontSize2xl: 24,\n fontSizeXl: 20,\n fontSizeLg: 18,\n fontSizeMd: 16,\n fontSizeSm: 14,\n fontSizeXs: 12,\n fontSize2xs: 10,\n} as const\n\nconst numericAliases = {\n borderRadiusDefault: numericPrimtives.borderRadiusMd,\n} as const\n\n// These tokens are specfic to Chat will not be replaced by the Tapestry library\nconst localChatTokens = {\n colorInteractionOnlineDefault: 'hsl(123, 38%, 57%)',\n fillColorInteractionDefaultDark: 'hsl(204, 100%, 40%)',\n fillColorStatusErrorMedium: 'hsl(0, 72%, 45%)',\n} as const\n\nexport const tokens = {\n ...colorPrimitives,\n ...numericPrimtives,\n ...numericAliases,\n ...localChatTokens,\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "3.1.0-rc.
|
|
3
|
+
"version": "3.1.0-rc.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"prettier": "^3.4.2",
|
|
53
53
|
"typescript": "<5.6.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "ce8c868189704488e7926a099c730b47d04af0a5"
|
|
56
56
|
}
|
|
@@ -6,6 +6,7 @@ import React, {
|
|
|
6
6
|
type SetStateAction,
|
|
7
7
|
type Dispatch,
|
|
8
8
|
type ReactNode,
|
|
9
|
+
useRef,
|
|
9
10
|
} from 'react'
|
|
10
11
|
import {
|
|
11
12
|
StyleSheet,
|
|
@@ -14,6 +15,7 @@ import {
|
|
|
14
15
|
type TextStyle,
|
|
15
16
|
type ViewStyle,
|
|
16
17
|
type ViewProps,
|
|
18
|
+
Pressable,
|
|
17
19
|
} from 'react-native'
|
|
18
20
|
import { Heading, Icon, Person, Switch, Text } from '../components'
|
|
19
21
|
import { useSuspenseGet, useTheme } from '../hooks'
|
|
@@ -26,6 +28,7 @@ import { MemberResource, isDefined } from '../types'
|
|
|
26
28
|
import { HeaderRightButton } from '../navigation/header'
|
|
27
29
|
import { FlashList } from '@shopify/flash-list'
|
|
28
30
|
import { space } from '../utils'
|
|
31
|
+
import { tokens } from '../vendor/tapestry/tokens'
|
|
29
32
|
|
|
30
33
|
// =========================================
|
|
31
34
|
// ====== Factory Constants & Types ========
|
|
@@ -70,6 +73,9 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
70
73
|
const { muted, setMuted } = useConversationMute(route.params)
|
|
71
74
|
const { mutate: saveTitle } = useConversationUpdate(route.params)
|
|
72
75
|
|
|
76
|
+
const trimmedTitle = title.trim()
|
|
77
|
+
const emptyTitle = trimmedTitle === '' || title === null
|
|
78
|
+
|
|
73
79
|
const canUpdate = conversation.memberAbility?.canUpdate || false
|
|
74
80
|
const { data: members } = useSuspenseGet<MemberResource[]>({
|
|
75
81
|
url: `/me/conversations/${route.params.conversation_id}/members`,
|
|
@@ -90,14 +96,14 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
90
96
|
return (
|
|
91
97
|
<HeaderRightButton
|
|
92
98
|
onPress={() => {
|
|
93
|
-
saveTitle({ title })
|
|
99
|
+
saveTitle({ title: trimmedTitle || conversation.title })
|
|
94
100
|
navigation.goBack()
|
|
95
101
|
}}
|
|
96
102
|
>
|
|
97
103
|
Done
|
|
98
104
|
</HeaderRightButton>
|
|
99
105
|
)
|
|
100
|
-
}, [navigation, saveTitle,
|
|
106
|
+
}, [conversation.title, navigation, saveTitle, trimmedTitle])
|
|
101
107
|
|
|
102
108
|
useEffect(() => {
|
|
103
109
|
navigation.setOptions({
|
|
@@ -109,8 +115,14 @@ export function ConversationDetailsScreen({ route }: ConversationDetailsScreenPr
|
|
|
109
115
|
{
|
|
110
116
|
type: SectionTypes.view,
|
|
111
117
|
data: {
|
|
112
|
-
children:
|
|
113
|
-
|
|
118
|
+
children: (
|
|
119
|
+
<TitleInput
|
|
120
|
+
canUpdate={canUpdate}
|
|
121
|
+
title={title}
|
|
122
|
+
setTitle={setTitle}
|
|
123
|
+
isEmpty={emptyTitle}
|
|
124
|
+
/>
|
|
125
|
+
),
|
|
114
126
|
},
|
|
115
127
|
},
|
|
116
128
|
{
|
|
@@ -215,23 +227,45 @@ interface InputProps {
|
|
|
215
227
|
canUpdate: boolean
|
|
216
228
|
title: string
|
|
217
229
|
setTitle: Dispatch<SetStateAction<string>>
|
|
230
|
+
style?: ViewStyle
|
|
231
|
+
isEmpty: boolean
|
|
218
232
|
}
|
|
219
233
|
|
|
220
|
-
function TitleInput({ canUpdate, title, setTitle }: InputProps) {
|
|
234
|
+
function TitleInput({ canUpdate, title, setTitle, style, isEmpty }: InputProps) {
|
|
221
235
|
const styles = useStyles()
|
|
236
|
+
const textRef = useRef<TextInput>(null)
|
|
237
|
+
|
|
238
|
+
const handleFocus = () => {
|
|
239
|
+
if (textRef.current) {
|
|
240
|
+
textRef.current.focus()
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
222
244
|
return (
|
|
223
|
-
|
|
224
|
-
<View style={
|
|
225
|
-
<Text variant="tertiary">
|
|
226
|
-
|
|
245
|
+
<Pressable style={[styles.titleContainer, style]} onPress={() => handleFocus()}>
|
|
246
|
+
<View style={styles.titleLabelContainer}>
|
|
247
|
+
<Text variant="tertiary" style={styles.titleLabel}>
|
|
248
|
+
Title
|
|
249
|
+
</Text>
|
|
250
|
+
{!canUpdate && <Icon name="general.lock" style={styles.titleDisabledIcon} />}
|
|
227
251
|
</View>
|
|
228
252
|
<TextInput
|
|
253
|
+
ref={textRef}
|
|
229
254
|
editable={canUpdate}
|
|
230
255
|
onChangeText={setTitle}
|
|
231
256
|
style={[styles.titleInput, !canUpdate && styles.titleInputDisabled]}
|
|
232
257
|
value={title}
|
|
258
|
+
multiline
|
|
259
|
+
maxLength={255} // Matches Chat Web
|
|
260
|
+
enterKeyHint="done"
|
|
261
|
+
submitBehavior="blurAndSubmit"
|
|
233
262
|
/>
|
|
234
|
-
|
|
263
|
+
{isEmpty && (
|
|
264
|
+
<Text variant="footnote" style={styles.inputValidationText}>
|
|
265
|
+
A title is required for your conversation.
|
|
266
|
+
</Text>
|
|
267
|
+
)}
|
|
268
|
+
</Pressable>
|
|
235
269
|
)
|
|
236
270
|
}
|
|
237
271
|
|
|
@@ -298,17 +332,33 @@ const useStyles = ({ isStart, isEnd }: { isStart?: boolean; isEnd?: boolean } =
|
|
|
298
332
|
addBottomBorder: {
|
|
299
333
|
borderBottomWidth: isEnd ? 0 : 1,
|
|
300
334
|
},
|
|
301
|
-
titleContainer: {
|
|
302
|
-
|
|
335
|
+
titleContainer: {
|
|
336
|
+
gap: 4,
|
|
337
|
+
},
|
|
303
338
|
titleLabelContainer: {
|
|
304
339
|
flexDirection: 'row',
|
|
305
340
|
alignItems: 'center',
|
|
306
|
-
gap:
|
|
341
|
+
gap: 4,
|
|
342
|
+
},
|
|
343
|
+
titleLabel: {
|
|
344
|
+
color: colors.textColorDefaultSecondary,
|
|
345
|
+
},
|
|
346
|
+
titleDisabledIcon: {
|
|
347
|
+
color: colors.iconColorDefaultSecondary,
|
|
307
348
|
},
|
|
308
349
|
titleInput: {
|
|
309
350
|
color: colors.textColorDefaultPrimary,
|
|
351
|
+
fontSize: tokens.fontSizeMd,
|
|
352
|
+
},
|
|
353
|
+
titleInputDisabled: {
|
|
354
|
+
color: colors.textColorDefaultSecondary,
|
|
355
|
+
},
|
|
356
|
+
inputValidationText: {
|
|
357
|
+
color: colors.statusErrorText,
|
|
358
|
+
paddingTop: 8,
|
|
359
|
+
borderTopWidth: 1,
|
|
360
|
+
borderColor: colors.borderColorStatusError,
|
|
310
361
|
},
|
|
311
|
-
titleInputDisabled: { opacity: 0.7 },
|
|
312
362
|
header: {
|
|
313
363
|
paddingVertical: space(1.5),
|
|
314
364
|
},
|
package/src/utils/theme.ts
CHANGED
|
@@ -73,6 +73,7 @@ interface ChatColors {
|
|
|
73
73
|
statusNeutralIcon: string
|
|
74
74
|
statusNeutralText: string
|
|
75
75
|
statusNeutralBackground: string
|
|
76
|
+
borderColorStatusError: string
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
const colorsChatLight: ChatColors = {
|
|
@@ -99,6 +100,7 @@ const colorsChatLight: ChatColors = {
|
|
|
99
100
|
statusNeutralIcon: tokens.iconColorStatusNeutralPrimary,
|
|
100
101
|
statusNeutralText: tokens.textColorStatusNeutral,
|
|
101
102
|
statusNeutralBackground: tokens.fillColorStatusNeutralGhost,
|
|
103
|
+
borderColorStatusError: tokens.borderColorStatusError,
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
const colorsChatDark: ChatColors = {
|
|
@@ -125,6 +127,7 @@ const colorsChatDark: ChatColors = {
|
|
|
125
127
|
statusNeutralIcon: tokens.iconColorStatusNeutralPrimaryDark,
|
|
126
128
|
statusNeutralText: tokens.textColorStatusNeutralDark,
|
|
127
129
|
statusNeutralBackground: tokens.fillColorStatusNeutralGhostDark,
|
|
130
|
+
borderColorStatusError: tokens.borderColorStatusErrorDark,
|
|
128
131
|
}
|
|
129
132
|
|
|
130
133
|
const chatThemeColorMap = {
|
|
@@ -20,6 +20,8 @@ const colorPrimitives = {
|
|
|
20
20
|
colorNeutral95: 'hsl(0, 0%, 95%)',
|
|
21
21
|
colorNeutral97: 'hsl(0, 0%, 97%)',
|
|
22
22
|
colorNeutral98: 'hsl(0, 0%, 98%)',
|
|
23
|
+
borderColorStatusError: 'hsl(8, 60%, 47%)',
|
|
24
|
+
borderColorStatusErrorDark: 'hsl(8, 60%, 55%)',
|
|
23
25
|
colorNeutral100White: 'hsl(0, 0%, 100%)',
|
|
24
26
|
fillColorInteractionDefault: 'hsl(204, 100%, 40%)',
|
|
25
27
|
fillColorStatusNeutralGhost: 'hsl(0, 0%, 93%)',
|