@pagopa/io-app-design-system 7.0.2 → 7.1.0
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/lib/commonjs/components/alert/Alert.js +6 -5
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/banner/Banner.js +7 -6
- package/lib/commonjs/components/banner/Banner.js.map +1 -1
- package/lib/commonjs/components/buttons/IOButton/IOButton.js +10 -8
- package/lib/commonjs/components/buttons/IOButton/IOButton.js.map +1 -1
- package/lib/commonjs/components/layout/ContentWrapper.js +5 -4
- package/lib/commonjs/components/layout/ContentWrapper.js.map +1 -1
- package/lib/commonjs/components/otpInput/OTPInput.js +6 -4
- package/lib/commonjs/components/otpInput/OTPInput.js.map +1 -1
- package/lib/commonjs/components/searchInput/SearchInput.js +8 -6
- package/lib/commonjs/components/searchInput/SearchInput.js.map +1 -1
- package/lib/commonjs/components/tabs/TabItem.js +6 -4
- package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputValidation.js +5 -3
- package/lib/commonjs/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/commonjs/components/typography/Body.js +8 -5
- package/lib/commonjs/components/typography/Body.js.map +1 -1
- package/lib/commonjs/components/typography/BodyMonospace.js +4 -5
- package/lib/commonjs/components/typography/BodyMonospace.js.map +1 -1
- package/lib/commonjs/components/typography/BodySmall.js +8 -5
- package/lib/commonjs/components/typography/BodySmall.js.map +1 -1
- package/lib/commonjs/components/typography/ButtonText.js +4 -5
- package/lib/commonjs/components/typography/ButtonText.js.map +1 -1
- package/lib/commonjs/components/typography/Caption.js +4 -5
- package/lib/commonjs/components/typography/Caption.js.map +1 -1
- package/lib/commonjs/components/typography/H1.js +4 -5
- package/lib/commonjs/components/typography/H1.js.map +1 -1
- package/lib/commonjs/components/typography/H2.js +4 -5
- package/lib/commonjs/components/typography/H2.js.map +1 -1
- package/lib/commonjs/components/typography/H3.js +4 -5
- package/lib/commonjs/components/typography/H3.js.map +1 -1
- package/lib/commonjs/components/typography/H4.js +4 -5
- package/lib/commonjs/components/typography/H4.js.map +1 -1
- package/lib/commonjs/components/typography/H5.js +4 -5
- package/lib/commonjs/components/typography/H5.js.map +1 -1
- package/lib/commonjs/components/typography/H6.js +4 -5
- package/lib/commonjs/components/typography/H6.js.map +1 -1
- package/lib/commonjs/components/typography/Hero.js +4 -5
- package/lib/commonjs/components/typography/Hero.js.map +1 -1
- package/lib/commonjs/components/typography/IOText.js +16 -14
- package/lib/commonjs/components/typography/IOText.js.map +1 -1
- package/lib/commonjs/components/typography/LabelMini.js +8 -5
- package/lib/commonjs/components/typography/LabelMini.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH1.js +4 -5
- package/lib/commonjs/components/typography/markdown/MdH1.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH2.js +4 -5
- package/lib/commonjs/components/typography/markdown/MdH2.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH3.js +4 -5
- package/lib/commonjs/components/typography/markdown/MdH3.js.map +1 -1
- package/lib/commonjs/context/IOThemeContextProvider.js +3 -4
- package/lib/commonjs/context/IOThemeContextProvider.js.map +1 -1
- package/lib/module/components/alert/Alert.js +5 -5
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/banner/Banner.js +6 -6
- package/lib/module/components/banner/Banner.js.map +1 -1
- package/lib/module/components/buttons/IOButton/IOButton.js +10 -9
- package/lib/module/components/buttons/IOButton/IOButton.js.map +1 -1
- package/lib/module/components/layout/ContentWrapper.js +4 -4
- package/lib/module/components/layout/ContentWrapper.js.map +1 -1
- package/lib/module/components/otpInput/OTPInput.js +6 -5
- package/lib/module/components/otpInput/OTPInput.js.map +1 -1
- package/lib/module/components/searchInput/SearchInput.js +8 -7
- package/lib/module/components/searchInput/SearchInput.js.map +1 -1
- package/lib/module/components/tabs/TabItem.js +6 -5
- package/lib/module/components/tabs/TabItem.js.map +1 -1
- package/lib/module/components/textInput/TextInputValidation.js +5 -4
- package/lib/module/components/textInput/TextInputValidation.js.map +1 -1
- package/lib/module/components/typography/Body.js +7 -5
- package/lib/module/components/typography/Body.js.map +1 -1
- package/lib/module/components/typography/BodyMonospace.js +3 -5
- package/lib/module/components/typography/BodyMonospace.js.map +1 -1
- package/lib/module/components/typography/BodySmall.js +7 -5
- package/lib/module/components/typography/BodySmall.js.map +1 -1
- package/lib/module/components/typography/ButtonText.js +3 -5
- package/lib/module/components/typography/ButtonText.js.map +1 -1
- package/lib/module/components/typography/Caption.js +3 -5
- package/lib/module/components/typography/Caption.js.map +1 -1
- package/lib/module/components/typography/H1.js +3 -5
- package/lib/module/components/typography/H1.js.map +1 -1
- package/lib/module/components/typography/H2.js +3 -5
- package/lib/module/components/typography/H2.js.map +1 -1
- package/lib/module/components/typography/H3.js +3 -5
- package/lib/module/components/typography/H3.js.map +1 -1
- package/lib/module/components/typography/H4.js +3 -5
- package/lib/module/components/typography/H4.js.map +1 -1
- package/lib/module/components/typography/H5.js +3 -5
- package/lib/module/components/typography/H5.js.map +1 -1
- package/lib/module/components/typography/H6.js +3 -5
- package/lib/module/components/typography/H6.js.map +1 -1
- package/lib/module/components/typography/Hero.js +3 -5
- package/lib/module/components/typography/Hero.js.map +1 -1
- package/lib/module/components/typography/IOText.js +16 -15
- package/lib/module/components/typography/IOText.js.map +1 -1
- package/lib/module/components/typography/LabelMini.js +7 -5
- package/lib/module/components/typography/LabelMini.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH1.js +3 -5
- package/lib/module/components/typography/markdown/MdH1.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH2.js +3 -5
- package/lib/module/components/typography/markdown/MdH2.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH3.js +3 -5
- package/lib/module/components/typography/markdown/MdH3.js.map +1 -1
- package/lib/module/context/IOThemeContextProvider.js +3 -4
- package/lib/module/context/IOThemeContextProvider.js.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts +3 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/banner/Banner.d.ts +3 -1
- package/lib/typescript/components/banner/Banner.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IOButton/IOButton.d.ts +3 -2
- package/lib/typescript/components/buttons/IOButton/IOButton.d.ts.map +1 -1
- package/lib/typescript/components/layout/ContentWrapper.d.ts +10 -6
- package/lib/typescript/components/layout/ContentWrapper.d.ts.map +1 -1
- package/lib/typescript/components/otpInput/OTPInput.d.ts +3 -1
- package/lib/typescript/components/otpInput/OTPInput.d.ts.map +1 -1
- package/lib/typescript/components/searchInput/SearchInput.d.ts +3 -1
- package/lib/typescript/components/searchInput/SearchInput.d.ts.map +1 -1
- package/lib/typescript/components/tabs/TabItem.d.ts +3 -11
- package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputValidation.d.ts +7 -24
- package/lib/typescript/components/textInput/TextInputValidation.d.ts.map +1 -1
- package/lib/typescript/components/typography/Body.d.ts +4 -2
- package/lib/typescript/components/typography/Body.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodyMonospace.d.ts +2 -8
- package/lib/typescript/components/typography/BodyMonospace.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodySmall.d.ts +4 -2
- package/lib/typescript/components/typography/BodySmall.d.ts.map +1 -1
- package/lib/typescript/components/typography/ButtonText.d.ts +2 -8
- package/lib/typescript/components/typography/ButtonText.d.ts.map +1 -1
- package/lib/typescript/components/typography/Caption.d.ts +2 -8
- package/lib/typescript/components/typography/Caption.d.ts.map +1 -1
- package/lib/typescript/components/typography/H1.d.ts +2 -8
- package/lib/typescript/components/typography/H1.d.ts.map +1 -1
- package/lib/typescript/components/typography/H2.d.ts +6 -10
- package/lib/typescript/components/typography/H2.d.ts.map +1 -1
- package/lib/typescript/components/typography/H3.d.ts +2 -8
- package/lib/typescript/components/typography/H3.d.ts.map +1 -1
- package/lib/typescript/components/typography/H4.d.ts +2 -8
- package/lib/typescript/components/typography/H4.d.ts.map +1 -1
- package/lib/typescript/components/typography/H5.d.ts +2 -8
- package/lib/typescript/components/typography/H5.d.ts.map +1 -1
- package/lib/typescript/components/typography/H6.d.ts +2 -8
- package/lib/typescript/components/typography/H6.d.ts.map +1 -1
- package/lib/typescript/components/typography/Hero.d.ts +2 -8
- package/lib/typescript/components/typography/Hero.d.ts.map +1 -1
- package/lib/typescript/components/typography/IOText.d.ts +5 -5
- package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
- package/lib/typescript/components/typography/LabelMini.d.ts +4 -2
- package/lib/typescript/components/typography/LabelMini.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH1.d.ts +2 -8
- package/lib/typescript/components/typography/markdown/MdH1.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH2.d.ts +2 -8
- package/lib/typescript/components/typography/markdown/MdH2.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH3.d.ts +2 -8
- package/lib/typescript/components/typography/markdown/MdH3.d.ts.map +1 -1
- package/lib/typescript/context/IOThemeContextProvider.d.ts.map +1 -1
- package/package.json +6 -7
- package/src/components/alert/Alert.tsx +108 -112
- package/src/components/banner/Banner.tsx +121 -125
- package/src/components/buttons/IOButton/IOButton.tsx +204 -216
- package/src/components/layout/ContentWrapper.tsx +21 -24
- package/src/components/otpInput/OTPInput.tsx +156 -167
- package/src/components/searchInput/SearchInput.tsx +208 -217
- package/src/components/tabs/TabItem.tsx +143 -146
- package/src/components/textInput/TextInputValidation.tsx +116 -122
- package/src/components/typography/Body.tsx +51 -52
- package/src/components/typography/BodyMonospace.tsx +19 -24
- package/src/components/typography/BodySmall.tsx +51 -52
- package/src/components/typography/ButtonText.tsx +14 -20
- package/src/components/typography/Caption.tsx +18 -23
- package/src/components/typography/H1.tsx +12 -20
- package/src/components/typography/H2.tsx +16 -23
- package/src/components/typography/H3.tsx +12 -20
- package/src/components/typography/H4.tsx +12 -20
- package/src/components/typography/H5.tsx +16 -24
- package/src/components/typography/H6.tsx +13 -21
- package/src/components/typography/Hero.tsx +14 -19
- package/src/components/typography/IOText.tsx +54 -59
- package/src/components/typography/LabelMini.tsx +45 -49
- package/src/components/typography/markdown/MdH1.tsx +14 -19
- package/src/components/typography/markdown/MdH2.tsx +14 -19
- package/src/components/typography/markdown/MdH3.tsx +14 -19
- package/src/context/IOThemeContextProvider.tsx +4 -12
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
/* eslint-disable functional/immutable-data */
|
|
2
|
-
import {
|
|
3
|
-
forwardRef,
|
|
4
|
-
useCallback,
|
|
5
|
-
useImperativeHandle,
|
|
6
|
-
useRef,
|
|
7
|
-
useState
|
|
8
|
-
} from "react";
|
|
2
|
+
import { Ref, useCallback, useImperativeHandle, useRef, useState } from "react";
|
|
9
3
|
import {
|
|
10
4
|
ColorValue,
|
|
11
5
|
Dimensions,
|
|
@@ -76,6 +70,7 @@ type SearchInputActionProps =
|
|
|
76
70
|
};
|
|
77
71
|
|
|
78
72
|
type SearchInputProps = WithTestID<{
|
|
73
|
+
ref?: Ref<SearchInputRef>;
|
|
79
74
|
accessibilityLabel: TextInputProps["accessibilityLabel"];
|
|
80
75
|
cancelButtonLabel: string;
|
|
81
76
|
clearAccessibilityLabel: string;
|
|
@@ -96,246 +91,242 @@ const inputWithTimingConfig = {
|
|
|
96
91
|
easing: Easing.inOut(Easing.cubic)
|
|
97
92
|
};
|
|
98
93
|
|
|
99
|
-
export const SearchInput =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
) => {
|
|
116
|
-
const searchInputRef = useRef<TextInput>(null);
|
|
117
|
-
const { newTypefaceEnabled } = useIONewTypeface();
|
|
94
|
+
export const SearchInput = ({
|
|
95
|
+
accessibilityLabel,
|
|
96
|
+
cancelButtonLabel,
|
|
97
|
+
clearAccessibilityLabel,
|
|
98
|
+
placeholder,
|
|
99
|
+
autoFocus,
|
|
100
|
+
keepCancelVisible = false,
|
|
101
|
+
onCancel,
|
|
102
|
+
onChangeText,
|
|
103
|
+
pressable,
|
|
104
|
+
testID,
|
|
105
|
+
value = "",
|
|
106
|
+
ref
|
|
107
|
+
}: SearchInputProps) => {
|
|
108
|
+
const searchInputRef = useRef<TextInput>(null);
|
|
109
|
+
const { newTypefaceEnabled } = useIONewTypeface();
|
|
118
110
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
/* Component visual attributes */
|
|
112
|
+
const theme = useIOTheme();
|
|
113
|
+
const inputCaretColor = IOColors[theme["interactiveElem-default"]];
|
|
122
114
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
115
|
+
const inputBgColorDefault: ColorValue =
|
|
116
|
+
IOColors[theme["appBackground-secondary"]];
|
|
117
|
+
const inputBgColorFocused: ColorValue =
|
|
118
|
+
IOColors[theme["appBackground-tertiary"]];
|
|
119
|
+
const inputColorPlaceholder: ColorValue =
|
|
120
|
+
IOColors[theme["textBody-tertiary"]];
|
|
121
|
+
const iconColor: IOColors = theme["textBody-tertiary"];
|
|
130
122
|
|
|
131
|
-
|
|
123
|
+
/* Widths used for the transition:
|
|
132
124
|
- `SearchInput` entire width
|
|
133
125
|
- `Cancel` button */
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const [cancelButtonWidth, setCancelButtonWidth] =
|
|
138
|
-
useState<LayoutRectangle["width"]>(0);
|
|
126
|
+
const inputWidth: number =
|
|
127
|
+
Dimensions.get("window").width - IOVisualCostants.appMarginDefault * 2;
|
|
139
128
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
};
|
|
129
|
+
const [cancelButtonWidth, setCancelButtonWidth] =
|
|
130
|
+
useState<LayoutRectangle["width"]>(0);
|
|
143
131
|
|
|
144
|
-
|
|
132
|
+
const getCancelButtonWidth = ({ nativeEvent }: LayoutChangeEvent) => {
|
|
133
|
+
setCancelButtonWidth(nativeEvent.layout.width);
|
|
134
|
+
};
|
|
145
135
|
|
|
146
|
-
|
|
147
|
-
ref,
|
|
148
|
-
() => ({
|
|
149
|
-
focus() {
|
|
150
|
-
searchInputRef.current?.focus();
|
|
151
|
-
}
|
|
152
|
-
}),
|
|
153
|
-
[]
|
|
154
|
-
);
|
|
136
|
+
const inputWidthWithCancel: number = inputWidth - cancelButtonWidth;
|
|
155
137
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
138
|
+
useImperativeHandle(
|
|
139
|
+
ref,
|
|
140
|
+
() => ({
|
|
141
|
+
focus() {
|
|
142
|
+
searchInputRef.current?.focus();
|
|
143
|
+
}
|
|
144
|
+
}),
|
|
145
|
+
[]
|
|
146
|
+
);
|
|
159
147
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
backgroundColor: interpolateColor(
|
|
164
|
-
isFocused.value,
|
|
165
|
-
[0, 1],
|
|
166
|
-
[inputBgColorDefault, inputBgColorFocused]
|
|
167
|
-
)
|
|
168
|
-
}));
|
|
148
|
+
/* Reanimated styles */
|
|
149
|
+
const inputAnimatedWidth = useSharedValue<number>(inputWidth);
|
|
150
|
+
const isFocused = useSharedValue(0);
|
|
169
151
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
152
|
+
/* Applied to the `SearchInput` */
|
|
153
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
154
|
+
width: withTiming(inputAnimatedWidth.value, inputWithTimingConfig),
|
|
155
|
+
backgroundColor: interpolateColor(
|
|
156
|
+
isFocused.value,
|
|
157
|
+
[0, 1],
|
|
158
|
+
[inputBgColorDefault, inputBgColorFocused]
|
|
159
|
+
)
|
|
160
|
+
}));
|
|
174
161
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
showCancelButton,
|
|
180
|
-
[0, 1],
|
|
181
|
-
[cancelButtonWidth + IOVisualCostants.appMarginDefault, 0],
|
|
182
|
-
Extrapolation.CLAMP
|
|
183
|
-
)
|
|
184
|
-
}
|
|
185
|
-
],
|
|
186
|
-
opacity: interpolate(showCancelButton, [0, 1], [0.5, 1])
|
|
187
|
-
};
|
|
188
|
-
});
|
|
162
|
+
/* Applied to the `Cancel` button */
|
|
163
|
+
const cancelButtonAnimatedStyle = useAnimatedStyle(() => {
|
|
164
|
+
const showCancelButton =
|
|
165
|
+
!pressable && keepCancelVisible ? 1 : isFocused.value;
|
|
189
166
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
167
|
+
return {
|
|
168
|
+
transform: [
|
|
169
|
+
{
|
|
170
|
+
translateX: interpolate(
|
|
171
|
+
showCancelButton,
|
|
172
|
+
[0, 1],
|
|
173
|
+
[cancelButtonWidth + IOVisualCostants.appMarginDefault, 0],
|
|
174
|
+
Extrapolation.CLAMP
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
opacity: interpolate(showCancelButton, [0, 1], [0.5, 1])
|
|
179
|
+
};
|
|
180
|
+
});
|
|
193
181
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
scale: showClearButton
|
|
198
|
-
? withTiming(1, inputWithTimingConfig)
|
|
199
|
-
: withTiming(0.5, inputWithTimingConfig)
|
|
200
|
-
}
|
|
201
|
-
],
|
|
202
|
-
opacity: withTiming(showClearButton ? 1 : 0, inputWithTimingConfig)
|
|
203
|
-
};
|
|
204
|
-
}, [value]);
|
|
182
|
+
/* Applied to the `Clear` button inside the `SearchInput` */
|
|
183
|
+
const clearButtonAnimatedStyle = useAnimatedStyle(() => {
|
|
184
|
+
const showClearButton = value.length > 0;
|
|
205
185
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
186
|
+
return {
|
|
187
|
+
transform: [
|
|
188
|
+
{
|
|
189
|
+
scale: showClearButton
|
|
190
|
+
? withTiming(1, inputWithTimingConfig)
|
|
191
|
+
: withTiming(0.5, inputWithTimingConfig)
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
opacity: withTiming(showClearButton ? 1 : 0, inputWithTimingConfig)
|
|
210
195
|
};
|
|
196
|
+
}, [value]);
|
|
211
197
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
};
|
|
198
|
+
/* Related event handlers */
|
|
199
|
+
const handleFocus = () => {
|
|
200
|
+
isFocused.value = withTiming(1, inputWithTimingConfig);
|
|
201
|
+
inputAnimatedWidth.value = inputWidthWithCancel;
|
|
202
|
+
};
|
|
218
203
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
);
|
|
204
|
+
const handleBlur = () => {
|
|
205
|
+
isFocused.value = withTiming(0, inputWithTimingConfig);
|
|
206
|
+
inputAnimatedWidth.value = keepCancelVisible
|
|
207
|
+
? inputWidthWithCancel
|
|
208
|
+
: inputWidth;
|
|
209
|
+
};
|
|
226
210
|
|
|
227
|
-
|
|
211
|
+
const handleCancel = useCallback(
|
|
212
|
+
(event: GestureResponderEvent) => {
|
|
228
213
|
onChangeText?.("");
|
|
229
|
-
|
|
230
|
-
},
|
|
214
|
+
onCancel?.(event);
|
|
215
|
+
},
|
|
216
|
+
[onCancel, onChangeText]
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
const handleClear = useCallback(() => {
|
|
220
|
+
onChangeText?.("");
|
|
221
|
+
searchInputRef.current?.clear();
|
|
222
|
+
}, [onChangeText]);
|
|
231
223
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
224
|
+
const handleChangeText = useCallback(
|
|
225
|
+
(text: string) => onChangeText?.(text),
|
|
226
|
+
[onChangeText]
|
|
227
|
+
);
|
|
236
228
|
|
|
237
|
-
|
|
229
|
+
const renderSearchBar = () => (
|
|
230
|
+
<Animated.View
|
|
231
|
+
importantForAccessibility={pressable ? "no-hide-descendants" : "auto"}
|
|
232
|
+
style={styles.searchBar}
|
|
233
|
+
>
|
|
238
234
|
<Animated.View
|
|
239
|
-
|
|
240
|
-
|
|
235
|
+
style={[styles.searchInput, animatedStyle]}
|
|
236
|
+
pointerEvents={pressable ? "none" : "auto"}
|
|
241
237
|
>
|
|
242
|
-
<
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
allowFontScaling
|
|
249
|
-
name="search"
|
|
250
|
-
size={iconSize}
|
|
251
|
-
color={iconColor}
|
|
252
|
-
/>
|
|
253
|
-
</View>
|
|
254
|
-
<AnimatedTextInput
|
|
255
|
-
testID={testID}
|
|
256
|
-
ref={searchInputRef}
|
|
257
|
-
inputMode="search"
|
|
258
|
-
returnKeyType="search"
|
|
259
|
-
accessibilityRole={"search"}
|
|
260
|
-
accessibilityLabel={accessibilityLabel}
|
|
261
|
-
numberOfLines={1}
|
|
262
|
-
style={[
|
|
263
|
-
{
|
|
264
|
-
color: IOColors[theme["textBody-default"]],
|
|
265
|
-
...makeFontStyleObject(
|
|
266
|
-
inputFontSizePlaceholder,
|
|
267
|
-
newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
|
|
268
|
-
undefined,
|
|
269
|
-
"Regular"
|
|
270
|
-
)
|
|
271
|
-
},
|
|
272
|
-
styles.textInput,
|
|
273
|
-
Platform.OS === "ios"
|
|
274
|
-
? styles.textInputIOS
|
|
275
|
-
: styles.textInputAndroid
|
|
276
|
-
]}
|
|
277
|
-
selectionColor={inputCaretColor}
|
|
278
|
-
cursorColor={inputCaretColor}
|
|
279
|
-
placeholder={placeholder}
|
|
280
|
-
placeholderTextColor={inputColorPlaceholder}
|
|
281
|
-
onFocus={handleFocus}
|
|
282
|
-
onBlur={handleBlur}
|
|
283
|
-
onChangeText={handleChangeText}
|
|
284
|
-
value={value}
|
|
285
|
-
autoFocus={autoFocus}
|
|
286
|
-
maxFontSizeMultiplier={IOMaxFontSizeMultiplier}
|
|
238
|
+
<View style={styles.iconContainer}>
|
|
239
|
+
<Icon
|
|
240
|
+
allowFontScaling
|
|
241
|
+
name="search"
|
|
242
|
+
size={iconSize}
|
|
243
|
+
color={iconColor}
|
|
287
244
|
/>
|
|
245
|
+
</View>
|
|
246
|
+
<AnimatedTextInput
|
|
247
|
+
testID={testID}
|
|
248
|
+
ref={searchInputRef}
|
|
249
|
+
inputMode="search"
|
|
250
|
+
returnKeyType="search"
|
|
251
|
+
accessibilityRole={"search"}
|
|
252
|
+
accessibilityLabel={accessibilityLabel}
|
|
253
|
+
numberOfLines={1}
|
|
254
|
+
style={[
|
|
255
|
+
{
|
|
256
|
+
color: IOColors[theme["textBody-default"]],
|
|
257
|
+
...makeFontStyleObject(
|
|
258
|
+
inputFontSizePlaceholder,
|
|
259
|
+
newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
|
|
260
|
+
undefined,
|
|
261
|
+
"Regular"
|
|
262
|
+
)
|
|
263
|
+
},
|
|
264
|
+
styles.textInput,
|
|
265
|
+
Platform.OS === "ios"
|
|
266
|
+
? styles.textInputIOS
|
|
267
|
+
: styles.textInputAndroid
|
|
268
|
+
]}
|
|
269
|
+
selectionColor={inputCaretColor}
|
|
270
|
+
cursorColor={inputCaretColor}
|
|
271
|
+
placeholder={placeholder}
|
|
272
|
+
placeholderTextColor={inputColorPlaceholder}
|
|
273
|
+
onFocus={handleFocus}
|
|
274
|
+
onBlur={handleBlur}
|
|
275
|
+
onChangeText={handleChangeText}
|
|
276
|
+
value={value}
|
|
277
|
+
autoFocus={autoFocus}
|
|
278
|
+
maxFontSizeMultiplier={IOMaxFontSizeMultiplier}
|
|
279
|
+
/>
|
|
288
280
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
>
|
|
296
|
-
<Icon name="closeSmall" size={iconCloseSize} color={iconColor} />
|
|
297
|
-
</AnimatedPressable>
|
|
298
|
-
</Animated.View>
|
|
299
|
-
<Animated.View
|
|
300
|
-
onLayout={getCancelButtonWidth}
|
|
301
|
-
style={[styles.cancelButton, cancelButtonAnimatedStyle]}
|
|
281
|
+
<AnimatedPressable
|
|
282
|
+
style={[styles.clearButton, clearButtonAnimatedStyle]}
|
|
283
|
+
onPress={handleClear}
|
|
284
|
+
accessibilityLabel={clearAccessibilityLabel}
|
|
285
|
+
accessibilityRole="button"
|
|
286
|
+
hitSlop={16}
|
|
302
287
|
>
|
|
303
|
-
<
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
288
|
+
<Icon name="closeSmall" size={iconCloseSize} color={iconColor} />
|
|
289
|
+
</AnimatedPressable>
|
|
290
|
+
</Animated.View>
|
|
291
|
+
<Animated.View
|
|
292
|
+
onLayout={getCancelButtonWidth}
|
|
293
|
+
style={[styles.cancelButton, cancelButtonAnimatedStyle]}
|
|
294
|
+
>
|
|
295
|
+
<Pressable
|
|
296
|
+
accessibilityRole="button"
|
|
297
|
+
accessibilityLabel={cancelButtonLabel}
|
|
298
|
+
onPress={handleCancel}
|
|
299
|
+
>
|
|
300
|
+
<IOText
|
|
301
|
+
color={theme["interactiveElem-default"]}
|
|
302
|
+
weight={"Semibold"}
|
|
303
|
+
size={buttonTextFontSize}
|
|
304
|
+
lineHeight={buttonTextLineHeight}
|
|
305
|
+
numberOfLines={1}
|
|
306
|
+
accessible={false}
|
|
307
|
+
accessibilityElementsHidden
|
|
308
|
+
importantForAccessibility="no-hide-descendants"
|
|
307
309
|
>
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
size={buttonTextFontSize}
|
|
312
|
-
lineHeight={buttonTextLineHeight}
|
|
313
|
-
numberOfLines={1}
|
|
314
|
-
accessible={false}
|
|
315
|
-
accessibilityElementsHidden
|
|
316
|
-
importantForAccessibility="no-hide-descendants"
|
|
317
|
-
>
|
|
318
|
-
{cancelButtonLabel}
|
|
319
|
-
</IOText>
|
|
320
|
-
</Pressable>
|
|
321
|
-
</Animated.View>
|
|
310
|
+
{cancelButtonLabel}
|
|
311
|
+
</IOText>
|
|
312
|
+
</Pressable>
|
|
322
313
|
</Animated.View>
|
|
323
|
-
|
|
314
|
+
</Animated.View>
|
|
315
|
+
);
|
|
324
316
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
);
|
|
317
|
+
return pressable ? (
|
|
318
|
+
<Pressable
|
|
319
|
+
accessible={true}
|
|
320
|
+
accessibilityRole="button"
|
|
321
|
+
accessibilityLabel={placeholder}
|
|
322
|
+
onPress={pressable.onPress}
|
|
323
|
+
>
|
|
324
|
+
{renderSearchBar()}
|
|
325
|
+
</Pressable>
|
|
326
|
+
) : (
|
|
327
|
+
renderSearchBar()
|
|
328
|
+
);
|
|
329
|
+
};
|
|
339
330
|
|
|
340
331
|
const styles = StyleSheet.create({
|
|
341
332
|
searchBar: {
|