aport-tools 4.5.0 → 4.6.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/package.json +17 -34
- package/src/cards/Card.tsx +129 -0
- package/src/cards/index.ts +1 -0
- package/src/components/Button.tsx +180 -0
- package/src/fonts/Text.tsx +137 -0
- package/{dist/fonts/index.d.ts → src/fonts/index.ts} +1 -0
- package/src/forms/ErrorList.tsx +47 -0
- package/src/forms/FORMDOC.md +87 -0
- package/{dist/forms/Form.d.ts → src/forms/Form.tsx} +2 -0
- package/src/forms/FormContext.tsx +248 -0
- package/src/forms/Input.tsx +174 -0
- package/src/forms/InputAttach.tsx +184 -0
- package/src/forms/InputCheck.tsx +169 -0
- package/src/forms/InputList.tsx +304 -0
- package/src/forms/Label.tsx +26 -0
- package/src/forms/Stepper.tsx +289 -0
- package/src/forms/TextArea.tsx +91 -0
- package/{dist/forms/index.d.ts → src/forms/index.ts} +4 -2
- package/src/index.ts +6 -0
- package/dist/cards/Card.d.ts +0 -57
- package/dist/cards/index.d.ts +0 -1
- package/dist/components/Button.d.ts +0 -52
- package/dist/defaults/reanimatedWrapper.d.ts +0 -2
- package/dist/fonts/Text.d.ts +0 -64
- package/dist/forms/ErrorList.d.ts +0 -6
- package/dist/forms/FormContext.d.ts +0 -132
- package/dist/forms/Input.d.ts +0 -43
- package/dist/forms/InputAttach.d.ts +0 -16
- package/dist/forms/InputCheck.d.ts +0 -19
- package/dist/forms/InputList.d.ts +0 -93
- package/dist/forms/Label.d.ts +0 -7
- package/dist/forms/Stepper.d.ts +0 -54
- package/dist/forms/TextArea.d.ts +0 -13
- package/dist/index.d.ts +0 -4
- package/dist/index.esm.js +0 -1493
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -1526
- package/dist/index.js.map +0 -1
- /package/{dist/buttons/index.d.ts → src/buttons/index.ts} +0 -0
@@ -0,0 +1,289 @@
|
|
1
|
+
import { ThemeContext } from "aport-themes";
|
2
|
+
import React, { useContext, useState } from "react";
|
3
|
+
import {
|
4
|
+
View,
|
5
|
+
StyleSheet,
|
6
|
+
Animated,
|
7
|
+
TouchableOpacity,
|
8
|
+
Image,
|
9
|
+
} from "react-native";
|
10
|
+
import { Text } from "../fonts";
|
11
|
+
import { useFormContext } from "./FormContext";
|
12
|
+
|
13
|
+
interface StepperProps {
|
14
|
+
/**
|
15
|
+
* Labels for each step (optional). If provided, these labels will display below each step indicator.
|
16
|
+
* Example: ['Step 1', 'Step 2', 'Step 3']
|
17
|
+
*/
|
18
|
+
steps?: string[];
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Current step index (e.g., 0 for step 1, 1 for step 2).
|
22
|
+
* Determines the active step and progress display.
|
23
|
+
*/
|
24
|
+
currentStep: number;
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Enables or disables the ability to click on a step to navigate to it.
|
28
|
+
* Default is `false`.
|
29
|
+
*/
|
30
|
+
presseable?: boolean;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Callback function that gets triggered when a step is clicked.
|
34
|
+
* Passes the index of the clicked step as an argument.
|
35
|
+
* Example: (stepIndex) => console.log(`Step ${stepIndex} clicked!`)
|
36
|
+
*/
|
37
|
+
onPress?: (stepIndex: number) => void;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Determines the shape of the step indicator.
|
41
|
+
* Options:
|
42
|
+
* - `'circular'` (default)
|
43
|
+
* - `'square'`
|
44
|
+
*/
|
45
|
+
stepStyle?: "circular" | "square";
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Total number of steps in the stepper.
|
49
|
+
* Must be greater than or equal to 1.
|
50
|
+
*/
|
51
|
+
totalSteps: number;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Type of content displayed inside the step indicator.
|
55
|
+
* Options:
|
56
|
+
* - `'number'` (default): Displays the step index (e.g., 1, 2, 3).
|
57
|
+
* - `'icon'`: Displays a custom icon (requires the `icon` prop).
|
58
|
+
* - `'empty'`: Displays no content inside the step indicator.
|
59
|
+
*/
|
60
|
+
stepType?: "number" | "icon" | "empty";
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Custom icon(s) to display inside step indicators when `stepType` is set to `'icon'`.
|
64
|
+
* Accepts:
|
65
|
+
* - A single icon for all steps (ReactNode or string URI).
|
66
|
+
* - An array of icons (ReactNode[] or string[]), one for each step.
|
67
|
+
* Example: ['https://example.com/icon1.png', 'https://example.com/icon2.png']
|
68
|
+
*/
|
69
|
+
icon?: React.ReactNode | React.ReactNode[];
|
70
|
+
}
|
71
|
+
|
72
|
+
const Stepper: React.FC<StepperProps> = ({
|
73
|
+
steps,
|
74
|
+
currentStep,
|
75
|
+
presseable = false,
|
76
|
+
onPress,
|
77
|
+
stepStyle = "circular",
|
78
|
+
totalSteps,
|
79
|
+
stepType = "number",
|
80
|
+
icon,
|
81
|
+
}) => {
|
82
|
+
const progressAnim = React.useRef(new Animated.Value(0)).current;
|
83
|
+
const { theme } = useContext(ThemeContext);
|
84
|
+
const { colors } = theme;
|
85
|
+
const { formValues, handleFormSubmit } = useFormContext();
|
86
|
+
const [errorBack, seterrorBack] = useState(false);
|
87
|
+
|
88
|
+
const handleStepPress = async (stepIndex: number) => {
|
89
|
+
if (!presseable || stepIndex === currentStep) return;
|
90
|
+
|
91
|
+
const targetStep = stepIndex > currentStep ? currentStep + 1 : currentStep - 1;
|
92
|
+
|
93
|
+
// Validation is required only when moving forward
|
94
|
+
if (targetStep > currentStep) {
|
95
|
+
const errors = await handleFormSubmit(formValues);
|
96
|
+
if (Object.keys(errors).length > 0) {
|
97
|
+
console.log(`Validation failed at step ${currentStep}. Cannot proceed to step ${targetStep}.`);
|
98
|
+
seterrorBack(true);
|
99
|
+
return; // Stop if current step has errors
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
// Update step
|
104
|
+
seterrorBack(false);
|
105
|
+
onPress?.(targetStep);
|
106
|
+
};
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
React.useEffect(() => {
|
111
|
+
Animated.timing(progressAnim, {
|
112
|
+
toValue: currentStep,
|
113
|
+
duration: 500,
|
114
|
+
useNativeDriver: false,
|
115
|
+
}).start();
|
116
|
+
}, [currentStep]);
|
117
|
+
|
118
|
+
React.useEffect(() => {
|
119
|
+
if (stepType === "icon") {
|
120
|
+
if (!icon) {
|
121
|
+
console.error("Stepper: `icon` is required when stepType is 'icon'.");
|
122
|
+
} else if (Array.isArray(icon) && icon.length !== totalSteps) {
|
123
|
+
console.error(
|
124
|
+
`Stepper: Number of icons (${icon.length}) must match totalSteps (${totalSteps}).`
|
125
|
+
);
|
126
|
+
}
|
127
|
+
}
|
128
|
+
}, [stepType, icon, totalSteps]);
|
129
|
+
|
130
|
+
const getSeparatorWidth = (index: number): `${number}%` => {
|
131
|
+
if (currentStep > index && currentStep < index + 1) {
|
132
|
+
// Return the fractional percentage for odd steps
|
133
|
+
return `${((currentStep - index) * 100).toFixed(0)}%` as `${number}%`;
|
134
|
+
}
|
135
|
+
return currentStep > index ? "100%" : "0%";
|
136
|
+
};
|
137
|
+
|
138
|
+
const renderStepContent = (index: number) => {
|
139
|
+
switch (stepType) {
|
140
|
+
case "icon":
|
141
|
+
if (Array.isArray(icon)) {
|
142
|
+
const stepIcon = icon[index];
|
143
|
+
if (typeof stepIcon === "string") {
|
144
|
+
return (
|
145
|
+
<Image
|
146
|
+
source={{ uri: stepIcon }}
|
147
|
+
style={{ width: 24, height: 24 }}
|
148
|
+
resizeMode="contain"
|
149
|
+
/>
|
150
|
+
);
|
151
|
+
} else {
|
152
|
+
console.error(
|
153
|
+
`Invalid icon value for step ${index}. Expected a string URI.`
|
154
|
+
);
|
155
|
+
return null;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
if (typeof icon === "string") {
|
159
|
+
return (
|
160
|
+
<Image
|
161
|
+
source={{ uri: icon }}
|
162
|
+
style={{ width: 24, height: 24 }}
|
163
|
+
resizeMode="contain"
|
164
|
+
/>
|
165
|
+
);
|
166
|
+
}
|
167
|
+
console.error("Icon prop must be a string or an array of strings.");
|
168
|
+
return null;
|
169
|
+
|
170
|
+
case "empty":
|
171
|
+
return null;
|
172
|
+
|
173
|
+
case "number":
|
174
|
+
default:
|
175
|
+
return (
|
176
|
+
<Text
|
177
|
+
b
|
178
|
+
typeFont="primary"
|
179
|
+
style={[
|
180
|
+
currentStep >= index
|
181
|
+
? { color: colors.textButton.hex }
|
182
|
+
: { color: colors.text.hex },
|
183
|
+
]}
|
184
|
+
>
|
185
|
+
{index + 1}
|
186
|
+
</Text>
|
187
|
+
);
|
188
|
+
}
|
189
|
+
};
|
190
|
+
|
191
|
+
return (
|
192
|
+
<View style={styles.container}>
|
193
|
+
{Array.from({ length: totalSteps }, (_, index) => (
|
194
|
+
<React.Fragment key={index}>
|
195
|
+
<TouchableOpacity
|
196
|
+
style={[styles.stepContainer, presseable && { cursor: "pointer" }]}
|
197
|
+
disabled={!presseable}
|
198
|
+
onPress={() => handleStepPress(index)}
|
199
|
+
>
|
200
|
+
<View
|
201
|
+
style={[
|
202
|
+
styles.step,
|
203
|
+
stepStyle === "square" && styles.squareStep,
|
204
|
+
{
|
205
|
+
backgroundColor:
|
206
|
+
currentStep >= index
|
207
|
+
? !errorBack
|
208
|
+
? colors.primary.hex
|
209
|
+
: colors.error.hex
|
210
|
+
: colors.body.hex,
|
211
|
+
},
|
212
|
+
]}
|
213
|
+
>
|
214
|
+
{renderStepContent(index)}
|
215
|
+
</View>
|
216
|
+
{steps && <Text style={styles.stepText}>{steps[index]}</Text>}
|
217
|
+
</TouchableOpacity>
|
218
|
+
{index < totalSteps - 1 && (
|
219
|
+
<View style={styles.separatorContainer}>
|
220
|
+
<View style={styles.separatorBackground} />
|
221
|
+
<Animated.View
|
222
|
+
style={[
|
223
|
+
styles.separatorProgress,
|
224
|
+
{
|
225
|
+
width: getSeparatorWidth(index),
|
226
|
+
backgroundColor: colors.primary.hex,
|
227
|
+
},
|
228
|
+
]}
|
229
|
+
/>
|
230
|
+
</View>
|
231
|
+
)}
|
232
|
+
</React.Fragment>
|
233
|
+
))}
|
234
|
+
</View>
|
235
|
+
);
|
236
|
+
};
|
237
|
+
|
238
|
+
const styles = StyleSheet.create({
|
239
|
+
container: {
|
240
|
+
flexDirection: "row",
|
241
|
+
alignItems: "center",
|
242
|
+
justifyContent: "space-between",
|
243
|
+
marginBottom: 16,
|
244
|
+
},
|
245
|
+
stepContainer: {
|
246
|
+
alignItems: "center",
|
247
|
+
flex: 1,
|
248
|
+
},
|
249
|
+
step: {
|
250
|
+
width: 30,
|
251
|
+
height: 30,
|
252
|
+
borderRadius: 15, // Default to circular
|
253
|
+
alignItems: "center",
|
254
|
+
justifyContent: "center",
|
255
|
+
marginBottom: 4,
|
256
|
+
},
|
257
|
+
squareStep: {
|
258
|
+
borderRadius: 5, // Square shape
|
259
|
+
},
|
260
|
+
stepLabel: {
|
261
|
+
color: "#ffffff",
|
262
|
+
fontWeight: "bold",
|
263
|
+
},
|
264
|
+
stepText: {
|
265
|
+
fontSize: 12,
|
266
|
+
textAlign: "center",
|
267
|
+
marginTop: 4,
|
268
|
+
},
|
269
|
+
separatorContainer: {
|
270
|
+
flex: 1,
|
271
|
+
height: 4,
|
272
|
+
marginHorizontal: 8,
|
273
|
+
position: "relative",
|
274
|
+
},
|
275
|
+
separatorBackground: {
|
276
|
+
position: "absolute",
|
277
|
+
width: "100%",
|
278
|
+
height: "100%",
|
279
|
+
backgroundColor: "#aaaaaa",
|
280
|
+
borderRadius: 2,
|
281
|
+
},
|
282
|
+
separatorProgress: {
|
283
|
+
position: "absolute",
|
284
|
+
height: "100%",
|
285
|
+
borderRadius: 2,
|
286
|
+
},
|
287
|
+
});
|
288
|
+
|
289
|
+
export default Stepper;
|
@@ -0,0 +1,91 @@
|
|
1
|
+
// src/forms/TextArea.tsx
|
2
|
+
|
3
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
4
|
+
import { TextInput, StyleSheet, View, TextInputProps } from 'react-native';
|
5
|
+
import { useFormContext } from './FormContext';
|
6
|
+
import { Text } from '../fonts/Text'; // Assuming the Text component is exported from fonts
|
7
|
+
import ErrorList from './ErrorList';
|
8
|
+
import { ThemeContext } from 'aport-themes';
|
9
|
+
|
10
|
+
interface TextAreaProps extends TextInputProps {
|
11
|
+
name: string;
|
12
|
+
/**
|
13
|
+
* Optional first value if you want to set values with fetch or dont have empty inputs.
|
14
|
+
*/
|
15
|
+
firstValue?: string; // Optional prop for the initial value
|
16
|
+
|
17
|
+
label: string;
|
18
|
+
errors?: string[]; // Optional prop to directly pass errors
|
19
|
+
}
|
20
|
+
|
21
|
+
const TextArea: React.FC<TextAreaProps> = ({ name, label, errors,firstValue, editable = true, style, ...rest }) => {
|
22
|
+
const { formValues, setFormValue, errors: formErrors } = useFormContext();
|
23
|
+
const { theme } = useContext(ThemeContext);
|
24
|
+
const { colors } = theme;
|
25
|
+
|
26
|
+
const [internalValue, setInternalValue] = useState<string>("");
|
27
|
+
|
28
|
+
const isFirstRender = useRef(true); // Track the first render
|
29
|
+
|
30
|
+
// Initialize the internal value when `firstValue` changes or on first render
|
31
|
+
useEffect(() => {
|
32
|
+
if (isFirstRender.current) {
|
33
|
+
isFirstRender.current = false;
|
34
|
+
if (firstValue !== undefined) {
|
35
|
+
setInternalValue(firstValue);
|
36
|
+
setFormValue(name, firstValue, firstValue); // Pass firstValue here
|
37
|
+
} else {
|
38
|
+
setInternalValue(formValues[name] || "");
|
39
|
+
}
|
40
|
+
}
|
41
|
+
},[firstValue]);
|
42
|
+
|
43
|
+
const handleChange = (text: string) => {
|
44
|
+
setInternalValue(text);
|
45
|
+
setFormValue(name, text);
|
46
|
+
};
|
47
|
+
|
48
|
+
return (
|
49
|
+
<View style={styles.container}>
|
50
|
+
<Text style={[styles.label, {color: colors.text.hex}]}>{label}</Text>
|
51
|
+
<TextInput
|
52
|
+
style={[
|
53
|
+
styles.textArea,
|
54
|
+
style,
|
55
|
+
{backgroundColor: colors.body.hex, color: colors.text.hex, borderColor: formErrors[name] ? colors.error.hex : "#CCC",}
|
56
|
+
]}
|
57
|
+
value={internalValue}
|
58
|
+
onChangeText={handleChange}
|
59
|
+
placeholder={label}
|
60
|
+
placeholderTextColor={colors.placeHolder.hex} // Can use a lighter version if needed
|
61
|
+
multiline
|
62
|
+
editable={editable}
|
63
|
+
numberOfLines={4}
|
64
|
+
textAlignVertical="top"
|
65
|
+
{...rest}
|
66
|
+
/>
|
67
|
+
{/* Display errors only if form has been submitted and there are errors */}
|
68
|
+
{formErrors[name] && formErrors[name].length > 0 && (
|
69
|
+
<ErrorList errors={formErrors[name]} />
|
70
|
+
)}
|
71
|
+
</View>
|
72
|
+
);
|
73
|
+
};
|
74
|
+
|
75
|
+
const styles = StyleSheet.create({
|
76
|
+
container: {
|
77
|
+
marginBottom: 16,
|
78
|
+
},
|
79
|
+
label: {
|
80
|
+
marginBottom: 4,
|
81
|
+
},
|
82
|
+
textArea: {
|
83
|
+
height: 100,
|
84
|
+
borderWidth: 1,
|
85
|
+
borderRadius: 4,
|
86
|
+
paddingHorizontal: 8,
|
87
|
+
paddingVertical: 8,
|
88
|
+
},
|
89
|
+
});
|
90
|
+
|
91
|
+
export default TextArea;
|
@@ -1,8 +1,10 @@
|
|
1
|
+
// src/forms/index.ts
|
2
|
+
|
1
3
|
export { Input } from './Input';
|
2
4
|
export { Form, useFormContext, setFormValueGlobal } from './FormContext';
|
3
5
|
export { default as TextArea } from './TextArea';
|
4
6
|
export { default as Label } from './Label';
|
5
7
|
export { default as ErrorList } from './ErrorList';
|
6
8
|
export { InputList } from './InputList';
|
7
|
-
export {
|
8
|
-
export {
|
9
|
+
export {default as InputCheck} from './InputCheck';
|
10
|
+
export {default as InputAttach} from './InputAttach';
|
package/src/index.ts
ADDED
package/dist/cards/Card.d.ts
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { StyleProp, ViewStyle, GestureResponderEvent } from 'react-native';
|
3
|
-
/**
|
4
|
-
* Interface for the props that the Card component accepts.
|
5
|
-
*/
|
6
|
-
interface CardProps {
|
7
|
-
/**
|
8
|
-
* Content to be rendered inside the Card.
|
9
|
-
*/
|
10
|
-
children: React.ReactNode;
|
11
|
-
/**
|
12
|
-
* Style to be applied to the Card container.
|
13
|
-
*/
|
14
|
-
style?: StyleProp<ViewStyle>;
|
15
|
-
/**
|
16
|
-
* Function to call when the Card is pressed.
|
17
|
-
*/
|
18
|
-
onPress?: (event: GestureResponderEvent) => void;
|
19
|
-
/**
|
20
|
-
* Whether the Card is pressable. Defaults to false.
|
21
|
-
*/
|
22
|
-
pressable?: boolean;
|
23
|
-
/**
|
24
|
-
* Border radius of the Card. Defaults to 12.
|
25
|
-
*/
|
26
|
-
borderRadius?: number;
|
27
|
-
/**
|
28
|
-
* Elevation of the Card (Android only).
|
29
|
-
*/
|
30
|
-
elevation?: number;
|
31
|
-
/**
|
32
|
-
* Shadow properties for iOS.
|
33
|
-
*/
|
34
|
-
shadowProps?: {
|
35
|
-
shadowColor?: string;
|
36
|
-
shadowOffset?: {
|
37
|
-
width: number;
|
38
|
-
height: number;
|
39
|
-
};
|
40
|
-
shadowOpacity?: number;
|
41
|
-
shadowRadius?: number;
|
42
|
-
};
|
43
|
-
}
|
44
|
-
/**
|
45
|
-
* Card component that adapts its styles based on the current theme.
|
46
|
-
* Supports dynamic styling, shadows, and press animations.
|
47
|
-
*
|
48
|
-
* @param children - The content to be displayed inside the Card.
|
49
|
-
* @param style - Additional styles to apply to the Card.
|
50
|
-
* @param onPress - Function to execute when the Card is pressed.
|
51
|
-
* @param pressable - Determines if the Card is pressable. Defaults to false.
|
52
|
-
* @param borderRadius - Border radius of the Card. Defaults to 12.
|
53
|
-
* @param elevation - Elevation for Android shadow. Overrides default.
|
54
|
-
* @param shadowProps - Custom shadow properties for iOS. Overrides defaults.
|
55
|
-
*/
|
56
|
-
export declare const Card: React.FC<CardProps>;
|
57
|
-
export {};
|
package/dist/cards/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { Card } from './Card';
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
/**
|
3
|
-
* Interface for the props that the Button component accepts.
|
4
|
-
*/
|
5
|
-
interface ButtonProps {
|
6
|
-
/**
|
7
|
-
* If true, the button is disabled and not pressable.
|
8
|
-
*/
|
9
|
-
disabled?: boolean;
|
10
|
-
/**
|
11
|
-
* If true, the button expands to full width of its container.
|
12
|
-
*/
|
13
|
-
isFullWidth?: boolean;
|
14
|
-
/**
|
15
|
-
* Text content of the button.
|
16
|
-
*/
|
17
|
-
children?: string;
|
18
|
-
/**
|
19
|
-
* Function to call when the button is pressed.
|
20
|
-
*/
|
21
|
-
onPress?: () => void;
|
22
|
-
/**
|
23
|
-
* If true, the button has rounded corners.
|
24
|
-
*/
|
25
|
-
rounded?: boolean;
|
26
|
-
/**
|
27
|
-
* Custom border radius value. Overrides the `rounded` prop if provided.
|
28
|
-
*/
|
29
|
-
borderRadius?: number;
|
30
|
-
/**
|
31
|
-
* Specifies the button type for styling. Can be 'submit', 'button', or 'cancel'.
|
32
|
-
*/
|
33
|
-
type?: 'submit' | 'button' | 'cancel';
|
34
|
-
/**
|
35
|
-
* If true, a loading spinner is shown and the button is disabled.
|
36
|
-
*/
|
37
|
-
loading?: boolean;
|
38
|
-
}
|
39
|
-
/**
|
40
|
-
* Button component that adapts its styles based on the current theme.
|
41
|
-
* Supports dynamic styling, full-width option, rounded corners, and different types.
|
42
|
-
*
|
43
|
-
* @param disabled - If true, the button is disabled and not pressable.
|
44
|
-
* @param isFullWidth - If true, the button expands to full width of its container.
|
45
|
-
* @param children - Text content of the button.
|
46
|
-
* @param onPress - Function to call when the button is pressed.
|
47
|
-
* @param rounded - If true, the button has rounded corners.
|
48
|
-
* @param borderRadius - Custom border radius value. Overrides the `rounded` prop if provided.
|
49
|
-
* @param type - Specifies the button type for styling ('submit', 'button', 'cancel').
|
50
|
-
*/
|
51
|
-
export declare const Button: React.FC<ButtonProps>;
|
52
|
-
export {};
|
package/dist/fonts/Text.d.ts
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
import { ThemeColors, ThemeFonts } from 'aport-themes';
|
2
|
-
import React from 'react';
|
3
|
-
import { TextProps, TextStyle } from 'react-native';
|
4
|
-
interface CustomTextProps extends TextProps {
|
5
|
-
/**
|
6
|
-
* Content to be displayed inside the Text component.
|
7
|
-
*/
|
8
|
-
children: React.ReactNode;
|
9
|
-
/**
|
10
|
-
* Size of the text. Defaults to 14.
|
11
|
-
*/
|
12
|
-
size?: number;
|
13
|
-
/**
|
14
|
-
* If true, applies bold styling to the text.
|
15
|
-
*/
|
16
|
-
b?: boolean;
|
17
|
-
/**
|
18
|
-
* If true, applies italic styling to the text.
|
19
|
-
*/
|
20
|
-
i?: boolean;
|
21
|
-
/**
|
22
|
-
* If true, applies underline styling to the text.
|
23
|
-
*/
|
24
|
-
u?: boolean;
|
25
|
-
/**
|
26
|
-
* Paragraph alignment. Can be 'left', 'center', or 'right'. Defaults to 'left'.
|
27
|
-
*/
|
28
|
-
align?: 'left' | 'center' | 'right' | 'justify';
|
29
|
-
/**
|
30
|
-
* Text type. Defaults to 'text'. Should match the keys in ThemeColors.
|
31
|
-
* This restricts type to known color keys like 'primary', 'error', etc.
|
32
|
-
*/
|
33
|
-
type?: keyof ThemeColors;
|
34
|
-
/**
|
35
|
-
* Text font type. Defaults to 'body'. Should match the keys in ThemeFonts.
|
36
|
-
* This restricts type to known fonts keys like 'primary', 'secundary', etc.
|
37
|
-
*/
|
38
|
-
typeFont?: keyof ThemeFonts;
|
39
|
-
/**
|
40
|
-
* Header level. Accepts 0 (none), 1, 2, or 3. Defaults to 0.
|
41
|
-
*/
|
42
|
-
h?: 0 | 1 | 2 | 3;
|
43
|
-
/**
|
44
|
-
* Additional styles to apply to the Text component.
|
45
|
-
*/
|
46
|
-
style?: TextStyle | TextStyle[];
|
47
|
-
}
|
48
|
-
/**
|
49
|
-
* A dynamic Text component that supports HTML-like formatting.
|
50
|
-
* Integrates with the Theme system for consistent styling.
|
51
|
-
*
|
52
|
-
* @param children - The content to be displayed inside the Text component.
|
53
|
-
* @param size - Size of the text. Defaults to 'medium'.
|
54
|
-
* @param b - If true, applies bold styling.
|
55
|
-
* @param i - If true, applies italic styling.
|
56
|
-
* @param type - Type of Text component. Defaults to 'text'.
|
57
|
-
* @param typeFont - Type of Font component. Defaults to 'body'.
|
58
|
-
* @param u - If true, applies underline styling.
|
59
|
-
* @param align - Paragraph alignment. Defaults to 'left'.
|
60
|
-
* @param h - Header level. Accepts 0 (none), 1, 2, or 3. Defaults to 0.
|
61
|
-
* @param style - Additional styles to apply.
|
62
|
-
*/
|
63
|
-
export declare const Text: React.FC<CustomTextProps>;
|
64
|
-
export {};
|