@planningcenter/chat-react-native 4.3.0-rc.7 → 4.3.0-rc.9
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/search/components/search_blank_states.d.ts +7 -0
- package/build/screens/search/components/search_blank_states.d.ts.map +1 -0
- package/build/screens/search/components/search_blank_states.js +72 -0
- package/build/screens/search/components/search_blank_states.js.map +1 -0
- package/build/screens/search/components/search_field.d.ts +7 -0
- package/build/screens/search/components/search_field.d.ts.map +1 -0
- package/build/screens/search/components/search_field.js +152 -0
- package/build/screens/search/components/search_field.js.map +1 -0
- package/build/screens/search/search_screen.d.ts.map +1 -1
- package/build/screens/search/search_screen.js +36 -10
- package/build/screens/search/search_screen.js.map +1 -1
- package/package.json +2 -2
- package/src/screens/search/components/__tests__/search_blank_states.test.tsx +20 -0
- package/src/screens/search/components/__tests__/search_field.test.tsx +29 -0
- package/src/screens/search/components/search_blank_states.tsx +34 -0
- package/src/screens/search/components/search_field.tsx +81 -0
- package/src/screens/search/search_screen.tsx +14 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function SearchPromptBlankState(): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
interface NoResultsBlankStateProps {
|
|
3
|
+
term: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function NoResultsBlankState({ term }: NoResultsBlankStateProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=search_blank_states.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search_blank_states.d.ts","sourceRoot":"","sources":["../../../../src/screens/search/components/search_blank_states.tsx"],"names":[],"mappings":"AAGA,wBAAgB,sBAAsB,4CAYrC;AAED,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE,wBAAwB,2CAYrE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import BlankState from '../../../components/primitive/blank_state_primitive';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
export function SearchPromptBlankState() {
|
|
6
|
+
const $ = _c(2);
|
|
7
|
+
let t0;
|
|
8
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
9
|
+
t0 = /*#__PURE__*/_jsx(BlankState.Imagery, {
|
|
10
|
+
name: "general.search"
|
|
11
|
+
});
|
|
12
|
+
$[0] = t0;
|
|
13
|
+
} else {
|
|
14
|
+
t0 = $[0];
|
|
15
|
+
}
|
|
16
|
+
let t1;
|
|
17
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
18
|
+
t1 = /*#__PURE__*/_jsxs(BlankState.Root, {
|
|
19
|
+
children: [t0, /*#__PURE__*/_jsxs(BlankState.Content, {
|
|
20
|
+
children: [/*#__PURE__*/_jsx(BlankState.Heading, {
|
|
21
|
+
children: "Search chat"
|
|
22
|
+
}), /*#__PURE__*/_jsx(BlankState.Text, {
|
|
23
|
+
children: "Find conversations by title, or search for words from a message."
|
|
24
|
+
})]
|
|
25
|
+
})]
|
|
26
|
+
});
|
|
27
|
+
$[1] = t1;
|
|
28
|
+
} else {
|
|
29
|
+
t1 = $[1];
|
|
30
|
+
}
|
|
31
|
+
return t1;
|
|
32
|
+
}
|
|
33
|
+
export function NoResultsBlankState(t0) {
|
|
34
|
+
const $ = _c(4);
|
|
35
|
+
const {
|
|
36
|
+
term
|
|
37
|
+
} = t0;
|
|
38
|
+
let t1;
|
|
39
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
40
|
+
t1 = /*#__PURE__*/_jsx(BlankState.Imagery, {
|
|
41
|
+
name: "general.search"
|
|
42
|
+
});
|
|
43
|
+
$[0] = t1;
|
|
44
|
+
} else {
|
|
45
|
+
t1 = $[0];
|
|
46
|
+
}
|
|
47
|
+
let t2;
|
|
48
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
49
|
+
t2 = /*#__PURE__*/_jsx(BlankState.Heading, {
|
|
50
|
+
children: "No results"
|
|
51
|
+
});
|
|
52
|
+
$[1] = t2;
|
|
53
|
+
} else {
|
|
54
|
+
t2 = $[1];
|
|
55
|
+
}
|
|
56
|
+
let t3;
|
|
57
|
+
if ($[2] !== term) {
|
|
58
|
+
t3 = /*#__PURE__*/_jsxs(BlankState.Root, {
|
|
59
|
+
children: [t1, /*#__PURE__*/_jsxs(BlankState.Content, {
|
|
60
|
+
children: [t2, /*#__PURE__*/_jsxs(BlankState.Text, {
|
|
61
|
+
children: ["Nothing matches \u201C", term, ".\u201D Try a conversation title, or a word from a message."]
|
|
62
|
+
})]
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
65
|
+
$[2] = term;
|
|
66
|
+
$[3] = t3;
|
|
67
|
+
} else {
|
|
68
|
+
t3 = $[3];
|
|
69
|
+
}
|
|
70
|
+
return t3;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=search_blank_states.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search_blank_states.js","names":["React","BlankState","jsx","_jsx","jsxs","_jsxs","SearchPromptBlankState","$","_c","t0","Symbol","for","Imagery","name","t1","Root","children","Content","Heading","Text","NoResultsBlankState","term","t2","t3"],"sources":["../../../../src/screens/search/components/search_blank_states.tsx"],"sourcesContent":["import React from 'react'\nimport BlankState from '../../../components/primitive/blank_state_primitive'\n\nexport function SearchPromptBlankState() {\n return (\n <BlankState.Root>\n <BlankState.Imagery name=\"general.search\" />\n <BlankState.Content>\n <BlankState.Heading>Search chat</BlankState.Heading>\n <BlankState.Text>\n Find conversations by title, or search for words from a message.\n </BlankState.Text>\n </BlankState.Content>\n </BlankState.Root>\n )\n}\n\ninterface NoResultsBlankStateProps {\n term: string\n}\n\nexport function NoResultsBlankState({ term }: NoResultsBlankStateProps) {\n return (\n <BlankState.Root>\n <BlankState.Imagery name=\"general.search\" />\n <BlankState.Content>\n <BlankState.Heading>No results</BlankState.Heading>\n <BlankState.Text>\n Nothing matches “{term}.” Try a conversation title, or a word from a message.\n </BlankState.Text>\n </BlankState.Content>\n </BlankState.Root>\n )\n}\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,qDAAqD;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE5E,OAAO,SAAAC,uBAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAF,CAAA,QAAAG,MAAA,CAAAC,GAAA;IAGDF,EAAA,gBAAAN,IAAA,CAAAF,UAAA,CAAAW,OAAA;MAAyBC,IAAgB,EAAhB;IAAgB,CAAE,CAAC;IAAAN,CAAA,MAAAE,EAAA;EAAA;IAAAA,EAAA,GAAAF,CAAA;EAAA;EAAA,IAAAO,EAAA;EAAA,IAAAP,CAAA,QAAAG,MAAA,CAAAC,GAAA;IAD9CG,EAAA,gBAAAT,KAAA,CAAAJ,UAAA,CAAAc,IAAA;MAAAC,QAAA,GACEP,EAA4C,eAC5CJ,KAAA,CAAAJ,UAAA,CAAAgB,OAAA;QAAAD,QAAA,gBACEb,IAAA,CAAAF,UAAA,CAAAiB,OAAA;UAAAF,QAAA,EAAoB;QAAW,CAAoB,CAAC,eACpDb,IAAA,CAAAF,UAAA,CAAAkB,IAAA;UAAAH,QAAA,EAAiB;QAEjB,CAAiB,CAAC;MAAA,CACA,CAAC;IAAA,CACN,CAAC;IAAAT,CAAA,MAAAO,EAAA;EAAA;IAAAA,EAAA,GAAAP,CAAA;EAAA;EAAA,OARlBO,EAQkB;AAAA;AAQtB,OAAO,SAAAM,oBAAAX,EAAA;EAAA,MAAAF,CAAA,GAAAC,EAAA;EAA6B;IAAAa;EAAA,IAAAZ,EAAkC;EAAA,I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E,gBAAgB,2CAwC/D"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
4
|
+
import { Icon } from '../../../components';
|
|
5
|
+
import { AutoFocusAwareTextInput } from '../../../components/display/text_input';
|
|
6
|
+
import { useTheme } from '../../../hooks';
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
const PLACEHOLDER = 'Search titles and messages';
|
|
9
|
+
export function SearchField(t0) {
|
|
10
|
+
const $ = _c(21);
|
|
11
|
+
const {
|
|
12
|
+
term,
|
|
13
|
+
onChange
|
|
14
|
+
} = t0;
|
|
15
|
+
const styles = useStyles();
|
|
16
|
+
const {
|
|
17
|
+
colors
|
|
18
|
+
} = useTheme();
|
|
19
|
+
const inputRef = useRef(null);
|
|
20
|
+
let t1;
|
|
21
|
+
if ($[0] !== onChange) {
|
|
22
|
+
t1 = () => {
|
|
23
|
+
onChange("");
|
|
24
|
+
inputRef.current?.clear();
|
|
25
|
+
inputRef.current?.focus();
|
|
26
|
+
};
|
|
27
|
+
$[0] = onChange;
|
|
28
|
+
$[1] = t1;
|
|
29
|
+
} else {
|
|
30
|
+
t1 = $[1];
|
|
31
|
+
}
|
|
32
|
+
const clear = t1;
|
|
33
|
+
let t2;
|
|
34
|
+
if ($[2] !== colors.iconColorDefaultSecondary) {
|
|
35
|
+
t2 = /*#__PURE__*/_jsx(Icon, {
|
|
36
|
+
name: "general.search",
|
|
37
|
+
size: 16,
|
|
38
|
+
color: colors.iconColorDefaultSecondary
|
|
39
|
+
});
|
|
40
|
+
$[2] = colors.iconColorDefaultSecondary;
|
|
41
|
+
$[3] = t2;
|
|
42
|
+
} else {
|
|
43
|
+
t2 = $[3];
|
|
44
|
+
}
|
|
45
|
+
let t3;
|
|
46
|
+
if ($[4] !== colors.textColorDefaultPlaceholder || $[5] !== onChange || $[6] !== styles.input || $[7] !== term) {
|
|
47
|
+
t3 = /*#__PURE__*/_jsx(AutoFocusAwareTextInput, {
|
|
48
|
+
autoFocus: true,
|
|
49
|
+
autoCorrect: false,
|
|
50
|
+
inputRef: inputRef,
|
|
51
|
+
placeholder: PLACEHOLDER,
|
|
52
|
+
placeholderTextColor: colors.textColorDefaultPlaceholder,
|
|
53
|
+
accessibilityLabel: PLACEHOLDER,
|
|
54
|
+
value: term,
|
|
55
|
+
onChangeText: onChange,
|
|
56
|
+
returnKeyType: "search",
|
|
57
|
+
style: styles.input
|
|
58
|
+
});
|
|
59
|
+
$[4] = colors.textColorDefaultPlaceholder;
|
|
60
|
+
$[5] = onChange;
|
|
61
|
+
$[6] = styles.input;
|
|
62
|
+
$[7] = term;
|
|
63
|
+
$[8] = t3;
|
|
64
|
+
} else {
|
|
65
|
+
t3 = $[8];
|
|
66
|
+
}
|
|
67
|
+
let t4;
|
|
68
|
+
if ($[9] !== clear || $[10] !== colors.iconColorDefaultSecondary || $[11] !== term.length) {
|
|
69
|
+
t4 = term.length > 0 && /*#__PURE__*/_jsx(Pressable, {
|
|
70
|
+
onPress: clear,
|
|
71
|
+
hitSlop: 8,
|
|
72
|
+
accessibilityRole: "button",
|
|
73
|
+
accessibilityLabel: "Clear search",
|
|
74
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
75
|
+
name: "general.x",
|
|
76
|
+
size: 12,
|
|
77
|
+
color: colors.iconColorDefaultSecondary
|
|
78
|
+
})
|
|
79
|
+
});
|
|
80
|
+
$[9] = clear;
|
|
81
|
+
$[10] = colors.iconColorDefaultSecondary;
|
|
82
|
+
$[11] = term.length;
|
|
83
|
+
$[12] = t4;
|
|
84
|
+
} else {
|
|
85
|
+
t4 = $[12];
|
|
86
|
+
}
|
|
87
|
+
let t5;
|
|
88
|
+
if ($[13] !== styles.field || $[14] !== t2 || $[15] !== t3 || $[16] !== t4) {
|
|
89
|
+
t5 = /*#__PURE__*/_jsxs(View, {
|
|
90
|
+
style: styles.field,
|
|
91
|
+
children: [t2, t3, t4]
|
|
92
|
+
});
|
|
93
|
+
$[13] = styles.field;
|
|
94
|
+
$[14] = t2;
|
|
95
|
+
$[15] = t3;
|
|
96
|
+
$[16] = t4;
|
|
97
|
+
$[17] = t5;
|
|
98
|
+
} else {
|
|
99
|
+
t5 = $[17];
|
|
100
|
+
}
|
|
101
|
+
let t6;
|
|
102
|
+
if ($[18] !== styles.container || $[19] !== t5) {
|
|
103
|
+
t6 = /*#__PURE__*/_jsx(View, {
|
|
104
|
+
style: styles.container,
|
|
105
|
+
children: t5
|
|
106
|
+
});
|
|
107
|
+
$[18] = styles.container;
|
|
108
|
+
$[19] = t5;
|
|
109
|
+
$[20] = t6;
|
|
110
|
+
} else {
|
|
111
|
+
t6 = $[20];
|
|
112
|
+
}
|
|
113
|
+
return t6;
|
|
114
|
+
}
|
|
115
|
+
const useStyles = () => {
|
|
116
|
+
const $ = _c(3);
|
|
117
|
+
const {
|
|
118
|
+
colors
|
|
119
|
+
} = useTheme();
|
|
120
|
+
let t0;
|
|
121
|
+
if ($[0] !== colors.borderColorDefaultBase || $[1] !== colors.textColorDefaultPrimary) {
|
|
122
|
+
t0 = StyleSheet.create({
|
|
123
|
+
container: {
|
|
124
|
+
paddingHorizontal: 16,
|
|
125
|
+
paddingVertical: 8
|
|
126
|
+
},
|
|
127
|
+
field: {
|
|
128
|
+
flexDirection: "row",
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
gap: 8,
|
|
131
|
+
borderWidth: 1,
|
|
132
|
+
borderColor: colors.borderColorDefaultBase,
|
|
133
|
+
borderRadius: 8,
|
|
134
|
+
paddingHorizontal: 12,
|
|
135
|
+
paddingVertical: 8
|
|
136
|
+
},
|
|
137
|
+
input: {
|
|
138
|
+
flex: 1,
|
|
139
|
+
color: colors.textColorDefaultPrimary,
|
|
140
|
+
fontSize: 16,
|
|
141
|
+
paddingVertical: 2
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
$[0] = colors.borderColorDefaultBase;
|
|
145
|
+
$[1] = colors.textColorDefaultPrimary;
|
|
146
|
+
$[2] = t0;
|
|
147
|
+
} else {
|
|
148
|
+
t0 = $[2];
|
|
149
|
+
}
|
|
150
|
+
return t0;
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=search_field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search_field.js","names":["useRef","Pressable","StyleSheet","View","Icon","AutoFocusAwareTextInput","useTheme","jsx","_jsx","jsxs","_jsxs","PLACEHOLDER","SearchField","t0","$","_c","term","onChange","styles","useStyles","colors","inputRef","t1","current","clear","focus","t2","iconColorDefaultSecondary","name","size","color","t3","textColorDefaultPlaceholder","input","autoFocus","autoCorrect","placeholderTextColor","returnKeyType","style","t4","length","hitSlop","accessibilityRole","accessibilityLabel","children","t5","field","t6","container","borderColorDefaultBase","textColorDefaultPrimary","create","paddingHorizontal","paddingVertical","flexDirection","alignItems","gap","borderWidth","borderColor","borderRadius","flex","fontSize"],"sources":["../../../../src/screens/search/components/search_field.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { Pressable, StyleSheet, TextInput, View } from 'react-native'\nimport { Icon } from '../../../components'\nimport { AutoFocusAwareTextInput } from '../../../components/display/text_input'\nimport { useTheme } from '../../../hooks'\n\nconst PLACEHOLDER = 'Search titles and messages'\n\ninterface SearchFieldProps {\n term: string\n onChange: (term: string) => void\n}\n\nexport function SearchField({ term, onChange }: SearchFieldProps) {\n const styles = useStyles()\n const { colors } = useTheme()\n const inputRef = useRef<TextInput>(null)\n\n const clear = () => {\n onChange('')\n inputRef.current?.clear()\n inputRef.current?.focus()\n }\n\n return (\n <View style={styles.container}>\n <View style={styles.field}>\n <Icon name=\"general.search\" size={16} color={colors.iconColorDefaultSecondary} />\n <AutoFocusAwareTextInput\n autoFocus\n autoCorrect={false}\n inputRef={inputRef}\n placeholder={PLACEHOLDER}\n placeholderTextColor={colors.textColorDefaultPlaceholder}\n accessibilityLabel={PLACEHOLDER}\n value={term}\n onChangeText={onChange}\n returnKeyType=\"search\"\n style={styles.input}\n />\n {term.length > 0 && (\n <Pressable\n onPress={clear}\n hitSlop={8}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Clear search\"\n >\n <Icon name=\"general.x\" size={12} color={colors.iconColorDefaultSecondary} />\n </Pressable>\n )}\n </View>\n </View>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: {\n paddingHorizontal: 16,\n paddingVertical: 8,\n },\n field: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: 8,\n borderWidth: 1,\n borderColor: colors.borderColorDefaultBase,\n borderRadius: 8,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n input: {\n flex: 1,\n color: colors.textColorDefaultPrimary,\n fontSize: 16,\n paddingVertical: 2,\n },\n })\n}\n"],"mappings":";AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,SAAS,EAAEC,UAAU,EAAaC,IAAI,QAAQ,cAAc;AACrE,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,SAASC,uBAAuB,QAAQ,wCAAwC;AAChF,SAASC,QAAQ,QAAQ,gBAAgB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEzC,MAAMC,WAAW,GAAG,4BAA4B;AAOhD,OAAO,SAAAC,YAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EAAqB;IAAAC,IAAA;IAAAC;EAAA,IAAAJ,EAAoC;EAC9D,MAAAK,MAAA,GAAeC,SAAS,CAAC,CAAC;EAC1B;IAAAC;EAAA,IAAmBd,QAAQ,CAAC,CAAC;EAC7B,MAAAe,QAAA,GAAiBrB,MAAM,CAAY,IAAI,CAAC;EAAA,IAAAsB,EAAA;EAAA,IAAAR,CAAA,QAAAG,QAAA;IAE1BK,EAAA,GAAAA,CAAA;MACZL,QAAQ,CAAC,EAAE,CAAC;MACZI,QAAQ,CAAA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AAAA,EAAA,GAAAC,CAAA;EAAA;EAAA,OArBKD,EAqBL;AAAA,CACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/search/search_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"search_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/search/search_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACvB,MAAM,gCAAgC,CAAA;AAWvC,eAAO,MAAM,mBAAmB,GAAI,iBAEjC,sBAAsB,CAAC,aAAa,CAAC,KAAG,4BAIxC,CAAA;AAEH,wBAAgB,YAAY,4CAW3B"}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
3
|
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import { KeyboardView } from '../../components';
|
|
4
5
|
import { composeOptions, withMinimalBack } from '../../components/display/platform_modal_header_buttons';
|
|
5
|
-
import {
|
|
6
|
+
import { SearchPromptBlankState } from './components/search_blank_states';
|
|
7
|
+
import { SearchField } from './components/search_field';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
9
|
export const SearchScreenOptions = ({
|
|
7
10
|
navigation
|
|
8
11
|
}) => composeOptions({
|
|
@@ -12,18 +15,41 @@ export const SearchScreenOptions = ({
|
|
|
12
15
|
onPress: () => navigation.goBack()
|
|
13
16
|
}));
|
|
14
17
|
export function SearchScreen() {
|
|
15
|
-
const $ = _c(
|
|
18
|
+
const $ = _c(5);
|
|
19
|
+
const [term, setTerm] = useState("");
|
|
16
20
|
let t0;
|
|
17
|
-
if ($[0]
|
|
18
|
-
t0 = /*#__PURE__*/_jsx(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
if ($[0] !== term) {
|
|
22
|
+
t0 = /*#__PURE__*/_jsx(SearchField, {
|
|
23
|
+
term: term,
|
|
24
|
+
onChange: setTerm
|
|
21
25
|
});
|
|
22
|
-
$[0] =
|
|
26
|
+
$[0] = term;
|
|
27
|
+
$[1] = t0;
|
|
23
28
|
} else {
|
|
24
|
-
t0 = $[
|
|
29
|
+
t0 = $[1];
|
|
25
30
|
}
|
|
26
|
-
|
|
31
|
+
let t1;
|
|
32
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
33
|
+
t1 = /*#__PURE__*/_jsx(SearchPromptBlankState, {});
|
|
34
|
+
$[2] = t1;
|
|
35
|
+
} else {
|
|
36
|
+
t1 = $[2];
|
|
37
|
+
}
|
|
38
|
+
let t2;
|
|
39
|
+
if ($[3] !== t0) {
|
|
40
|
+
t2 = /*#__PURE__*/_jsx(KeyboardView, {
|
|
41
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
42
|
+
style: styles.container,
|
|
43
|
+
testID: "search-screen",
|
|
44
|
+
children: [t0, t1]
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
$[3] = t0;
|
|
48
|
+
$[4] = t2;
|
|
49
|
+
} else {
|
|
50
|
+
t2 = $[4];
|
|
51
|
+
}
|
|
52
|
+
return t2;
|
|
27
53
|
}
|
|
28
54
|
const styles = StyleSheet.create({
|
|
29
55
|
container: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search_screen.js","names":["React","StyleSheet","View","composeOptions","withMinimalBack","jsx","_jsx","SearchScreenOptions","navigation","title","animation","onPress","goBack","SearchScreen","$","_c","t0","Symbol","for","style","styles","container","testID","create","flex"],"sources":["../../../src/screens/search/search_screen.tsx"],"sourcesContent":["import { ParamListBase } from '@react-navigation/native'\nimport {\n NativeStackNavigationOptions,\n NativeStackScreenProps,\n} from '@react-navigation/native-stack'\nimport React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport {\n composeOptions,\n withMinimalBack,\n} from '../../components/display/platform_modal_header_buttons'\n\nexport const SearchScreenOptions = ({\n navigation,\n}: NativeStackScreenProps<ParamListBase>): NativeStackNavigationOptions =>\n composeOptions(\n { title: 'Search', animation: 'fade' },\n withMinimalBack({ onPress: () => navigation.goBack() })\n )\n\nexport function SearchScreen() {\n return <View style={styles.container} testID=\"search-screen\" />\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n },\n})\n"],"mappings":";AAKA,OAAOA,KAAK,
|
|
1
|
+
{"version":3,"file":"search_screen.js","names":["React","useState","StyleSheet","View","KeyboardView","composeOptions","withMinimalBack","SearchPromptBlankState","SearchField","jsx","_jsx","jsxs","_jsxs","SearchScreenOptions","navigation","title","animation","onPress","goBack","SearchScreen","$","_c","term","setTerm","t0","t1","Symbol","for","t2","children","style","styles","container","testID","create","flex"],"sources":["../../../src/screens/search/search_screen.tsx"],"sourcesContent":["import { ParamListBase } from '@react-navigation/native'\nimport {\n NativeStackNavigationOptions,\n NativeStackScreenProps,\n} from '@react-navigation/native-stack'\nimport React, { useState } from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport { KeyboardView } from '../../components'\nimport {\n composeOptions,\n withMinimalBack,\n} from '../../components/display/platform_modal_header_buttons'\nimport { SearchPromptBlankState } from './components/search_blank_states'\nimport { SearchField } from './components/search_field'\n\nexport const SearchScreenOptions = ({\n navigation,\n}: NativeStackScreenProps<ParamListBase>): NativeStackNavigationOptions =>\n composeOptions(\n { title: 'Search', animation: 'fade' },\n withMinimalBack({ onPress: () => navigation.goBack() })\n )\n\nexport function SearchScreen() {\n const [term, setTerm] = useState('')\n\n return (\n <KeyboardView>\n <View style={styles.container} testID=\"search-screen\">\n <SearchField term={term} onChange={setTerm} />\n <SearchPromptBlankState />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AAA;IAH9BI,EAAA,gBAAAlB,IAAA,CAACN,YAAY;MAAAyB,QAAA,eACXjB,KAAA,CAACT,IAAI;QAAQ2B,KAAgB,EAAhBC,MAAM,CAAAC,SAAU;QAASC,MAAe,EAAf,eAAe;QAAAJ,QAAA,GACnDL,EAA8C,EAC9CC,EAA0B;MAAA,CACtB;IAAC,CACK,CAAC;IAAAL,CAAA,MAAAI,EAAA;IAAAJ,CAAA,MAAAQ,EAAA;EAAA;IAAAA,EAAA,GAAAR,CAAA;EAAA;EAAA,OALfQ,EAKe;AAAA;AAInB,MAAMG,MAAM,GAAG7B,UAAU,CAACgC,MAAM,CAAC;EAC/BF,SAAS,EAAE;IACTG,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "4.3.0-rc.
|
|
3
|
+
"version": "4.3.0-rc.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"sf-symbols-typescript": "^2.2.0",
|
|
85
85
|
"typescript": "~6.0.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "4c3d10940f433b0e1722c68aafbbb81534bb21ce"
|
|
88
88
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { render } from '@testing-library/react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { NoResultsBlankState, SearchPromptBlankState } from '../search_blank_states'
|
|
4
|
+
|
|
5
|
+
describe('SearchPromptBlankState', () => {
|
|
6
|
+
it('renders the prompt heading', () => {
|
|
7
|
+
const view = render(<SearchPromptBlankState />)
|
|
8
|
+
|
|
9
|
+
expect(view.getByText('Search chat')).toBeTruthy()
|
|
10
|
+
})
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
describe('NoResultsBlankState', () => {
|
|
14
|
+
it('renders the heading and the searched term', () => {
|
|
15
|
+
const view = render(<NoResultsBlankState term="budget" />)
|
|
16
|
+
|
|
17
|
+
expect(view.getByText('No results')).toBeTruthy()
|
|
18
|
+
expect(view.getByText(/Nothing matches “budget\.”/)).toBeTruthy()
|
|
19
|
+
})
|
|
20
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { fireEvent, render } from '@testing-library/react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { SearchField } from '../search_field'
|
|
4
|
+
|
|
5
|
+
const inputLabel = 'Search titles and messages'
|
|
6
|
+
const clearLabel = 'Clear search'
|
|
7
|
+
|
|
8
|
+
describe('SearchField', () => {
|
|
9
|
+
it('reports typed text through onChange', () => {
|
|
10
|
+
const onChange = jest.fn()
|
|
11
|
+
const view = render(<SearchField term="" onChange={onChange} />)
|
|
12
|
+
|
|
13
|
+
fireEvent.changeText(view.getByLabelText(inputLabel), 'budget')
|
|
14
|
+
|
|
15
|
+
expect(onChange).toHaveBeenCalledWith('budget')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('shows the clear button only for a non-empty term and clears on press', () => {
|
|
19
|
+
const onChange = jest.fn()
|
|
20
|
+
const view = render(<SearchField term="" onChange={onChange} />)
|
|
21
|
+
|
|
22
|
+
expect(view.queryByLabelText(clearLabel)).toBeNull()
|
|
23
|
+
|
|
24
|
+
view.rerender(<SearchField term="budget" onChange={onChange} />)
|
|
25
|
+
fireEvent.press(view.getByLabelText(clearLabel))
|
|
26
|
+
|
|
27
|
+
expect(onChange).toHaveBeenCalledWith('')
|
|
28
|
+
})
|
|
29
|
+
})
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import BlankState from '../../../components/primitive/blank_state_primitive'
|
|
3
|
+
|
|
4
|
+
export function SearchPromptBlankState() {
|
|
5
|
+
return (
|
|
6
|
+
<BlankState.Root>
|
|
7
|
+
<BlankState.Imagery name="general.search" />
|
|
8
|
+
<BlankState.Content>
|
|
9
|
+
<BlankState.Heading>Search chat</BlankState.Heading>
|
|
10
|
+
<BlankState.Text>
|
|
11
|
+
Find conversations by title, or search for words from a message.
|
|
12
|
+
</BlankState.Text>
|
|
13
|
+
</BlankState.Content>
|
|
14
|
+
</BlankState.Root>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface NoResultsBlankStateProps {
|
|
19
|
+
term: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function NoResultsBlankState({ term }: NoResultsBlankStateProps) {
|
|
23
|
+
return (
|
|
24
|
+
<BlankState.Root>
|
|
25
|
+
<BlankState.Imagery name="general.search" />
|
|
26
|
+
<BlankState.Content>
|
|
27
|
+
<BlankState.Heading>No results</BlankState.Heading>
|
|
28
|
+
<BlankState.Text>
|
|
29
|
+
Nothing matches “{term}.” Try a conversation title, or a word from a message.
|
|
30
|
+
</BlankState.Text>
|
|
31
|
+
</BlankState.Content>
|
|
32
|
+
</BlankState.Root>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useRef } from 'react'
|
|
2
|
+
import { Pressable, StyleSheet, TextInput, View } from 'react-native'
|
|
3
|
+
import { Icon } from '../../../components'
|
|
4
|
+
import { AutoFocusAwareTextInput } from '../../../components/display/text_input'
|
|
5
|
+
import { useTheme } from '../../../hooks'
|
|
6
|
+
|
|
7
|
+
const PLACEHOLDER = 'Search titles and messages'
|
|
8
|
+
|
|
9
|
+
interface SearchFieldProps {
|
|
10
|
+
term: string
|
|
11
|
+
onChange: (term: string) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function SearchField({ term, onChange }: SearchFieldProps) {
|
|
15
|
+
const styles = useStyles()
|
|
16
|
+
const { colors } = useTheme()
|
|
17
|
+
const inputRef = useRef<TextInput>(null)
|
|
18
|
+
|
|
19
|
+
const clear = () => {
|
|
20
|
+
onChange('')
|
|
21
|
+
inputRef.current?.clear()
|
|
22
|
+
inputRef.current?.focus()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View style={styles.container}>
|
|
27
|
+
<View style={styles.field}>
|
|
28
|
+
<Icon name="general.search" size={16} color={colors.iconColorDefaultSecondary} />
|
|
29
|
+
<AutoFocusAwareTextInput
|
|
30
|
+
autoFocus
|
|
31
|
+
autoCorrect={false}
|
|
32
|
+
inputRef={inputRef}
|
|
33
|
+
placeholder={PLACEHOLDER}
|
|
34
|
+
placeholderTextColor={colors.textColorDefaultPlaceholder}
|
|
35
|
+
accessibilityLabel={PLACEHOLDER}
|
|
36
|
+
value={term}
|
|
37
|
+
onChangeText={onChange}
|
|
38
|
+
returnKeyType="search"
|
|
39
|
+
style={styles.input}
|
|
40
|
+
/>
|
|
41
|
+
{term.length > 0 && (
|
|
42
|
+
<Pressable
|
|
43
|
+
onPress={clear}
|
|
44
|
+
hitSlop={8}
|
|
45
|
+
accessibilityRole="button"
|
|
46
|
+
accessibilityLabel="Clear search"
|
|
47
|
+
>
|
|
48
|
+
<Icon name="general.x" size={12} color={colors.iconColorDefaultSecondary} />
|
|
49
|
+
</Pressable>
|
|
50
|
+
)}
|
|
51
|
+
</View>
|
|
52
|
+
</View>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const useStyles = () => {
|
|
57
|
+
const { colors } = useTheme()
|
|
58
|
+
|
|
59
|
+
return StyleSheet.create({
|
|
60
|
+
container: {
|
|
61
|
+
paddingHorizontal: 16,
|
|
62
|
+
paddingVertical: 8,
|
|
63
|
+
},
|
|
64
|
+
field: {
|
|
65
|
+
flexDirection: 'row',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
gap: 8,
|
|
68
|
+
borderWidth: 1,
|
|
69
|
+
borderColor: colors.borderColorDefaultBase,
|
|
70
|
+
borderRadius: 8,
|
|
71
|
+
paddingHorizontal: 12,
|
|
72
|
+
paddingVertical: 8,
|
|
73
|
+
},
|
|
74
|
+
input: {
|
|
75
|
+
flex: 1,
|
|
76
|
+
color: colors.textColorDefaultPrimary,
|
|
77
|
+
fontSize: 16,
|
|
78
|
+
paddingVertical: 2,
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
}
|
|
@@ -3,12 +3,15 @@ import {
|
|
|
3
3
|
NativeStackNavigationOptions,
|
|
4
4
|
NativeStackScreenProps,
|
|
5
5
|
} from '@react-navigation/native-stack'
|
|
6
|
-
import React from 'react'
|
|
6
|
+
import React, { useState } from 'react'
|
|
7
7
|
import { StyleSheet, View } from 'react-native'
|
|
8
|
+
import { KeyboardView } from '../../components'
|
|
8
9
|
import {
|
|
9
10
|
composeOptions,
|
|
10
11
|
withMinimalBack,
|
|
11
12
|
} from '../../components/display/platform_modal_header_buttons'
|
|
13
|
+
import { SearchPromptBlankState } from './components/search_blank_states'
|
|
14
|
+
import { SearchField } from './components/search_field'
|
|
12
15
|
|
|
13
16
|
export const SearchScreenOptions = ({
|
|
14
17
|
navigation,
|
|
@@ -19,7 +22,16 @@ export const SearchScreenOptions = ({
|
|
|
19
22
|
)
|
|
20
23
|
|
|
21
24
|
export function SearchScreen() {
|
|
22
|
-
|
|
25
|
+
const [term, setTerm] = useState('')
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<KeyboardView>
|
|
29
|
+
<View style={styles.container} testID="search-screen">
|
|
30
|
+
<SearchField term={term} onChange={setTerm} />
|
|
31
|
+
<SearchPromptBlankState />
|
|
32
|
+
</View>
|
|
33
|
+
</KeyboardView>
|
|
34
|
+
)
|
|
23
35
|
}
|
|
24
36
|
|
|
25
37
|
const styles = StyleSheet.create({
|