sapo-components-ui-rn 1.0.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.
Files changed (215) hide show
  1. package/README.md +69 -0
  2. package/dist/assets/error.png +0 -0
  3. package/dist/assets/icon-checkbox-active.svg +4 -0
  4. package/dist/assets/icon-checkbox.svg +3 -0
  5. package/dist/assets/image_default.png +0 -0
  6. package/dist/assets/images/error.png +0 -0
  7. package/dist/assets/images/image_default.png +0 -0
  8. package/dist/assets/images/info.png +0 -0
  9. package/dist/assets/images/success.png +0 -0
  10. package/dist/assets/images/warning.png +0 -0
  11. package/dist/assets/info.png +0 -0
  12. package/dist/assets/success.png +0 -0
  13. package/dist/assets/svg/icon-checkbox-active.svg +4 -0
  14. package/dist/assets/svg/icon-checkbox.svg +3 -0
  15. package/dist/assets/warning.png +0 -0
  16. package/dist/components/ActivityIndicator.d.ts +28 -0
  17. package/dist/components/Avatar/index.d.ts +17 -0
  18. package/dist/components/Badge/index.d.ts +13 -0
  19. package/dist/components/Button/index.d.ts +23 -0
  20. package/dist/components/ButtonIcon/index.d.ts +18 -0
  21. package/dist/components/Checkbox/index.d.ts +14 -0
  22. package/dist/components/ChipBar/index.d.ts +16 -0
  23. package/dist/components/CountingDot/index.d.ts +13 -0
  24. package/dist/components/FloatingButton/index.d.ts +17 -0
  25. package/dist/components/Icon/index.d.ts +17 -0
  26. package/dist/components/IconSvg/index.d.ts +12 -0
  27. package/dist/components/Image/index.d.ts +14 -0
  28. package/dist/components/ProgressBar.d.ts +42 -0
  29. package/dist/components/RadioButton/index.d.ts +13 -0
  30. package/dist/components/ScaleButton/index.d.ts +4 -0
  31. package/dist/components/SelectionField/index.d.ts +24 -0
  32. package/dist/components/Spacer/index.d.ts +9 -0
  33. package/dist/components/Switch/Switch.d.ts +47 -0
  34. package/dist/components/Switch/utils.d.ts +14 -0
  35. package/dist/components/Text/index.d.ts +14 -0
  36. package/dist/components/TextInput/Addons/Outline.d.ts +15 -0
  37. package/dist/components/TextInput/Addons/Underline.d.ts +19 -0
  38. package/dist/components/TextInput/Adornment/TextInputAdornment.d.ts +43 -0
  39. package/dist/components/TextInput/Adornment/TextInputAffix.d.ts +72 -0
  40. package/dist/components/TextInput/Adornment/enums.d.ts +12 -0
  41. package/dist/components/TextInput/Adornment/types.d.ts +11 -0
  42. package/dist/components/TextInput/Adornment/utils.d.ts +11 -0
  43. package/dist/components/TextInput/Label/InputLabel.d.ts +4 -0
  44. package/dist/components/TextInput/Label/LabelBackground.d.ts +4 -0
  45. package/dist/components/TextInput/TextInput.d.ts +171 -0
  46. package/dist/components/TextInput/TextInputDefault.d.ts +4 -0
  47. package/dist/components/TextInput/TextInputFlat.d.ts +4 -0
  48. package/dist/components/TextInput/constants.d.ts +31 -0
  49. package/dist/components/TextInput/helpers.d.ts +95 -0
  50. package/dist/components/TextInput/types.d.ts +154 -0
  51. package/dist/components/Toast/ToastProvider.d.ts +21 -0
  52. package/dist/components/Toast/index.d.ts +3 -0
  53. package/dist/components/Typography/AnimatedText.d.ts +34 -0
  54. package/dist/components/Typography/StyledText.d.ts +12 -0
  55. package/dist/components/Typography/Text.d.ts +35 -0
  56. package/dist/components/Typography/types.d.ts +2 -0
  57. package/dist/components/View/index.d.ts +38 -0
  58. package/dist/components/ViewVisibleAnimated/index.d.ts +25 -0
  59. package/dist/constants.d.ts +1 -0
  60. package/dist/core/theming.d.ts +43 -0
  61. package/dist/icons/IconArrowDown.d.ts +4 -0
  62. package/dist/icons/IconCheckbox.d.ts +4 -0
  63. package/dist/icons/IconCheckboxActive.d.ts +4 -0
  64. package/dist/icons/IconClearText.d.ts +4 -0
  65. package/dist/icons/IconRadio.d.ts +4 -0
  66. package/dist/icons/IconRadioActive.d.ts +4 -0
  67. package/dist/icons/IconRadioDisable.d.ts +4 -0
  68. package/dist/index.d.ts +33 -0
  69. package/dist/index.esm.js +6758 -0
  70. package/dist/index.esm.js.map +1 -0
  71. package/dist/index.js +6823 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/styles/fonts.d.ts +78 -0
  74. package/dist/styles/overlay.d.ts +3 -0
  75. package/dist/styles/shadow.d.ts +18 -0
  76. package/dist/styles/themes/DarkTheme.d.ts +2 -0
  77. package/dist/styles/themes/LightTheme.d.ts +2 -0
  78. package/dist/styles/themes/index.d.ts +2 -0
  79. package/dist/styles/themes/tokens.d.ts +830 -0
  80. package/dist/theme/blue.d.ts +14 -0
  81. package/dist/theme/colors.d.ts +99 -0
  82. package/dist/theme/container-styles.d.ts +124 -0
  83. package/dist/theme/dimensions.d.ts +36 -0
  84. package/dist/theme/green.d.ts +15 -0
  85. package/dist/theme/icon.d.ts +5 -0
  86. package/dist/theme/ink.d.ts +11 -0
  87. package/dist/theme/orange.d.ts +14 -0
  88. package/dist/theme/purple.d.ts +6 -0
  89. package/dist/theme/red.d.ts +15 -0
  90. package/dist/theme/themes.d.ts +277 -0
  91. package/dist/theme/white.d.ts +10 -0
  92. package/dist/theme/yellow.d.ts +15 -0
  93. package/dist/types/index.d.ts +65 -0
  94. package/dist/types.d.ts +220 -0
  95. package/dist/utils/BackHandler/BackHandler.d.ts +9 -0
  96. package/dist/utils/BackHandler/BackHandler.native.d.ts +2 -0
  97. package/dist/utils/addEventListener.d.ts +12 -0
  98. package/dist/utils/forwardRef.d.ts +11 -0
  99. package/dist/utils/function-utils.d.ts +12 -0
  100. package/dist/utils/getContrastingColor.d.ts +2 -0
  101. package/dist/utils/hasTouchHandler.d.ts +5 -0
  102. package/dist/utils/roundLayoutSize.d.ts +1 -0
  103. package/dist/utils/splitStyles.d.ts +19 -0
  104. package/dist/utils/toast-manager.d.ts +21 -0
  105. package/dist/utils/useAnimatedValue.d.ts +2 -0
  106. package/dist/utils/useAnimatedValueArray.d.ts +2 -0
  107. package/dist/utils/useIsKeyboardShown.d.ts +6 -0
  108. package/dist/utils/useLayout.d.ts +6 -0
  109. package/dist/utils/useLazyRef.d.ts +2 -0
  110. package/package.json +104 -0
  111. package/src/.DS_Store +0 -0
  112. package/src/assets/images/error.png +0 -0
  113. package/src/assets/images/image_default.png +0 -0
  114. package/src/assets/images/info.png +0 -0
  115. package/src/assets/images/success.png +0 -0
  116. package/src/assets/images/warning.png +0 -0
  117. package/src/assets/svg/icon-checkbox-active.svg +4 -0
  118. package/src/assets/svg/icon-checkbox.svg +3 -0
  119. package/src/babel/.eslintrc +7 -0
  120. package/src/babel/index.js +63 -0
  121. package/src/components/.DS_Store +0 -0
  122. package/src/components/ActivityIndicator.tsx +238 -0
  123. package/src/components/Avatar/index.tsx +102 -0
  124. package/src/components/Badge/index.tsx +55 -0
  125. package/src/components/Button/index.tsx +162 -0
  126. package/src/components/ButtonIcon/index.tsx +98 -0
  127. package/src/components/Checkbox/index.tsx +107 -0
  128. package/src/components/ChipBar/index.tsx +112 -0
  129. package/src/components/CountingDot/index.tsx +63 -0
  130. package/src/components/FloatingButton/index.tsx +99 -0
  131. package/src/components/Icon/index.tsx +135 -0
  132. package/src/components/IconSvg/index.tsx +42 -0
  133. package/src/components/Image/index.tsx +127 -0
  134. package/src/components/ProgressBar.tsx +272 -0
  135. package/src/components/RadioButton/index.tsx +105 -0
  136. package/src/components/ScaleButton/index.tsx +17 -0
  137. package/src/components/SelectionField/index.tsx +166 -0
  138. package/src/components/Spacer/index.tsx +19 -0
  139. package/src/components/Switch/Switch.tsx +110 -0
  140. package/src/components/Switch/utils.ts +96 -0
  141. package/src/components/Text/index.tsx +69 -0
  142. package/src/components/TextInput/.DS_Store +0 -0
  143. package/src/components/TextInput/Addons/Outline.tsx +62 -0
  144. package/src/components/TextInput/Addons/Underline.tsx +71 -0
  145. package/src/components/TextInput/Adornment/TextInputAdornment.tsx +191 -0
  146. package/src/components/TextInput/Adornment/TextInputAffix.tsx +212 -0
  147. package/src/components/TextInput/Adornment/enums.tsx +12 -0
  148. package/src/components/TextInput/Adornment/types.tsx +11 -0
  149. package/src/components/TextInput/Adornment/utils.ts +39 -0
  150. package/src/components/TextInput/Label/InputLabel.tsx +216 -0
  151. package/src/components/TextInput/Label/LabelBackground.tsx +100 -0
  152. package/src/components/TextInput/TextInput.tsx +564 -0
  153. package/src/components/TextInput/TextInputDefault.tsx +187 -0
  154. package/src/components/TextInput/TextInputFlat.tsx +452 -0
  155. package/src/components/TextInput/constants.tsx +48 -0
  156. package/src/components/TextInput/helpers.tsx +546 -0
  157. package/src/components/TextInput/types.tsx +155 -0
  158. package/src/components/Toast/ToastProvider.tsx +69 -0
  159. package/src/components/Toast/index.tsx +239 -0
  160. package/src/components/Typography/AnimatedText.tsx +84 -0
  161. package/src/components/Typography/StyledText.tsx +53 -0
  162. package/src/components/Typography/Text.tsx +189 -0
  163. package/src/components/Typography/types.tsx +5 -0
  164. package/src/components/View/index.tsx +175 -0
  165. package/src/components/ViewVisibleAnimated/index.tsx +199 -0
  166. package/src/constants.tsx +16 -0
  167. package/src/core/theming.tsx +144 -0
  168. package/src/icons/IconArrowDown.tsx +14 -0
  169. package/src/icons/IconCheckbox.tsx +20 -0
  170. package/src/icons/IconCheckboxActive.tsx +18 -0
  171. package/src/icons/IconClearText.tsx +14 -0
  172. package/src/icons/IconRadio.tsx +11 -0
  173. package/src/icons/IconRadioActive.tsx +12 -0
  174. package/src/icons/IconRadioDisable.tsx +12 -0
  175. package/src/index.ts +51 -0
  176. package/src/index.tsx +50 -0
  177. package/src/styles/fonts.tsx +89 -0
  178. package/src/styles/overlay.tsx +69 -0
  179. package/src/styles/shadow.tsx +47 -0
  180. package/src/styles/themes/DarkTheme.tsx +157 -0
  181. package/src/styles/themes/LightTheme.tsx +160 -0
  182. package/src/styles/themes/index.ts +3 -0
  183. package/src/styles/themes/tokens.tsx +481 -0
  184. package/src/theme/blue.ts +25 -0
  185. package/src/theme/colors.ts +21 -0
  186. package/src/theme/container-styles.tsx +126 -0
  187. package/src/theme/dimensions.ts +44 -0
  188. package/src/theme/green.ts +27 -0
  189. package/src/theme/icon.ts +7 -0
  190. package/src/theme/ink.ts +18 -0
  191. package/src/theme/orange.ts +24 -0
  192. package/src/theme/purple.ts +8 -0
  193. package/src/theme/red.ts +26 -0
  194. package/src/theme/themes.tsx +287 -0
  195. package/src/theme/white.ts +16 -0
  196. package/src/theme/yellow.ts +26 -0
  197. package/src/types/index.ts +71 -0
  198. package/src/types/svg.d.ts +5 -0
  199. package/src/types.ts +259 -0
  200. package/src/types.tsx +284 -0
  201. package/src/utils/BackHandler/BackHandler.native.tsx +3 -0
  202. package/src/utils/BackHandler/BackHandler.tsx +11 -0
  203. package/src/utils/addEventListener.tsx +56 -0
  204. package/src/utils/forwardRef.tsx +23 -0
  205. package/src/utils/function-utils.tsx +108 -0
  206. package/src/utils/getContrastingColor.tsx +15 -0
  207. package/src/utils/hasTouchHandler.tsx +23 -0
  208. package/src/utils/roundLayoutSize.ts +2 -0
  209. package/src/utils/splitStyles.ts +60 -0
  210. package/src/utils/toast-manager.tsx +46 -0
  211. package/src/utils/useAnimatedValue.tsx +9 -0
  212. package/src/utils/useAnimatedValueArray.tsx +13 -0
  213. package/src/utils/useIsKeyboardShown.tsx +55 -0
  214. package/src/utils/useLayout.tsx +29 -0
  215. package/src/utils/useLazyRef.tsx +11 -0
@@ -0,0 +1,72 @@
1
+ import React from "react";
2
+ import { Animated, DimensionValue, GestureResponderEvent, LayoutChangeEvent, StyleProp, TextStyle } from "react-native";
3
+ import { AdornmentSide } from "./enums";
4
+ import type { ThemeProp } from "../../../types";
5
+ export type Props = {
6
+ /**
7
+ * Text to show.
8
+ */
9
+ text: string;
10
+ onLayout?: (event: LayoutChangeEvent) => void;
11
+ /**
12
+ * Function to execute on press.
13
+ */
14
+ onPress?: (e: GestureResponderEvent) => void;
15
+ /**
16
+ * Accessibility label for the affix. This is read by the screen reader when the user taps the affix.
17
+ */
18
+ accessibilityLabel?: string;
19
+ /**
20
+ * Style that is passed to the Text element.
21
+ */
22
+ textStyle?: StyleProp<TextStyle>;
23
+ /**
24
+ * @optional
25
+ */
26
+ theme?: ThemeProp;
27
+ };
28
+ type ContextState = {
29
+ topPosition: number | null;
30
+ onLayout?: (event: LayoutChangeEvent) => void;
31
+ visible?: Animated.Value;
32
+ textStyle?: StyleProp<TextStyle>;
33
+ side: AdornmentSide;
34
+ paddingHorizontal?: DimensionValue;
35
+ maxFontSizeMultiplier?: number | undefined | null;
36
+ testID?: string;
37
+ disabled?: boolean;
38
+ };
39
+ declare const AffixAdornment: React.FunctionComponent<{
40
+ affix: React.ReactNode;
41
+ testID: string;
42
+ } & ContextState>;
43
+ /**
44
+ * A component to render a leading / trailing text in the TextInput
45
+ *
46
+ * ## Usage
47
+ * ```js
48
+ * import * as React from 'react';
49
+ * import { TextInput } from 'react-native-paper';
50
+ *
51
+ * const MyComponent = () => {
52
+ * const [text, setText] = React.useState('');
53
+ *
54
+ * return (
55
+ * <TextInput
56
+ * mode="outlined"
57
+ * label="Outlined input"
58
+ * placeholder="Type something"
59
+ * right={<TextInput.Affix text="/100" />}
60
+ * />
61
+ * );
62
+ * };
63
+ *
64
+ * export default MyComponent;
65
+ * ```
66
+ */
67
+ declare const TextInputAffix: {
68
+ ({ text, textStyle: labelStyle, theme: themeOverrides, onLayout: onTextLayout, onPress, accessibilityLabel, }: Props): React.JSX.Element;
69
+ displayName: string;
70
+ };
71
+ export default TextInputAffix;
72
+ export { TextInputAffix, AffixAdornment };
@@ -0,0 +1,12 @@
1
+ export declare enum AdornmentType {
2
+ Icon = "icon",
3
+ Affix = "affix"
4
+ }
5
+ export declare enum AdornmentSide {
6
+ Right = "right",
7
+ Left = "left"
8
+ }
9
+ export declare enum InputMode {
10
+ Outlined = "outlined",
11
+ Flat = "flat"
12
+ }
@@ -0,0 +1,11 @@
1
+ import type { AdornmentSide, AdornmentType } from './enums';
2
+ export type AdornmentConfig = {
3
+ side: AdornmentSide;
4
+ type: AdornmentType;
5
+ };
6
+ export type AdornmentStyleAdjustmentForNativeInput = {
7
+ adornmentStyleAdjustmentForNativeInput: Array<{
8
+ paddingRight: number;
9
+ paddingLeft: number;
10
+ } | {}>;
11
+ };
@@ -0,0 +1,11 @@
1
+ import type { InternalTheme } from '../../../types';
2
+ type BaseProps = {
3
+ theme: InternalTheme;
4
+ disabled?: boolean;
5
+ };
6
+ export declare function getTextColor({ theme, disabled }: BaseProps): string;
7
+ export declare function getIconColor({ theme, isTextInputFocused, disabled, customColor, }: BaseProps & {
8
+ isTextInputFocused: boolean;
9
+ customColor?: ((isTextInputFocused: boolean) => string | undefined) | string;
10
+ }): string | undefined;
11
+ export {};
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { InputLabelProps } from "../types";
3
+ declare const _default: React.MemoExoticComponent<(props: InputLabelProps) => React.JSX.Element>;
4
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import type { LabelBackgroundProps } from '../types';
3
+ declare const LabelBackground: ({ labeled, labelLayoutWidth, labelLayoutHeight, placeholderStyle, baseLabelTranslateX, topPosition, backgroundColor, roundness, labelStyle, maxFontSizeMultiplier, testID, }: LabelBackgroundProps) => (React.JSX.Element | null)[];
4
+ export default LabelBackground;
@@ -0,0 +1,171 @@
1
+ import React from "react";
2
+ import { StyleProp, TextInput as NativeTextInput, TextStyle, ViewStyle } from "react-native";
3
+ import { Props as TextInputAffixProps } from "./Adornment/TextInputAffix";
4
+ import type { RenderProps, TextInputLabelProp } from "./types";
5
+ import type { ThemeProp } from "../../types";
6
+ export type Props = React.ComponentPropsWithRef<typeof NativeTextInput> & {
7
+ mode?: "flat" | "default";
8
+ left?: React.ReactNode;
9
+ right?: React.ReactNode;
10
+ /**
11
+ * If true, user won't be able to interact with the component.
12
+ */
13
+ disabled?: boolean;
14
+ /**
15
+ * The text or component to use for the floating label.
16
+ */
17
+ label?: TextInputLabelProp;
18
+ /**
19
+ * Placeholder for the input.
20
+ */
21
+ placeholder?: string;
22
+ /**
23
+ * Whether to style the TextInput with error style.
24
+ */
25
+ error?: boolean;
26
+ /**
27
+ * Callback that is called when the text input's text changes. Changed text is passed as an argument to the callback handler.
28
+ */
29
+ onChangeText?: Function;
30
+ /**
31
+ * Selection color of the input. On iOS, it sets both the selection color and cursor color.
32
+ * On Android, it sets only the selection color.
33
+ */
34
+ selectionColor?: string;
35
+ /**
36
+ * @platform Android only
37
+ * Cursor (or "caret") color of the input on Android.
38
+ * This property has no effect on iOS.
39
+ */
40
+ cursorColor?: string;
41
+ /**
42
+ * Inactive underline color of the input.
43
+ */
44
+ underlineColor?: string;
45
+ /**
46
+ * Active underline color of the input.
47
+ */
48
+ activeUnderlineColor?: string;
49
+ /**
50
+ * Inactive outline color of the input.
51
+ */
52
+ outlineColor?: string;
53
+ /**
54
+ * Active outline color of the input.
55
+ */
56
+ activeOutlineColor?: string;
57
+ /**
58
+ * Color of the text in the input.
59
+ */
60
+ textColor?: string;
61
+ placeholderTextColor?: string;
62
+ /**
63
+ * Sets min height with densed layout. For `TextInput` in `flat` mode
64
+ * height is `64dp` or in dense layout - `52dp` with label or `40dp` without label.
65
+ * For `TextInput` in `outlined` mode
66
+ * height is `56dp` or in dense layout - `40dp` regardless of label.
67
+ * When you apply `height` prop in style the `dense` prop affects only `paddingVertical` inside `TextInput`
68
+ */
69
+ dense?: boolean;
70
+ /**
71
+ * Whether the input can have multiple lines.
72
+ */
73
+ multiline?: boolean;
74
+ /**
75
+ * @platform Android only
76
+ * The number of lines to show in the input (Android only).
77
+ */
78
+ numberOfLines?: number;
79
+ /**
80
+ * Callback that is called when the text input is focused.
81
+ */
82
+ onFocus?: (args: any) => void;
83
+ /**
84
+ * Callback that is called when the text input is blurred.
85
+ */
86
+ onBlur?: (args: any) => void;
87
+ /**
88
+ *
89
+ * Callback to render a custom input component such as `react-native-text-input-mask`
90
+ * instead of the default `TextInput` component from `react-native`.
91
+ *
92
+ * Example:
93
+ * ```js
94
+ * <TextInput
95
+ * label="Phone number"
96
+ * render={props =>
97
+ * <TextInputMask
98
+ * {...props}
99
+ * mask="+[00] [000] [000] [000]"
100
+ * />
101
+ * }
102
+ * />
103
+ * ```
104
+ */
105
+ render?: (props: RenderProps) => React.ReactNode;
106
+ /**
107
+ * Value of the text input.
108
+ */
109
+ value?: string;
110
+ /**
111
+ * Pass `fontSize` prop to modify the font size inside `TextInput`.
112
+ * Pass `height` prop to set `TextInput` height. When `height` is passed,
113
+ * `dense` prop will affect only input's `paddingVertical`.
114
+ * Pass `paddingHorizontal` to modify horizontal padding.
115
+ * This can be used to get MD Guidelines v1 TextInput look.
116
+ */
117
+ style?: StyleProp<TextStyle>;
118
+ /**
119
+ * @optional
120
+ */
121
+ theme?: ThemeProp;
122
+ /**
123
+ * testID to be used on tests.
124
+ */
125
+ testID?: string;
126
+ /**
127
+ * Pass custom style directly to the input itself.
128
+ * Overrides input style
129
+ * Example: `paddingLeft`, `backgroundColor`
130
+ */
131
+ contentStyle?: StyleProp<TextStyle>;
132
+ /**
133
+ * Pass style to override the default style of outlined wrapper.
134
+ * Overrides style when mode is set to `outlined`
135
+ * Example: `borderRadius`, `borderColor`
136
+ */
137
+ underlineStyle?: StyleProp<ViewStyle>;
138
+ minHeight?: number;
139
+ clearButton?: boolean;
140
+ };
141
+ interface CompoundedComponent extends React.ForwardRefExoticComponent<Props & React.RefAttributes<TextInputHandles>> {
142
+ Affix: React.FunctionComponent<Partial<TextInputAffixProps>>;
143
+ }
144
+ type TextInputHandles = Pick<NativeTextInput, "focus" | "clear" | "blur" | "isFocused" | "setNativeProps">;
145
+ /**
146
+ * A component to allow users to input text.
147
+ *
148
+ * ## Usage
149
+ * ```js
150
+ * import * as React from 'react';
151
+ * import { TextInput } from 'react-native-paper';
152
+ *
153
+ * const MyComponent = () => {
154
+ * const [text, setText] = React.useState("");
155
+ *
156
+ * return (
157
+ * <TextInput
158
+ * label="Email"
159
+ * value={text}
160
+ * onChangeText={text => setText(text)}
161
+ * />
162
+ * );
163
+ * };
164
+ *
165
+ * export default MyComponent;
166
+ * ```
167
+ *
168
+ * @extends TextInput props https://reactnative.dev/docs/textinput#props
169
+ */
170
+ declare const TextInput: CompoundedComponent;
171
+ export default TextInput;
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import type { ChildTextInputProps } from "./types";
3
+ declare const TextInputDefault: ({ disabled, editable, label, error, selectionColor: customSelectionColor, cursorColor, outlineColor: customOutlineColor, activeOutlineColor, outlineStyle, textColor, dense, style, theme, render, multiline, parentState, innerRef, onFocus, forceFocus, onBlur, onChangeText, onLayout, left, right, placeholderTextColor, clearButton, contentStyle, value, ...rest }: ChildTextInputProps) => React.JSX.Element;
4
+ export default TextInputDefault;
@@ -0,0 +1,4 @@
1
+ import * as React from "react";
2
+ import type { ChildTextInputProps } from "./types";
3
+ declare const TextInputFlat: ({ disabled, editable, label, error, selectionColor: customSelectionColor, cursorColor, underlineColor, underlineStyle, activeUnderlineColor, textColor, dense, style, theme, render, multiline, parentState, innerRef, onFocus, forceFocus, onBlur, onChangeText, onLayoutAnimatedText, onLabelTextLayout, onLeftAffixLayoutChange, onRightAffixLayoutChange, onInputLayout, left, right, placeholderTextColor, clearButton, contentStyle, scaledLabel, outlineStyle, outlineColor, value, ...rest }: ChildTextInputProps) => React.JSX.Element;
4
+ export default TextInputFlat;
@@ -0,0 +1,31 @@
1
+ export declare const MAXIMIZED_LABEL_FONT_SIZE = 14;
2
+ export declare const MINIMIZED_LABEL_FONT_SIZE = 12;
3
+ export declare const LABEL_WIGGLE_X_OFFSET = 4;
4
+ export declare const ADORNMENT_SIZE = 24;
5
+ export declare const MIN_WIDTH = 100;
6
+ export declare const MD2_AFFIX_OFFSET = 12;
7
+ export declare const MD3_AFFIX_OFFSET = 16;
8
+ export declare const ICON_SIZE = 24;
9
+ export declare const MD2_ICON_OFFSET = 12;
10
+ export declare const MD3_ICON_OFFSET = 16;
11
+ export declare const MD2_MIN_HEIGHT = 64;
12
+ export declare const MD3_MIN_HEIGHT = 56;
13
+ export declare const MD3_ADORNMENT_OFFSET = 16;
14
+ export declare const MD2_ADORNMENT_OFFSET = 12;
15
+ export declare const LABEL_PADDING_TOP_DENSE = 24;
16
+ export declare const LABEL_PADDING_TOP = 8;
17
+ export declare const MD2_LABEL_PADDING_TOP = 30;
18
+ export declare const MD3_LABEL_PADDING_TOP = 26;
19
+ export declare const MD2_LABEL_PADDING_HORIZONTAL = 12;
20
+ export declare const MD3_LABEL_PADDING_HORIZONTAL = 16;
21
+ export declare const MD2_FLAT_INPUT_OFFSET = 8;
22
+ export declare const MD3_FLAT_INPUT_OFFSET = 16;
23
+ export declare const MINIMIZED_LABEL_Y_OFFSET = -18;
24
+ export declare const MIN_DENSE_HEIGHT_WL = 52;
25
+ export declare const MIN_DENSE_HEIGHT = 40;
26
+ export declare const MD2_INPUT_PADDING_HORIZONTAL = 14;
27
+ export declare const MD3_INPUT_PADDING_HORIZONTAL = 16;
28
+ export declare const MD2_OUTLINED_INPUT_OFFSET = 8;
29
+ export declare const MD3_OUTLINED_INPUT_OFFSET = 16;
30
+ export declare const OUTLINE_MINIMIZED_LABEL_Y_OFFSET = -6;
31
+ export declare const MIN_DENSE_HEIGHT_OUTLINED = 48;
@@ -0,0 +1,95 @@
1
+ import type { AdornmentConfig } from "./Adornment/types";
2
+ import type { TextInputLabelProp } from "./types";
3
+ import type { InternalTheme } from "../../types";
4
+ type PaddingProps = {
5
+ height: number | null;
6
+ labelHalfHeight: number;
7
+ multiline: boolean | null;
8
+ dense: boolean | null;
9
+ topPosition: number;
10
+ fontSize: number;
11
+ lineHeight?: number;
12
+ label?: TextInputLabelProp | null;
13
+ scale: number;
14
+ offset: number;
15
+ isAndroid: boolean;
16
+ styles: {
17
+ paddingTop: number;
18
+ paddingBottom: number;
19
+ };
20
+ };
21
+ type AdjProps = PaddingProps & {
22
+ pad: number;
23
+ };
24
+ export type Padding = {
25
+ paddingTop: number;
26
+ paddingBottom: number;
27
+ };
28
+ export declare const calculateLabelTopPosition: (labelHeight: number, height?: number, optionalPadding?: number) => number;
29
+ export declare const calculateInputHeight: (labelHeight: number, height: any | undefined, minHeight: number) => number;
30
+ export declare const calculatePadding: (props: PaddingProps) => number;
31
+ export declare const adjustPaddingOut: ({ pad, multiline, label, scale, height, fontSize, lineHeight, dense, offset, isAndroid, }: AdjProps) => Padding;
32
+ export declare const adjustPaddingFlat: ({ pad, scale, multiline, label, height, offset, dense, fontSize, isAndroid, styles, }: AdjProps) => Padding;
33
+ export declare function calculateFlatAffixTopPosition({ height, paddingTop, paddingBottom, affixHeight, }: {
34
+ height: number;
35
+ paddingTop: number;
36
+ paddingBottom: number;
37
+ affixHeight: number;
38
+ }): number;
39
+ export declare function calculateOutlinedIconAndAffixTopPosition({ height, affixHeight, labelYOffset, }: {
40
+ height: number;
41
+ affixHeight: number;
42
+ labelYOffset: number;
43
+ }): number;
44
+ export declare const calculateFlatInputHorizontalPadding: ({ adornmentConfig, }: {
45
+ adornmentConfig: AdornmentConfig[];
46
+ }) => {
47
+ paddingLeft: number;
48
+ paddingRight: number;
49
+ };
50
+ export declare const getFlatInputColors: ({ underlineColor, activeUnderlineColor, customSelectionColor, textColor, disabled, error, theme, }: {
51
+ underlineColor?: string;
52
+ activeUnderlineColor?: string;
53
+ customSelectionColor?: string;
54
+ textColor?: string;
55
+ disabled?: boolean;
56
+ error?: boolean;
57
+ theme: InternalTheme;
58
+ }) => {
59
+ inputTextColor: string;
60
+ activeColor: string;
61
+ underlineColorCustom: string;
62
+ placeholderColor: string;
63
+ selectionColor: string;
64
+ errorColor: string;
65
+ backgroundColor: string;
66
+ };
67
+ export declare const getOutlinedInputColors: ({ activeOutlineColor, customOutlineColor, customSelectionColor, textColor, disabled, error, theme, }: {
68
+ activeOutlineColor?: string;
69
+ customOutlineColor?: string;
70
+ customSelectionColor?: string;
71
+ textColor?: string;
72
+ disabled?: boolean;
73
+ error?: boolean;
74
+ theme: InternalTheme;
75
+ }) => {
76
+ inputTextColor: string;
77
+ activeColor: string;
78
+ outlineColor: string;
79
+ placeholderColor: string;
80
+ selectionColor: string;
81
+ errorColor: string;
82
+ };
83
+ export declare const getConstants: () => {
84
+ AFFIX_OFFSET: number;
85
+ ICON_OFFSET: number;
86
+ LABEL_PADDING_TOP: number;
87
+ LABEL_PADDING_HORIZONTAL: number;
88
+ FLAT_INPUT_OFFSET: number;
89
+ MIN_HEIGHT: number;
90
+ INPUT_PADDING_HORIZONTAL: number;
91
+ ADORNMENT_OFFSET: number;
92
+ OUTLINED_INPUT_OFFSET: number;
93
+ MIN_WIDTH: number;
94
+ };
95
+ export {};
@@ -0,0 +1,154 @@
1
+ import * as React from "react";
2
+ import type { TextInput as NativeTextInput, Animated, TextStyle, LayoutChangeEvent, ColorValue, StyleProp, ViewProps, ViewStyle, NativeSyntheticEvent, TextLayoutEventData } from "react-native";
3
+ import type { $Omit, InternalTheme, ThemeProp } from "./../../types";
4
+ export type TextInputLabelProp = string | React.ReactElement;
5
+ type TextInputProps = React.ComponentPropsWithRef<typeof NativeTextInput> & {
6
+ mode?: "flat" | "outlined";
7
+ left?: React.ReactNode;
8
+ right?: React.ReactNode;
9
+ disabled?: boolean;
10
+ label?: TextInputLabelProp;
11
+ placeholder?: string;
12
+ error?: boolean;
13
+ onChangeText?: Function;
14
+ selectionColor?: string;
15
+ cursorColor?: string;
16
+ underlineColor?: string;
17
+ activeUnderlineColor?: string;
18
+ outlineColor?: string;
19
+ activeOutlineColor?: string;
20
+ textColor?: string;
21
+ dense?: boolean;
22
+ multiline?: boolean;
23
+ numberOfLines?: number;
24
+ onFocus?: (args: any) => void;
25
+ onBlur?: (args: any) => void;
26
+ render?: (props: RenderProps) => React.ReactNode;
27
+ value?: string;
28
+ style?: StyleProp<TextStyle>;
29
+ theme?: ThemeProp;
30
+ testID?: string;
31
+ contentStyle?: StyleProp<TextStyle>;
32
+ outlineStyle?: StyleProp<ViewStyle>;
33
+ underlineStyle?: StyleProp<ViewStyle>;
34
+ scaledLabel?: boolean;
35
+ };
36
+ export type RenderProps = {
37
+ ref: (a?: NativeTextInput | null) => void;
38
+ onChangeText?: (a: string) => void;
39
+ placeholder?: string;
40
+ placeholderTextColor?: ColorValue;
41
+ editable?: boolean;
42
+ selectionColor?: string;
43
+ cursorColor?: string;
44
+ onFocus?: (args: any) => void;
45
+ onBlur?: (args: any) => void;
46
+ underlineColorAndroid?: string;
47
+ onLayout?: (args: any) => void;
48
+ style: any;
49
+ multiline?: boolean;
50
+ numberOfLines?: number;
51
+ value?: string;
52
+ adjustsFontSizeToFit?: boolean;
53
+ testID?: string;
54
+ };
55
+ type TextInputTypesWithoutMode = $Omit<TextInputProps, "mode">;
56
+ export type State = {
57
+ labeled: Animated.Value;
58
+ error: Animated.Value;
59
+ focused: boolean;
60
+ displayPlaceholder: boolean;
61
+ value?: string;
62
+ labelTextLayout: {
63
+ width: number;
64
+ };
65
+ labelLayout: {
66
+ measured: boolean;
67
+ width: number;
68
+ height: number;
69
+ };
70
+ leftLayout: {
71
+ height: number | null;
72
+ width: number | null;
73
+ };
74
+ rightLayout: {
75
+ height: number | null;
76
+ width: number | null;
77
+ };
78
+ inputContainerLayout: {
79
+ width: number;
80
+ };
81
+ contentStyle?: StyleProp<ViewProps>;
82
+ };
83
+ export type ChildTextInputProps = {
84
+ parentState: State;
85
+ innerRef: (ref?: NativeTextInput | null) => void;
86
+ onFocus?: (args: any) => void;
87
+ onBlur?: (args: any) => void;
88
+ forceFocus: () => void;
89
+ onChangeText?: (value: string) => void;
90
+ onInputLayout: (event: LayoutChangeEvent) => void;
91
+ onLayoutAnimatedText: (args: any) => void;
92
+ onLabelTextLayout: (event: NativeSyntheticEvent<TextLayoutEventData>) => void;
93
+ onLeftAffixLayoutChange: (event: LayoutChangeEvent) => void;
94
+ onRightAffixLayoutChange: (event: LayoutChangeEvent) => void;
95
+ clearButton?: boolean;
96
+ } & $Omit<TextInputTypesWithoutMode, "theme"> & {
97
+ theme: InternalTheme;
98
+ };
99
+ export type LabelProps = {
100
+ mode?: "flat" | "outlined";
101
+ placeholderStyle: any;
102
+ placeholderOpacity: number | Animated.Value | Animated.AnimatedInterpolation<number>;
103
+ baseLabelTranslateX: number;
104
+ baseLabelTranslateY: number;
105
+ wiggleOffsetX: number;
106
+ labelScale: number;
107
+ fontSize: number;
108
+ lineHeight?: number | undefined;
109
+ fontWeight: TextStyle["fontWeight"];
110
+ font: any;
111
+ topPosition: number;
112
+ paddingLeft?: number;
113
+ paddingRight?: number;
114
+ labelTranslationXOffset?: number;
115
+ placeholderColor: string | null;
116
+ backgroundColor?: ColorValue;
117
+ label?: TextInputLabelProp | null;
118
+ hasActiveOutline?: boolean | null;
119
+ activeColor: string;
120
+ errorColor?: string;
121
+ labelError?: boolean | null;
122
+ onLayoutAnimatedText: (args: any) => void;
123
+ onLabelTextLayout: (event: NativeSyntheticEvent<TextLayoutEventData>) => void;
124
+ roundness: number;
125
+ maxFontSizeMultiplier?: number | undefined | null;
126
+ testID?: string;
127
+ contentStyle?: StyleProp<ViewProps>;
128
+ theme?: ThemeProp;
129
+ };
130
+ export type InputLabelProps = {
131
+ labeled: Animated.Value;
132
+ error: Animated.Value;
133
+ focused: boolean;
134
+ wiggle: boolean;
135
+ opacity: number;
136
+ labelLayoutMeasured: boolean;
137
+ labelLayoutWidth: number;
138
+ labelLayoutHeight: number;
139
+ inputContainerLayout: {
140
+ width: number;
141
+ };
142
+ labelBackground?: any;
143
+ maxFontSizeMultiplier?: number | undefined | null;
144
+ scaledLabel?: boolean;
145
+ } & LabelProps;
146
+ export type LabelBackgroundProps = {
147
+ labelStyle: any;
148
+ labeled: Animated.Value;
149
+ labelLayoutWidth: number;
150
+ labelLayoutHeight: number;
151
+ maxFontSizeMultiplier?: number | undefined | null;
152
+ theme?: ThemeProp;
153
+ } & LabelProps;
154
+ export {};
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ interface ToastRef {
3
+ show: (params: {
4
+ message: string;
5
+ duration?: number;
6
+ position?: "top" | "bottom";
7
+ type?: "success" | "fail";
8
+ onPress?: () => void;
9
+ title?: string;
10
+ }) => void;
11
+ }
12
+ interface ToastProviderProps {
13
+ children: React.ReactNode;
14
+ /**
15
+ * Nếu ứng dụng đã có SafeAreaProvider, set wrapSafeArea = false
16
+ * @default true
17
+ */
18
+ wrapSafeArea?: boolean;
19
+ }
20
+ declare const ToastProvider: React.ForwardRefExoticComponent<ToastProviderProps & React.RefAttributes<ToastRef>>;
21
+ export default ToastProvider;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const Toast: React.NamedExoticComponent<React.RefAttributes<unknown>>;
3
+ export default Toast;
@@ -0,0 +1,34 @@
1
+ import * as React from "react";
2
+ import { Animated, StyleProp, TextStyle, Text } from "react-native";
3
+ import type { VariantProp } from "./types";
4
+ import type { ThemeProp } from "../../types";
5
+ type Props<T> = React.ComponentPropsWithRef<typeof Animated.Text> & {
6
+ /**
7
+ * Variant defines appropriate text styles for type role and its size.
8
+ * Available variants:
9
+ *
10
+ * Display: `displayLarge`, `displayMedium`, `displaySmall`
11
+ *
12
+ * Headline: `headlineLarge`, `headlineMedium`, `headlineSmall`
13
+ *
14
+ * Title: `titleLarge`, `titleMedium`, `titleSmall`
15
+ *
16
+ * Label: `labelLarge`, `labelMedium`, `labelSmall`
17
+ *
18
+ * Body: `bodyLarge`, `bodyMedium`, `bodySmall`
19
+ */
20
+ variant?: VariantProp<T>;
21
+ style?: StyleProp<TextStyle>;
22
+ /**
23
+ * @optional
24
+ */
25
+ theme?: ThemeProp;
26
+ };
27
+ /**
28
+ * Animated text component which follows styles from the theme.
29
+ *
30
+ * @extends Text props https://reactnative.dev/docs/text#props
31
+ */
32
+ declare const AnimatedText: import("../../utils/forwardRef").ForwardRefComponent<Text & HTMLElement, Props<never>>;
33
+ export declare const customAnimatedText: <T>() => (props: Props<T>) => JSX.Element;
34
+ export default AnimatedText;
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { StyleProp, TextStyle } from "react-native";
3
+ import Text from "./Text";
4
+ import type { ThemeProp } from "../../types";
5
+ type Props = React.ComponentProps<typeof Text> & {
6
+ alpha?: number;
7
+ family: "regular" | "medium" | "light" | "thin";
8
+ style?: StyleProp<TextStyle>;
9
+ theme?: ThemeProp;
10
+ };
11
+ declare const StyledText: ({ alpha, family, style, theme: themeOverrides, ...rest }: Props) => React.JSX.Element;
12
+ export default StyledText;