@terreno/ui 0.28.0 → 0.29.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/dist/Common.d.ts +89 -0
- package/dist/Common.js.map +1 -1
- package/dist/Signature.d.ts +3 -1
- package/dist/Signature.js +4 -3
- package/dist/Signature.js.map +1 -1
- package/dist/Signature.native.d.ts +2 -0
- package/dist/Signature.native.js +2 -2
- package/dist/Signature.native.js.map +1 -1
- package/dist/SignatureCaptureField.d.ts +13 -0
- package/dist/SignatureCaptureField.js +69 -0
- package/dist/SignatureCaptureField.js.map +1 -0
- package/dist/TypedSignatureField.d.ts +18 -0
- package/dist/TypedSignatureField.js +102 -0
- package/dist/TypedSignatureField.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +5 -1
- package/src/Common.ts +97 -0
- package/src/Signature.native.tsx +10 -2
- package/src/Signature.tsx +5 -0
- package/src/SignatureCaptureField.test.tsx +135 -0
- package/src/SignatureCaptureField.tsx +172 -0
- package/src/TypedSignatureField.test.tsx +113 -0
- package/src/TypedSignatureField.tsx +181 -0
- package/src/__snapshots__/SignatureCaptureField.test.tsx.snap +51 -0
- package/src/__snapshots__/TypedSignatureField.test.tsx.snap +372 -0
- package/src/bunSetup.ts +28 -0
- package/src/index.tsx +2 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import {Caveat_400Regular} from "@expo-google-fonts/caveat";
|
|
2
|
+
import {DancingScript_400Regular} from "@expo-google-fonts/dancing-script";
|
|
3
|
+
import {GreatVibes_400Regular} from "@expo-google-fonts/great-vibes";
|
|
4
|
+
import {Sacramento_400Regular} from "@expo-google-fonts/sacramento";
|
|
5
|
+
import {useFonts} from "expo-font";
|
|
6
|
+
import type {ReactElement} from "react";
|
|
7
|
+
import {Text as NativeText, Pressable, View} from "react-native";
|
|
8
|
+
|
|
9
|
+
import type {SignatureFont, TypedSignatureFieldProps, TypedSignatureValue} from "./Common";
|
|
10
|
+
import {FieldError} from "./fieldElements/FieldError";
|
|
11
|
+
import {FieldHelperText} from "./fieldElements/FieldHelperText";
|
|
12
|
+
import {FieldTitle} from "./fieldElements/FieldTitle";
|
|
13
|
+
import {TextField} from "./TextField";
|
|
14
|
+
import {useTheme} from "./Theme";
|
|
15
|
+
import {resolveFieldTestIDsFromProps} from "./testing/resolveTestId";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Font families registered by this component via expo-font. Prefixed with "signature-" to
|
|
19
|
+
* avoid colliding with the app's text/heading font families.
|
|
20
|
+
*/
|
|
21
|
+
const SIGNATURE_FONT_MODULES = {
|
|
22
|
+
"signature-caveat": Caveat_400Regular,
|
|
23
|
+
"signature-dancing-script": DancingScript_400Regular,
|
|
24
|
+
"signature-great-vibes": GreatVibes_400Regular,
|
|
25
|
+
"signature-sacramento": Sacramento_400Regular,
|
|
26
|
+
} as const;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The default set of signature typefaces bundled with the library. Consumers persist the
|
|
30
|
+
* `key`; the `fontFamily` values match the families loaded by this component.
|
|
31
|
+
*/
|
|
32
|
+
export const DEFAULT_SIGNATURE_FONTS: SignatureFont[] = [
|
|
33
|
+
{fontFamily: "signature-dancing-script", key: "dancing-script", label: "Dancing Script"},
|
|
34
|
+
{fontFamily: "signature-great-vibes", key: "great-vibes", label: "Great Vibes"},
|
|
35
|
+
{fontFamily: "signature-sacramento", key: "sacramento", label: "Sacramento"},
|
|
36
|
+
{fontFamily: "signature-caveat", key: "caveat", label: "Caveat"},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the currently selected font from the value, falling back to the first font when
|
|
41
|
+
* the stored `fontKey` is unknown (e.g. a font was removed) or no value is set yet.
|
|
42
|
+
*/
|
|
43
|
+
const resolveSelectedFont = (
|
|
44
|
+
fonts: SignatureFont[],
|
|
45
|
+
fontKey: string | undefined
|
|
46
|
+
): SignatureFont => {
|
|
47
|
+
return fonts.find((font) => font.key === fontKey) ?? fonts[0];
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A cross-platform typed signature field. The signer types their name and picks a font from a
|
|
52
|
+
* live-previewing picker; the same UI and output are produced on web and native. Emits a
|
|
53
|
+
* {@link TypedSignatureValue} (typed name + font key) on every change so parents can gate
|
|
54
|
+
* "signature required" and persist the result directly.
|
|
55
|
+
*
|
|
56
|
+
* Font fidelity depends on the chosen font families being loaded. The bundled default fonts
|
|
57
|
+
* are loaded by this component; when a custom `fonts` list is supplied the consumer must load
|
|
58
|
+
* those families themselves.
|
|
59
|
+
*/
|
|
60
|
+
export const TypedSignatureField = ({
|
|
61
|
+
title = "Signature",
|
|
62
|
+
value,
|
|
63
|
+
onChange,
|
|
64
|
+
fonts = DEFAULT_SIGNATURE_FONTS,
|
|
65
|
+
nameLabel = "Full name",
|
|
66
|
+
placeholder = "Type your full name",
|
|
67
|
+
helperText,
|
|
68
|
+
errorText,
|
|
69
|
+
disabled = false,
|
|
70
|
+
testID,
|
|
71
|
+
testIDs,
|
|
72
|
+
}: TypedSignatureFieldProps): ReactElement => {
|
|
73
|
+
const {theme} = useTheme();
|
|
74
|
+
// Load the bundled signature fonts. Rendering is not blocked on load — previews fall back to
|
|
75
|
+
// the system font briefly, then re-render once the families are available.
|
|
76
|
+
useFonts(SIGNATURE_FONT_MODULES);
|
|
77
|
+
|
|
78
|
+
const fieldTestIDs = resolveFieldTestIDsFromProps({testID, testIDs});
|
|
79
|
+
|
|
80
|
+
// Guard against an empty `fonts` list: `fonts` is a public prop, so a caller can legitimately
|
|
81
|
+
// pass `[]`. Fall back to the bundled defaults so the field always has a usable font rather
|
|
82
|
+
// than dereferencing `undefined` on the first render.
|
|
83
|
+
const resolvedFonts = fonts.length > 0 ? fonts : DEFAULT_SIGNATURE_FONTS;
|
|
84
|
+
|
|
85
|
+
const typedName = value?.typedName ?? "";
|
|
86
|
+
const selectedFont = resolveSelectedFont(resolvedFonts, value?.fontKey);
|
|
87
|
+
const hasName = typedName.trim().length > 0;
|
|
88
|
+
|
|
89
|
+
const emitChange = (next: Partial<TypedSignatureValue>): void => {
|
|
90
|
+
onChange({
|
|
91
|
+
fontKey: next.fontKey ?? selectedFont.key,
|
|
92
|
+
typedName: next.typedName ?? typedName,
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return (
|
|
97
|
+
<View style={{flexDirection: "column", width: "100%"}} {...(testID ? {testID} : {})}>
|
|
98
|
+
{Boolean(title) && <FieldTitle testID={fieldTestIDs.label} text={title} />}
|
|
99
|
+
{Boolean(errorText) && <FieldError testID={fieldTestIDs.error} text={errorText!} />}
|
|
100
|
+
|
|
101
|
+
<View style={{marginTop: 8}}>
|
|
102
|
+
<TextField
|
|
103
|
+
disabled={disabled}
|
|
104
|
+
onChange={(nextName) => emitChange({typedName: nextName})}
|
|
105
|
+
placeholder={placeholder}
|
|
106
|
+
testID={fieldTestIDs.input}
|
|
107
|
+
title={nameLabel}
|
|
108
|
+
type="text"
|
|
109
|
+
value={typedName}
|
|
110
|
+
/>
|
|
111
|
+
</View>
|
|
112
|
+
|
|
113
|
+
{/* Font picker: each option renders its own label in its own typeface so the signer can
|
|
114
|
+
compare styles before selecting. */}
|
|
115
|
+
<View style={{flexDirection: "row", flexWrap: "wrap", gap: 8, marginTop: 12}}>
|
|
116
|
+
{resolvedFonts.map((font) => {
|
|
117
|
+
const isSelected = font.key === selectedFont.key;
|
|
118
|
+
return (
|
|
119
|
+
<Pressable
|
|
120
|
+
accessibilityHint="Sets the style of your signature"
|
|
121
|
+
accessibilityLabel={`Signature font ${font.label}`}
|
|
122
|
+
accessibilityState={{disabled, selected: isSelected}}
|
|
123
|
+
aria-role="button"
|
|
124
|
+
disabled={disabled}
|
|
125
|
+
hitSlop={8}
|
|
126
|
+
key={font.key}
|
|
127
|
+
onPress={() => emitChange({fontKey: font.key})}
|
|
128
|
+
style={{
|
|
129
|
+
backgroundColor: isSelected ? theme.surface.neutralLight : theme.surface.base,
|
|
130
|
+
borderColor: isSelected ? theme.border.activeAccent : theme.border.default,
|
|
131
|
+
borderRadius: 8,
|
|
132
|
+
borderWidth: isSelected ? 2 : 1,
|
|
133
|
+
minWidth: 96,
|
|
134
|
+
opacity: disabled ? 0.5 : 1,
|
|
135
|
+
paddingHorizontal: 12,
|
|
136
|
+
paddingVertical: 8,
|
|
137
|
+
}}
|
|
138
|
+
>
|
|
139
|
+
<NativeText
|
|
140
|
+
numberOfLines={1}
|
|
141
|
+
style={{color: theme.text.primary, fontFamily: font.fontFamily, fontSize: 22}}
|
|
142
|
+
>
|
|
143
|
+
{font.label}
|
|
144
|
+
</NativeText>
|
|
145
|
+
</Pressable>
|
|
146
|
+
);
|
|
147
|
+
})}
|
|
148
|
+
</View>
|
|
149
|
+
|
|
150
|
+
{/* Live preview of the finished signature in the selected font. */}
|
|
151
|
+
<View
|
|
152
|
+
style={{
|
|
153
|
+
alignItems: "center",
|
|
154
|
+
backgroundColor: theme.surface.base,
|
|
155
|
+
borderColor: theme.border.dark,
|
|
156
|
+
borderRadius: 4,
|
|
157
|
+
borderWidth: 1,
|
|
158
|
+
justifyContent: "center",
|
|
159
|
+
marginTop: 12,
|
|
160
|
+
minHeight: 96,
|
|
161
|
+
paddingHorizontal: 16,
|
|
162
|
+
paddingVertical: 12,
|
|
163
|
+
}}
|
|
164
|
+
testID={fieldTestIDs.helper ? `${fieldTestIDs.helper}-preview` : undefined}
|
|
165
|
+
>
|
|
166
|
+
<NativeText
|
|
167
|
+
numberOfLines={1}
|
|
168
|
+
style={{
|
|
169
|
+
color: hasName ? theme.text.primary : theme.text.secondaryLight,
|
|
170
|
+
fontFamily: selectedFont.fontFamily,
|
|
171
|
+
fontSize: 40,
|
|
172
|
+
}}
|
|
173
|
+
>
|
|
174
|
+
{hasName ? typedName : placeholder}
|
|
175
|
+
</NativeText>
|
|
176
|
+
</View>
|
|
177
|
+
|
|
178
|
+
{Boolean(helperText) && <FieldHelperText testID={fieldTestIDs.helper} text={helperText!} />}
|
|
179
|
+
</View>
|
|
180
|
+
);
|
|
181
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
+
|
|
3
|
+
exports[`SignatureCaptureField renders a read-only drawn image when disabled with a drawn value 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"$$typeof": Symbol(react.test.json),
|
|
6
|
+
"children": [
|
|
7
|
+
{
|
|
8
|
+
"$$typeof": Symbol(react.test.json),
|
|
9
|
+
"children": [
|
|
10
|
+
"Signature",
|
|
11
|
+
],
|
|
12
|
+
"props": {
|
|
13
|
+
"style": {
|
|
14
|
+
"color": "#1C1C1C",
|
|
15
|
+
"fontSize": 14,
|
|
16
|
+
"fontWeight": 600,
|
|
17
|
+
"lineHeight": 22.4,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
"type": "Text",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"$$typeof": Symbol(react.test.json),
|
|
24
|
+
"children": null,
|
|
25
|
+
"props": {
|
|
26
|
+
"accessibilityIgnoresInvertColors": false,
|
|
27
|
+
"resizeMode": "contain",
|
|
28
|
+
"source": {
|
|
29
|
+
"uri": "data:image/png;base64,xyz",
|
|
30
|
+
},
|
|
31
|
+
"style": {
|
|
32
|
+
"borderColor": "#9A9A9A",
|
|
33
|
+
"borderWidth": 1,
|
|
34
|
+
"height": 80,
|
|
35
|
+
"marginVertical": 8,
|
|
36
|
+
"width": 300,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
"type": "Image",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
"props": {
|
|
43
|
+
"style": {
|
|
44
|
+
"flexDirection": "column",
|
|
45
|
+
"width": "100%",
|
|
46
|
+
},
|
|
47
|
+
"testID": undefined,
|
|
48
|
+
},
|
|
49
|
+
"type": "View",
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
// Bun Snapshot v1, https://bun.sh/docs/test/snapshots
|
|
2
|
+
|
|
3
|
+
exports[`TypedSignatureField renders correctly with default props 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"$$typeof": Symbol(react.test.json),
|
|
6
|
+
"children": [
|
|
7
|
+
{
|
|
8
|
+
"$$typeof": Symbol(react.test.json),
|
|
9
|
+
"children": [
|
|
10
|
+
"Signature",
|
|
11
|
+
],
|
|
12
|
+
"props": {
|
|
13
|
+
"style": {
|
|
14
|
+
"color": "#1C1C1C",
|
|
15
|
+
"fontSize": 14,
|
|
16
|
+
"fontWeight": 600,
|
|
17
|
+
"lineHeight": 22.4,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
"type": "Text",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"$$typeof": Symbol(react.test.json),
|
|
24
|
+
"children": [
|
|
25
|
+
{
|
|
26
|
+
"$$typeof": Symbol(react.test.json),
|
|
27
|
+
"children": [
|
|
28
|
+
{
|
|
29
|
+
"$$typeof": Symbol(react.test.json),
|
|
30
|
+
"children": [
|
|
31
|
+
"Full name",
|
|
32
|
+
],
|
|
33
|
+
"props": {
|
|
34
|
+
"style": {
|
|
35
|
+
"color": "#1C1C1C",
|
|
36
|
+
"fontSize": 14,
|
|
37
|
+
"fontWeight": 600,
|
|
38
|
+
"lineHeight": 22.4,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
"type": "Text",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"$$typeof": Symbol(react.test.json),
|
|
45
|
+
"children": [
|
|
46
|
+
{
|
|
47
|
+
"$$typeof": Symbol(react.test.json),
|
|
48
|
+
"children": [
|
|
49
|
+
{
|
|
50
|
+
"$$typeof": Symbol(react.test.json),
|
|
51
|
+
"children": null,
|
|
52
|
+
"props": {
|
|
53
|
+
"accessibilityHint": "Enter text here",
|
|
54
|
+
"accessibilityState": {
|
|
55
|
+
"disabled": false,
|
|
56
|
+
},
|
|
57
|
+
"aria-label": "Text input field",
|
|
58
|
+
"autoCapitalize": "sentences",
|
|
59
|
+
"autoCorrect": true,
|
|
60
|
+
"blurOnSubmit": true,
|
|
61
|
+
"enterKeyHint": undefined,
|
|
62
|
+
"keyboardType": "default",
|
|
63
|
+
"multiline": undefined,
|
|
64
|
+
"nativeID": undefined,
|
|
65
|
+
"numberOfLines": 1,
|
|
66
|
+
"onBlur": [Function],
|
|
67
|
+
"onChangeText": [Function],
|
|
68
|
+
"onContentSizeChange": [Function],
|
|
69
|
+
"onFocus": [Function],
|
|
70
|
+
"onSubmitEditing": [Function],
|
|
71
|
+
"placeholder": "Type your full name",
|
|
72
|
+
"placeholderTextColor": "#686868",
|
|
73
|
+
"readOnly": false,
|
|
74
|
+
"ref": [Function],
|
|
75
|
+
"secureTextEntry": false,
|
|
76
|
+
"style": {
|
|
77
|
+
"color": "#1C1C1C",
|
|
78
|
+
"flex": 1,
|
|
79
|
+
"fontFamily": "text",
|
|
80
|
+
"fontSize": 16,
|
|
81
|
+
"gap": 10,
|
|
82
|
+
"height": 24,
|
|
83
|
+
"paddingVertical": 0,
|
|
84
|
+
"width": "100%",
|
|
85
|
+
},
|
|
86
|
+
"testID": undefined,
|
|
87
|
+
"textContentType": "none",
|
|
88
|
+
"underlineColorAndroid": "transparent",
|
|
89
|
+
"value": "",
|
|
90
|
+
},
|
|
91
|
+
"type": "TextInput",
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
"props": {
|
|
95
|
+
"style": {
|
|
96
|
+
"alignItems": "center",
|
|
97
|
+
"flexDirection": "row",
|
|
98
|
+
},
|
|
99
|
+
"testID": undefined,
|
|
100
|
+
},
|
|
101
|
+
"type": "View",
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
"props": {
|
|
105
|
+
"style": {
|
|
106
|
+
"backgroundColor": "#FFFFFF",
|
|
107
|
+
"borderColor": "#9A9A9A",
|
|
108
|
+
"borderRadius": 4,
|
|
109
|
+
"borderWidth": 1,
|
|
110
|
+
"flexDirection": "column",
|
|
111
|
+
"gap": 0,
|
|
112
|
+
"overflow": "hidden",
|
|
113
|
+
"paddingHorizontal": 12,
|
|
114
|
+
"paddingVertical": 8,
|
|
115
|
+
},
|
|
116
|
+
"testID": undefined,
|
|
117
|
+
},
|
|
118
|
+
"type": "View",
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
"props": {
|
|
122
|
+
"style": {
|
|
123
|
+
"flexDirection": "column",
|
|
124
|
+
"width": "100%",
|
|
125
|
+
},
|
|
126
|
+
"testID": undefined,
|
|
127
|
+
},
|
|
128
|
+
"type": "View",
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
"props": {
|
|
132
|
+
"style": {
|
|
133
|
+
"marginTop": 8,
|
|
134
|
+
},
|
|
135
|
+
"testID": undefined,
|
|
136
|
+
},
|
|
137
|
+
"type": "View",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"$$typeof": Symbol(react.test.json),
|
|
141
|
+
"children": [
|
|
142
|
+
{
|
|
143
|
+
"$$typeof": Symbol(react.test.json),
|
|
144
|
+
"children": [
|
|
145
|
+
{
|
|
146
|
+
"$$typeof": Symbol(react.test.json),
|
|
147
|
+
"children": [
|
|
148
|
+
"Dancing Script",
|
|
149
|
+
],
|
|
150
|
+
"props": {
|
|
151
|
+
"numberOfLines": 1,
|
|
152
|
+
"style": {
|
|
153
|
+
"color": "#1C1C1C",
|
|
154
|
+
"fontFamily": "signature-dancing-script",
|
|
155
|
+
"fontSize": 22,
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
"type": "Text",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
"props": {
|
|
162
|
+
"accessibilityHint": "Sets the style of your signature",
|
|
163
|
+
"accessibilityLabel": "Signature font Dancing Script",
|
|
164
|
+
"accessibilityState": {
|
|
165
|
+
"disabled": false,
|
|
166
|
+
"selected": true,
|
|
167
|
+
},
|
|
168
|
+
"aria-role": "button",
|
|
169
|
+
"disabled": false,
|
|
170
|
+
"hitSlop": 8,
|
|
171
|
+
"onPress": [Function],
|
|
172
|
+
"style": {
|
|
173
|
+
"backgroundColor": "#D9D9D9",
|
|
174
|
+
"borderColor": "#D69C0E",
|
|
175
|
+
"borderRadius": 8,
|
|
176
|
+
"borderWidth": 2,
|
|
177
|
+
"minWidth": 96,
|
|
178
|
+
"opacity": 1,
|
|
179
|
+
"paddingHorizontal": 12,
|
|
180
|
+
"paddingVertical": 8,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
"type": "Pressable",
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"$$typeof": Symbol(react.test.json),
|
|
187
|
+
"children": [
|
|
188
|
+
{
|
|
189
|
+
"$$typeof": Symbol(react.test.json),
|
|
190
|
+
"children": [
|
|
191
|
+
"Great Vibes",
|
|
192
|
+
],
|
|
193
|
+
"props": {
|
|
194
|
+
"numberOfLines": 1,
|
|
195
|
+
"style": {
|
|
196
|
+
"color": "#1C1C1C",
|
|
197
|
+
"fontFamily": "signature-great-vibes",
|
|
198
|
+
"fontSize": 22,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
"type": "Text",
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
"props": {
|
|
205
|
+
"accessibilityHint": "Sets the style of your signature",
|
|
206
|
+
"accessibilityLabel": "Signature font Great Vibes",
|
|
207
|
+
"accessibilityState": {
|
|
208
|
+
"disabled": false,
|
|
209
|
+
"selected": false,
|
|
210
|
+
},
|
|
211
|
+
"aria-role": "button",
|
|
212
|
+
"disabled": false,
|
|
213
|
+
"hitSlop": 8,
|
|
214
|
+
"onPress": [Function],
|
|
215
|
+
"style": {
|
|
216
|
+
"backgroundColor": "#FFFFFF",
|
|
217
|
+
"borderColor": "#CDCDCD",
|
|
218
|
+
"borderRadius": 8,
|
|
219
|
+
"borderWidth": 1,
|
|
220
|
+
"minWidth": 96,
|
|
221
|
+
"opacity": 1,
|
|
222
|
+
"paddingHorizontal": 12,
|
|
223
|
+
"paddingVertical": 8,
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
"type": "Pressable",
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"$$typeof": Symbol(react.test.json),
|
|
230
|
+
"children": [
|
|
231
|
+
{
|
|
232
|
+
"$$typeof": Symbol(react.test.json),
|
|
233
|
+
"children": [
|
|
234
|
+
"Sacramento",
|
|
235
|
+
],
|
|
236
|
+
"props": {
|
|
237
|
+
"numberOfLines": 1,
|
|
238
|
+
"style": {
|
|
239
|
+
"color": "#1C1C1C",
|
|
240
|
+
"fontFamily": "signature-sacramento",
|
|
241
|
+
"fontSize": 22,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
"type": "Text",
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
"props": {
|
|
248
|
+
"accessibilityHint": "Sets the style of your signature",
|
|
249
|
+
"accessibilityLabel": "Signature font Sacramento",
|
|
250
|
+
"accessibilityState": {
|
|
251
|
+
"disabled": false,
|
|
252
|
+
"selected": false,
|
|
253
|
+
},
|
|
254
|
+
"aria-role": "button",
|
|
255
|
+
"disabled": false,
|
|
256
|
+
"hitSlop": 8,
|
|
257
|
+
"onPress": [Function],
|
|
258
|
+
"style": {
|
|
259
|
+
"backgroundColor": "#FFFFFF",
|
|
260
|
+
"borderColor": "#CDCDCD",
|
|
261
|
+
"borderRadius": 8,
|
|
262
|
+
"borderWidth": 1,
|
|
263
|
+
"minWidth": 96,
|
|
264
|
+
"opacity": 1,
|
|
265
|
+
"paddingHorizontal": 12,
|
|
266
|
+
"paddingVertical": 8,
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
"type": "Pressable",
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"$$typeof": Symbol(react.test.json),
|
|
273
|
+
"children": [
|
|
274
|
+
{
|
|
275
|
+
"$$typeof": Symbol(react.test.json),
|
|
276
|
+
"children": [
|
|
277
|
+
"Caveat",
|
|
278
|
+
],
|
|
279
|
+
"props": {
|
|
280
|
+
"numberOfLines": 1,
|
|
281
|
+
"style": {
|
|
282
|
+
"color": "#1C1C1C",
|
|
283
|
+
"fontFamily": "signature-caveat",
|
|
284
|
+
"fontSize": 22,
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
"type": "Text",
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
"props": {
|
|
291
|
+
"accessibilityHint": "Sets the style of your signature",
|
|
292
|
+
"accessibilityLabel": "Signature font Caveat",
|
|
293
|
+
"accessibilityState": {
|
|
294
|
+
"disabled": false,
|
|
295
|
+
"selected": false,
|
|
296
|
+
},
|
|
297
|
+
"aria-role": "button",
|
|
298
|
+
"disabled": false,
|
|
299
|
+
"hitSlop": 8,
|
|
300
|
+
"onPress": [Function],
|
|
301
|
+
"style": {
|
|
302
|
+
"backgroundColor": "#FFFFFF",
|
|
303
|
+
"borderColor": "#CDCDCD",
|
|
304
|
+
"borderRadius": 8,
|
|
305
|
+
"borderWidth": 1,
|
|
306
|
+
"minWidth": 96,
|
|
307
|
+
"opacity": 1,
|
|
308
|
+
"paddingHorizontal": 12,
|
|
309
|
+
"paddingVertical": 8,
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
"type": "Pressable",
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
"props": {
|
|
316
|
+
"style": {
|
|
317
|
+
"flexDirection": "row",
|
|
318
|
+
"flexWrap": "wrap",
|
|
319
|
+
"gap": 8,
|
|
320
|
+
"marginTop": 12,
|
|
321
|
+
},
|
|
322
|
+
"testID": undefined,
|
|
323
|
+
},
|
|
324
|
+
"type": "View",
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"$$typeof": Symbol(react.test.json),
|
|
328
|
+
"children": [
|
|
329
|
+
{
|
|
330
|
+
"$$typeof": Symbol(react.test.json),
|
|
331
|
+
"children": [
|
|
332
|
+
"Type your full name",
|
|
333
|
+
],
|
|
334
|
+
"props": {
|
|
335
|
+
"numberOfLines": 1,
|
|
336
|
+
"style": {
|
|
337
|
+
"color": "#686868",
|
|
338
|
+
"fontFamily": "signature-dancing-script",
|
|
339
|
+
"fontSize": 40,
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
"type": "Text",
|
|
343
|
+
},
|
|
344
|
+
],
|
|
345
|
+
"props": {
|
|
346
|
+
"style": {
|
|
347
|
+
"alignItems": "center",
|
|
348
|
+
"backgroundColor": "#FFFFFF",
|
|
349
|
+
"borderColor": "#9A9A9A",
|
|
350
|
+
"borderRadius": 4,
|
|
351
|
+
"borderWidth": 1,
|
|
352
|
+
"justifyContent": "center",
|
|
353
|
+
"marginTop": 12,
|
|
354
|
+
"minHeight": 96,
|
|
355
|
+
"paddingHorizontal": 16,
|
|
356
|
+
"paddingVertical": 12,
|
|
357
|
+
},
|
|
358
|
+
"testID": undefined,
|
|
359
|
+
},
|
|
360
|
+
"type": "View",
|
|
361
|
+
},
|
|
362
|
+
],
|
|
363
|
+
"props": {
|
|
364
|
+
"style": {
|
|
365
|
+
"flexDirection": "column",
|
|
366
|
+
"width": "100%",
|
|
367
|
+
},
|
|
368
|
+
"testID": undefined,
|
|
369
|
+
},
|
|
370
|
+
"type": "View",
|
|
371
|
+
}
|
|
372
|
+
`;
|
package/src/bunSetup.ts
CHANGED
|
@@ -609,6 +609,34 @@ mock.module("@expo-google-fonts/titillium-web", () => ({
|
|
|
609
609
|
useFonts: mock(() => [true, null]),
|
|
610
610
|
}));
|
|
611
611
|
|
|
612
|
+
// Mock the signature font packages used by TypedSignatureField. The real packages import .ttf
|
|
613
|
+
// assets, which the bun test runner cannot parse, so stub each exported font module as a string.
|
|
614
|
+
mock.module("@expo-google-fonts/dancing-script", () => ({
|
|
615
|
+
DancingScript_400Regular: "DancingScript_400Regular",
|
|
616
|
+
DancingScript_500Medium: "DancingScript_500Medium",
|
|
617
|
+
DancingScript_600SemiBold: "DancingScript_600SemiBold",
|
|
618
|
+
DancingScript_700Bold: "DancingScript_700Bold",
|
|
619
|
+
useFonts: mock(() => [true, null]),
|
|
620
|
+
}));
|
|
621
|
+
|
|
622
|
+
mock.module("@expo-google-fonts/great-vibes", () => ({
|
|
623
|
+
GreatVibes_400Regular: "GreatVibes_400Regular",
|
|
624
|
+
useFonts: mock(() => [true, null]),
|
|
625
|
+
}));
|
|
626
|
+
|
|
627
|
+
mock.module("@expo-google-fonts/sacramento", () => ({
|
|
628
|
+
Sacramento_400Regular: "Sacramento_400Regular",
|
|
629
|
+
useFonts: mock(() => [true, null]),
|
|
630
|
+
}));
|
|
631
|
+
|
|
632
|
+
mock.module("@expo-google-fonts/caveat", () => ({
|
|
633
|
+
Caveat_400Regular: "Caveat_400Regular",
|
|
634
|
+
Caveat_500Medium: "Caveat_500Medium",
|
|
635
|
+
Caveat_600SemiBold: "Caveat_600SemiBold",
|
|
636
|
+
Caveat_700Bold: "Caveat_700Bold",
|
|
637
|
+
useFonts: mock(() => [true, null]),
|
|
638
|
+
}));
|
|
639
|
+
|
|
612
640
|
// Mock DateTimeActionSheet
|
|
613
641
|
mock.module("./DateTimeActionSheet", () => ({
|
|
614
642
|
DateTimeActionSheet: mock(() => null),
|
package/src/index.tsx
CHANGED
|
@@ -76,6 +76,7 @@ export * from "./SelectField";
|
|
|
76
76
|
export * from "./SidebarNavigation";
|
|
77
77
|
export * from "./SideDrawer";
|
|
78
78
|
export * from "./Signature";
|
|
79
|
+
export * from "./SignatureCaptureField";
|
|
79
80
|
export * from "./SignatureField";
|
|
80
81
|
export * from "./Slider";
|
|
81
82
|
export * from "./SocialLoginButton";
|
|
@@ -105,6 +106,7 @@ export * from "./TextField";
|
|
|
105
106
|
export * from "./Theme";
|
|
106
107
|
export * from "./Toast";
|
|
107
108
|
export {Tooltip} from "./Tooltip";
|
|
109
|
+
export * from "./TypedSignatureField";
|
|
108
110
|
export * from "./table/Table";
|
|
109
111
|
export * from "./table/Table";
|
|
110
112
|
export * from "./table/TableBadge";
|