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.
- package/README.md +69 -0
- package/dist/assets/error.png +0 -0
- package/dist/assets/icon-checkbox-active.svg +4 -0
- package/dist/assets/icon-checkbox.svg +3 -0
- package/dist/assets/image_default.png +0 -0
- package/dist/assets/images/error.png +0 -0
- package/dist/assets/images/image_default.png +0 -0
- package/dist/assets/images/info.png +0 -0
- package/dist/assets/images/success.png +0 -0
- package/dist/assets/images/warning.png +0 -0
- package/dist/assets/info.png +0 -0
- package/dist/assets/success.png +0 -0
- package/dist/assets/svg/icon-checkbox-active.svg +4 -0
- package/dist/assets/svg/icon-checkbox.svg +3 -0
- package/dist/assets/warning.png +0 -0
- package/dist/components/ActivityIndicator.d.ts +28 -0
- package/dist/components/Avatar/index.d.ts +17 -0
- package/dist/components/Badge/index.d.ts +13 -0
- package/dist/components/Button/index.d.ts +23 -0
- package/dist/components/ButtonIcon/index.d.ts +18 -0
- package/dist/components/Checkbox/index.d.ts +14 -0
- package/dist/components/ChipBar/index.d.ts +16 -0
- package/dist/components/CountingDot/index.d.ts +13 -0
- package/dist/components/FloatingButton/index.d.ts +17 -0
- package/dist/components/Icon/index.d.ts +17 -0
- package/dist/components/IconSvg/index.d.ts +12 -0
- package/dist/components/Image/index.d.ts +14 -0
- package/dist/components/ProgressBar.d.ts +42 -0
- package/dist/components/RadioButton/index.d.ts +13 -0
- package/dist/components/ScaleButton/index.d.ts +4 -0
- package/dist/components/SelectionField/index.d.ts +24 -0
- package/dist/components/Spacer/index.d.ts +9 -0
- package/dist/components/Switch/Switch.d.ts +47 -0
- package/dist/components/Switch/utils.d.ts +14 -0
- package/dist/components/Text/index.d.ts +14 -0
- package/dist/components/TextInput/Addons/Outline.d.ts +15 -0
- package/dist/components/TextInput/Addons/Underline.d.ts +19 -0
- package/dist/components/TextInput/Adornment/TextInputAdornment.d.ts +43 -0
- package/dist/components/TextInput/Adornment/TextInputAffix.d.ts +72 -0
- package/dist/components/TextInput/Adornment/enums.d.ts +12 -0
- package/dist/components/TextInput/Adornment/types.d.ts +11 -0
- package/dist/components/TextInput/Adornment/utils.d.ts +11 -0
- package/dist/components/TextInput/Label/InputLabel.d.ts +4 -0
- package/dist/components/TextInput/Label/LabelBackground.d.ts +4 -0
- package/dist/components/TextInput/TextInput.d.ts +171 -0
- package/dist/components/TextInput/TextInputDefault.d.ts +4 -0
- package/dist/components/TextInput/TextInputFlat.d.ts +4 -0
- package/dist/components/TextInput/constants.d.ts +31 -0
- package/dist/components/TextInput/helpers.d.ts +95 -0
- package/dist/components/TextInput/types.d.ts +154 -0
- package/dist/components/Toast/ToastProvider.d.ts +21 -0
- package/dist/components/Toast/index.d.ts +3 -0
- package/dist/components/Typography/AnimatedText.d.ts +34 -0
- package/dist/components/Typography/StyledText.d.ts +12 -0
- package/dist/components/Typography/Text.d.ts +35 -0
- package/dist/components/Typography/types.d.ts +2 -0
- package/dist/components/View/index.d.ts +38 -0
- package/dist/components/ViewVisibleAnimated/index.d.ts +25 -0
- package/dist/constants.d.ts +1 -0
- package/dist/core/theming.d.ts +43 -0
- package/dist/icons/IconArrowDown.d.ts +4 -0
- package/dist/icons/IconCheckbox.d.ts +4 -0
- package/dist/icons/IconCheckboxActive.d.ts +4 -0
- package/dist/icons/IconClearText.d.ts +4 -0
- package/dist/icons/IconRadio.d.ts +4 -0
- package/dist/icons/IconRadioActive.d.ts +4 -0
- package/dist/icons/IconRadioDisable.d.ts +4 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.esm.js +6758 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +6823 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/fonts.d.ts +78 -0
- package/dist/styles/overlay.d.ts +3 -0
- package/dist/styles/shadow.d.ts +18 -0
- package/dist/styles/themes/DarkTheme.d.ts +2 -0
- package/dist/styles/themes/LightTheme.d.ts +2 -0
- package/dist/styles/themes/index.d.ts +2 -0
- package/dist/styles/themes/tokens.d.ts +830 -0
- package/dist/theme/blue.d.ts +14 -0
- package/dist/theme/colors.d.ts +99 -0
- package/dist/theme/container-styles.d.ts +124 -0
- package/dist/theme/dimensions.d.ts +36 -0
- package/dist/theme/green.d.ts +15 -0
- package/dist/theme/icon.d.ts +5 -0
- package/dist/theme/ink.d.ts +11 -0
- package/dist/theme/orange.d.ts +14 -0
- package/dist/theme/purple.d.ts +6 -0
- package/dist/theme/red.d.ts +15 -0
- package/dist/theme/themes.d.ts +277 -0
- package/dist/theme/white.d.ts +10 -0
- package/dist/theme/yellow.d.ts +15 -0
- package/dist/types/index.d.ts +65 -0
- package/dist/types.d.ts +220 -0
- package/dist/utils/BackHandler/BackHandler.d.ts +9 -0
- package/dist/utils/BackHandler/BackHandler.native.d.ts +2 -0
- package/dist/utils/addEventListener.d.ts +12 -0
- package/dist/utils/forwardRef.d.ts +11 -0
- package/dist/utils/function-utils.d.ts +12 -0
- package/dist/utils/getContrastingColor.d.ts +2 -0
- package/dist/utils/hasTouchHandler.d.ts +5 -0
- package/dist/utils/roundLayoutSize.d.ts +1 -0
- package/dist/utils/splitStyles.d.ts +19 -0
- package/dist/utils/toast-manager.d.ts +21 -0
- package/dist/utils/useAnimatedValue.d.ts +2 -0
- package/dist/utils/useAnimatedValueArray.d.ts +2 -0
- package/dist/utils/useIsKeyboardShown.d.ts +6 -0
- package/dist/utils/useLayout.d.ts +6 -0
- package/dist/utils/useLazyRef.d.ts +2 -0
- package/package.json +104 -0
- package/src/.DS_Store +0 -0
- package/src/assets/images/error.png +0 -0
- package/src/assets/images/image_default.png +0 -0
- package/src/assets/images/info.png +0 -0
- package/src/assets/images/success.png +0 -0
- package/src/assets/images/warning.png +0 -0
- package/src/assets/svg/icon-checkbox-active.svg +4 -0
- package/src/assets/svg/icon-checkbox.svg +3 -0
- package/src/babel/.eslintrc +7 -0
- package/src/babel/index.js +63 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/ActivityIndicator.tsx +238 -0
- package/src/components/Avatar/index.tsx +102 -0
- package/src/components/Badge/index.tsx +55 -0
- package/src/components/Button/index.tsx +162 -0
- package/src/components/ButtonIcon/index.tsx +98 -0
- package/src/components/Checkbox/index.tsx +107 -0
- package/src/components/ChipBar/index.tsx +112 -0
- package/src/components/CountingDot/index.tsx +63 -0
- package/src/components/FloatingButton/index.tsx +99 -0
- package/src/components/Icon/index.tsx +135 -0
- package/src/components/IconSvg/index.tsx +42 -0
- package/src/components/Image/index.tsx +127 -0
- package/src/components/ProgressBar.tsx +272 -0
- package/src/components/RadioButton/index.tsx +105 -0
- package/src/components/ScaleButton/index.tsx +17 -0
- package/src/components/SelectionField/index.tsx +166 -0
- package/src/components/Spacer/index.tsx +19 -0
- package/src/components/Switch/Switch.tsx +110 -0
- package/src/components/Switch/utils.ts +96 -0
- package/src/components/Text/index.tsx +69 -0
- package/src/components/TextInput/.DS_Store +0 -0
- package/src/components/TextInput/Addons/Outline.tsx +62 -0
- package/src/components/TextInput/Addons/Underline.tsx +71 -0
- package/src/components/TextInput/Adornment/TextInputAdornment.tsx +191 -0
- package/src/components/TextInput/Adornment/TextInputAffix.tsx +212 -0
- package/src/components/TextInput/Adornment/enums.tsx +12 -0
- package/src/components/TextInput/Adornment/types.tsx +11 -0
- package/src/components/TextInput/Adornment/utils.ts +39 -0
- package/src/components/TextInput/Label/InputLabel.tsx +216 -0
- package/src/components/TextInput/Label/LabelBackground.tsx +100 -0
- package/src/components/TextInput/TextInput.tsx +564 -0
- package/src/components/TextInput/TextInputDefault.tsx +187 -0
- package/src/components/TextInput/TextInputFlat.tsx +452 -0
- package/src/components/TextInput/constants.tsx +48 -0
- package/src/components/TextInput/helpers.tsx +546 -0
- package/src/components/TextInput/types.tsx +155 -0
- package/src/components/Toast/ToastProvider.tsx +69 -0
- package/src/components/Toast/index.tsx +239 -0
- package/src/components/Typography/AnimatedText.tsx +84 -0
- package/src/components/Typography/StyledText.tsx +53 -0
- package/src/components/Typography/Text.tsx +189 -0
- package/src/components/Typography/types.tsx +5 -0
- package/src/components/View/index.tsx +175 -0
- package/src/components/ViewVisibleAnimated/index.tsx +199 -0
- package/src/constants.tsx +16 -0
- package/src/core/theming.tsx +144 -0
- package/src/icons/IconArrowDown.tsx +14 -0
- package/src/icons/IconCheckbox.tsx +20 -0
- package/src/icons/IconCheckboxActive.tsx +18 -0
- package/src/icons/IconClearText.tsx +14 -0
- package/src/icons/IconRadio.tsx +11 -0
- package/src/icons/IconRadioActive.tsx +12 -0
- package/src/icons/IconRadioDisable.tsx +12 -0
- package/src/index.ts +51 -0
- package/src/index.tsx +50 -0
- package/src/styles/fonts.tsx +89 -0
- package/src/styles/overlay.tsx +69 -0
- package/src/styles/shadow.tsx +47 -0
- package/src/styles/themes/DarkTheme.tsx +157 -0
- package/src/styles/themes/LightTheme.tsx +160 -0
- package/src/styles/themes/index.ts +3 -0
- package/src/styles/themes/tokens.tsx +481 -0
- package/src/theme/blue.ts +25 -0
- package/src/theme/colors.ts +21 -0
- package/src/theme/container-styles.tsx +126 -0
- package/src/theme/dimensions.ts +44 -0
- package/src/theme/green.ts +27 -0
- package/src/theme/icon.ts +7 -0
- package/src/theme/ink.ts +18 -0
- package/src/theme/orange.ts +24 -0
- package/src/theme/purple.ts +8 -0
- package/src/theme/red.ts +26 -0
- package/src/theme/themes.tsx +287 -0
- package/src/theme/white.ts +16 -0
- package/src/theme/yellow.ts +26 -0
- package/src/types/index.ts +71 -0
- package/src/types/svg.d.ts +5 -0
- package/src/types.ts +259 -0
- package/src/types.tsx +284 -0
- package/src/utils/BackHandler/BackHandler.native.tsx +3 -0
- package/src/utils/BackHandler/BackHandler.tsx +11 -0
- package/src/utils/addEventListener.tsx +56 -0
- package/src/utils/forwardRef.tsx +23 -0
- package/src/utils/function-utils.tsx +108 -0
- package/src/utils/getContrastingColor.tsx +15 -0
- package/src/utils/hasTouchHandler.tsx +23 -0
- package/src/utils/roundLayoutSize.ts +2 -0
- package/src/utils/splitStyles.ts +60 -0
- package/src/utils/toast-manager.tsx +46 -0
- package/src/utils/useAnimatedValue.tsx +9 -0
- package/src/utils/useAnimatedValueArray.tsx +13 -0
- package/src/utils/useIsKeyboardShown.tsx +55 -0
- package/src/utils/useLayout.tsx +29 -0
- package/src/utils/useLazyRef.tsx +11 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ColorValue, TextStyle, ViewStyle } from 'react-native';
|
|
2
|
+
export interface Theme {
|
|
3
|
+
dark: boolean;
|
|
4
|
+
colors: {
|
|
5
|
+
primary: string;
|
|
6
|
+
background: string;
|
|
7
|
+
surface: string;
|
|
8
|
+
accent: string;
|
|
9
|
+
error: string;
|
|
10
|
+
text: string;
|
|
11
|
+
disabled: string;
|
|
12
|
+
placeholder: string;
|
|
13
|
+
backdrop: string;
|
|
14
|
+
notification: string;
|
|
15
|
+
};
|
|
16
|
+
fonts: {
|
|
17
|
+
regular: TextStyle;
|
|
18
|
+
medium: TextStyle;
|
|
19
|
+
light: TextStyle;
|
|
20
|
+
thin: TextStyle;
|
|
21
|
+
};
|
|
22
|
+
animation: {
|
|
23
|
+
scale: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface ComponentProps {
|
|
27
|
+
style?: ViewStyle;
|
|
28
|
+
theme?: Theme;
|
|
29
|
+
}
|
|
30
|
+
export interface TextProps extends ComponentProps {
|
|
31
|
+
color?: ColorValue;
|
|
32
|
+
size?: number;
|
|
33
|
+
weight?: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
34
|
+
align?: 'auto' | 'left' | 'right' | 'center' | 'justify';
|
|
35
|
+
}
|
|
36
|
+
export interface ButtonProps extends ComponentProps {
|
|
37
|
+
onPress?: () => void;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
loading?: boolean;
|
|
40
|
+
mode?: 'text' | 'outlined' | 'contained';
|
|
41
|
+
color?: string;
|
|
42
|
+
dark?: boolean;
|
|
43
|
+
compact?: boolean;
|
|
44
|
+
contentStyle?: ViewStyle;
|
|
45
|
+
labelStyle?: TextStyle;
|
|
46
|
+
}
|
|
47
|
+
export interface CardProps extends ComponentProps {
|
|
48
|
+
onPress?: () => void;
|
|
49
|
+
elevation?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface TextInputProps extends ComponentProps {
|
|
52
|
+
value: string;
|
|
53
|
+
onChangeText?: (text: string) => void;
|
|
54
|
+
placeholder?: string;
|
|
55
|
+
secureTextEntry?: boolean;
|
|
56
|
+
keyboardType?: 'default' | 'number-pad' | 'decimal-pad' | 'numeric' | 'email-address' | 'phone-pad';
|
|
57
|
+
autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';
|
|
58
|
+
autoCorrect?: boolean;
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
error?: boolean;
|
|
61
|
+
multiline?: boolean;
|
|
62
|
+
numberOfLines?: number;
|
|
63
|
+
maxLength?: number;
|
|
64
|
+
label?: string;
|
|
65
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type { $DeepPartial } from "@callstack/react-theme-provider";
|
|
3
|
+
export type Font = {
|
|
4
|
+
fontFamily: string;
|
|
5
|
+
fontWeight?: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900";
|
|
6
|
+
fontStyle?: "normal" | "italic" | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type Fonts = {
|
|
9
|
+
regular: Font;
|
|
10
|
+
medium: Font;
|
|
11
|
+
light: Font;
|
|
12
|
+
thin: Font;
|
|
13
|
+
};
|
|
14
|
+
type Mode = "adaptive" | "exact";
|
|
15
|
+
export type ThemeColors = {
|
|
16
|
+
elevation: MD3ElevationColors;
|
|
17
|
+
backgroundPrimary: string;
|
|
18
|
+
backgroundSecondary: string;
|
|
19
|
+
borderBrandDefault: string;
|
|
20
|
+
borderCriticalDefault: string;
|
|
21
|
+
borderCriticalHover: string;
|
|
22
|
+
borderCriticalPressed: string;
|
|
23
|
+
borderCriticalInverseDefault: string;
|
|
24
|
+
borderCriticalInverseHover: string;
|
|
25
|
+
borderCriticalInversePressed: string;
|
|
26
|
+
borderErrorInverseDefault: string;
|
|
27
|
+
borderPrimaryFocused: string;
|
|
28
|
+
borderWarningInverseDefault: string;
|
|
29
|
+
borderSuccessInverseDefault: string;
|
|
30
|
+
borderErrorDefault: string;
|
|
31
|
+
borderInfoDefault: string;
|
|
32
|
+
borderPrimaryDefault: string;
|
|
33
|
+
borderPrimaryDisabled: string;
|
|
34
|
+
borderPrimaryHovered: string;
|
|
35
|
+
borderPrimaryInverseDefault: string;
|
|
36
|
+
borderPrimaryPressed: string;
|
|
37
|
+
borderSuccessDefault: string;
|
|
38
|
+
borderWarningDefault: string;
|
|
39
|
+
iconBrandDefault: string;
|
|
40
|
+
iconCriticalDefault: string;
|
|
41
|
+
iconErrorDefault: string;
|
|
42
|
+
iconInfoDefault: string;
|
|
43
|
+
iconPrimaryDefault: string;
|
|
44
|
+
iconPrimaryHover: string;
|
|
45
|
+
iconPrimaryDisabled: string;
|
|
46
|
+
iconPrimaryInverseDefault: string;
|
|
47
|
+
iconPrimaryInverseHover: string;
|
|
48
|
+
iconPrimaryInversePressed: string;
|
|
49
|
+
iconPrimaryPressed: string;
|
|
50
|
+
iconSuccessDefault: string;
|
|
51
|
+
iconWarningDefault: string;
|
|
52
|
+
surfaceBrandDefault: string;
|
|
53
|
+
surfaceBrandDisabled: string;
|
|
54
|
+
surfaceBrandHover: string;
|
|
55
|
+
surfaceBrandInverseDefault: string;
|
|
56
|
+
surfaceBrandInverseHover: string;
|
|
57
|
+
surfaceBrandInversePressed: string;
|
|
58
|
+
surfaceBrandPressed: string;
|
|
59
|
+
surfaceCriticalDefault: string;
|
|
60
|
+
surfaceCriticalDisabled: string;
|
|
61
|
+
surfaceCriticalHover: string;
|
|
62
|
+
surfaceCriticalInverseDefault: string;
|
|
63
|
+
surfaceCriticalInverseHover: string;
|
|
64
|
+
surfaceCriticalInversePressed: string;
|
|
65
|
+
surfaceCriticalPressed: string;
|
|
66
|
+
surfaceErrorDefault: string;
|
|
67
|
+
surfaceErrorDisabled: string;
|
|
68
|
+
surfaceErrorHover: string;
|
|
69
|
+
surfaceErrorInverseDefault: string;
|
|
70
|
+
surfaceErrorInverseHover: string;
|
|
71
|
+
surfaceErrorInversePressed: string;
|
|
72
|
+
surfaceErrorPressed: string;
|
|
73
|
+
surfaceInfoDefault: string;
|
|
74
|
+
surfaceInfoDisabled: string;
|
|
75
|
+
surfaceInfoHover: string;
|
|
76
|
+
surfaceInfoInverseDefault: string;
|
|
77
|
+
surfaceInfoInverseHover: string;
|
|
78
|
+
surfaceInfoInversePressed: string;
|
|
79
|
+
surfaceInfoPressed: string;
|
|
80
|
+
surfacePrimaryDefault: string;
|
|
81
|
+
surfacePrimaryDisabled: string;
|
|
82
|
+
surfacePrimaryHover: string;
|
|
83
|
+
surfacePrimaryInverseDefault: string;
|
|
84
|
+
surfacePrimaryInverseHover: string;
|
|
85
|
+
surfacePrimaryInversePressed: string;
|
|
86
|
+
surfacePrimaryPressed: string;
|
|
87
|
+
surfaceSecondaryDefault: string;
|
|
88
|
+
surfaceSecondaryDisabled: string;
|
|
89
|
+
surfaceSecondaryHover: string;
|
|
90
|
+
surfaceSecondaryPressed: string;
|
|
91
|
+
surfaceSuccessDefault: string;
|
|
92
|
+
surfaceSuccessDisabled: string;
|
|
93
|
+
surfaceSuccessHover: string;
|
|
94
|
+
surfaceSuccessInverseDefault: string;
|
|
95
|
+
surfaceSuccessInverseHover: string;
|
|
96
|
+
surfaceSuccessInversePressed: string;
|
|
97
|
+
surfaceSuccessPressed: string;
|
|
98
|
+
surfaceWarningDefault: string;
|
|
99
|
+
surfaceWarningDisabled: string;
|
|
100
|
+
surfaceWarningHover: string;
|
|
101
|
+
surfaceWarningInverseDefault: string;
|
|
102
|
+
surfaceWarningInverseHover: string;
|
|
103
|
+
surfaceWarningInversePressed: string;
|
|
104
|
+
surfaceWarningPressed: string;
|
|
105
|
+
textDefault: string;
|
|
106
|
+
textDisabled: string;
|
|
107
|
+
textPlaceholder: string;
|
|
108
|
+
textSecondary: string;
|
|
109
|
+
textBrandDefault: string;
|
|
110
|
+
textBrandDisabled: string;
|
|
111
|
+
textBrandHovered: string;
|
|
112
|
+
textBrandPressed: string;
|
|
113
|
+
textCriticalDefault: string;
|
|
114
|
+
textCriticalDisabled: string;
|
|
115
|
+
textCriticalHovered: string;
|
|
116
|
+
textCriticalPressed: string;
|
|
117
|
+
textErrorDefault: string;
|
|
118
|
+
textErrorDisabled: string;
|
|
119
|
+
textErrorHovered: string;
|
|
120
|
+
textErrorPressed: string;
|
|
121
|
+
textInfoDefault: string;
|
|
122
|
+
textInfoDisabled: string;
|
|
123
|
+
textInfoHovered: string;
|
|
124
|
+
textInfoPressed: string;
|
|
125
|
+
textLinkDefault: string;
|
|
126
|
+
textLinkDisabled: string;
|
|
127
|
+
textLinkHovered: string;
|
|
128
|
+
textLinkPressed: string;
|
|
129
|
+
textLinkVisitedDefault: string;
|
|
130
|
+
textLinkVisitedDisabled: string;
|
|
131
|
+
textLinkVisitedHovered: string;
|
|
132
|
+
textLinkVisitedPressed: string;
|
|
133
|
+
textOnFillDefault: string;
|
|
134
|
+
textOnFillDisabled: string;
|
|
135
|
+
textOnFillHovered: string;
|
|
136
|
+
textOnFillPressed: string;
|
|
137
|
+
textSuccessDefault: string;
|
|
138
|
+
textSuccessDisabled: string;
|
|
139
|
+
textSuccessHovered: string;
|
|
140
|
+
textSuccessPressed: string;
|
|
141
|
+
textWarningDefault: string;
|
|
142
|
+
textWarningDisabled: string;
|
|
143
|
+
textWarningHovered: string;
|
|
144
|
+
textWarningPressed: string;
|
|
145
|
+
selectBackgroundDisabled: string;
|
|
146
|
+
selectIconDisabled: string;
|
|
147
|
+
};
|
|
148
|
+
export type ThemeProp = $DeepPartial<InternalTheme>;
|
|
149
|
+
export type ThemeBase = {
|
|
150
|
+
dark: boolean;
|
|
151
|
+
mode?: Mode;
|
|
152
|
+
roundness: number;
|
|
153
|
+
animation: {
|
|
154
|
+
scale: number;
|
|
155
|
+
defaultAnimationDuration?: number;
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
export type AppTheme = ThemeBase & {
|
|
159
|
+
version: 3;
|
|
160
|
+
colors: ThemeColors;
|
|
161
|
+
fonts: MD3Typescale;
|
|
162
|
+
};
|
|
163
|
+
export type InternalTheme = AppTheme;
|
|
164
|
+
export declare enum MD3TypescaleKey {
|
|
165
|
+
displayLarge = "displayLarge",
|
|
166
|
+
displayMedium = "displayMedium",
|
|
167
|
+
displaySmall = "displaySmall",
|
|
168
|
+
headlineLarge = "headlineLarge",
|
|
169
|
+
headlineMedium = "headlineMedium",
|
|
170
|
+
headlineSmall = "headlineSmall",
|
|
171
|
+
titleLarge = "titleLarge",
|
|
172
|
+
titleMedium = "titleMedium",
|
|
173
|
+
titleSmall = "titleSmall",
|
|
174
|
+
labelLarge = "labelLarge",
|
|
175
|
+
labelMedium = "labelMedium",
|
|
176
|
+
labelSmall = "labelSmall",
|
|
177
|
+
bodyLarge = "bodyLarge",
|
|
178
|
+
bodyMedium = "bodyMedium",
|
|
179
|
+
bodySmall = "bodySmall"
|
|
180
|
+
}
|
|
181
|
+
export type MD3Type = {
|
|
182
|
+
fontFamily: string;
|
|
183
|
+
letterSpacing: number;
|
|
184
|
+
fontWeight: Font["fontWeight"];
|
|
185
|
+
lineHeight: number;
|
|
186
|
+
fontSize: number;
|
|
187
|
+
fontStyle?: Font["fontStyle"];
|
|
188
|
+
};
|
|
189
|
+
export type MD3Typescale = {
|
|
190
|
+
[key in MD3TypescaleKey]: MD3Type;
|
|
191
|
+
} & {
|
|
192
|
+
["default"]: Omit<MD3Type, "lineHeight" | "fontSize">;
|
|
193
|
+
};
|
|
194
|
+
export type MD3Elevation = 0 | 1 | 2 | 3 | 4 | 5;
|
|
195
|
+
export declare enum ElevationLevels {
|
|
196
|
+
"level0" = 0,
|
|
197
|
+
"level1" = 1,
|
|
198
|
+
"level2" = 2,
|
|
199
|
+
"level3" = 3,
|
|
200
|
+
"level4" = 4,
|
|
201
|
+
"level5" = 5
|
|
202
|
+
}
|
|
203
|
+
export type MD3ElevationColors = {
|
|
204
|
+
[key in keyof typeof ElevationLevels]: string;
|
|
205
|
+
};
|
|
206
|
+
export type $Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
207
|
+
export type $RemoveChildren<T extends React.ComponentType<any>> = $Omit<React.ComponentPropsWithoutRef<T>, "children">;
|
|
208
|
+
export type EllipsizeProp = "head" | "middle" | "tail" | "clip";
|
|
209
|
+
export type NavigationTheme = {
|
|
210
|
+
dark: boolean;
|
|
211
|
+
colors: {
|
|
212
|
+
primary: string;
|
|
213
|
+
background: string;
|
|
214
|
+
card: string;
|
|
215
|
+
text: string;
|
|
216
|
+
border: string;
|
|
217
|
+
notification: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NativeEventSubscription, EmitterSubscription } from 'react-native';
|
|
2
|
+
export declare function addEventListener<T extends {
|
|
3
|
+
addEventListener: (...args: any) => NativeEventSubscription | EmitterSubscription;
|
|
4
|
+
} & {
|
|
5
|
+
removeEventListener?: (...args: any) => void;
|
|
6
|
+
} & {
|
|
7
|
+
remove?: (...args: any) => void;
|
|
8
|
+
}>(Module: T, ...rest: Parameters<typeof Module.addEventListener>): NativeEventSubscription | EmitterSubscription;
|
|
9
|
+
export declare function addListener<T extends {
|
|
10
|
+
addListener: (...args: any) => EmitterSubscription;
|
|
11
|
+
removeEventListener: (...args: any) => void;
|
|
12
|
+
}>(Module: T, ...rest: Parameters<typeof Module.addListener>): EmitterSubscription;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ForwardRefRenderFunction, PropsWithoutRef, RefAttributes, ForwardRefExoticComponent } from 'react';
|
|
2
|
+
export type ForwardRefComponent<T, P = {}> = ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
|
|
3
|
+
/**
|
|
4
|
+
* TypeScript generated a large union of props from `ViewProps` in
|
|
5
|
+
* `d.ts` files when using `React.forwardRef`. To prevent this
|
|
6
|
+
* `ForwardRefComponent` was created and exported. Use this
|
|
7
|
+
* `forwardRef` instead of `React.forwardRef` so you don't have to
|
|
8
|
+
* import `ForwardRefComponent`.
|
|
9
|
+
* More info: https://github.com/callstack/react-native-paper/pull/3603
|
|
10
|
+
*/
|
|
11
|
+
export declare const forwardRef: <T, P = {}>(render: ForwardRefRenderFunction<T, P>) => ForwardRefComponent<T, P>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare function deepEqualWithDate(a: any, b: any): boolean;
|
|
3
|
+
export declare function deepEqualWithArguments(a: any, b: any): boolean;
|
|
4
|
+
export declare function memoDeepEqual<T>(component: React.ComponentType<T>): React.MemoExoticComponent<React.ComponentType<T>>;
|
|
5
|
+
export declare const memoWithRef: (component: any) => React.NamedExoticComponent<React.RefAttributes<unknown>>;
|
|
6
|
+
export declare const detectEmail: (email: string) => boolean;
|
|
7
|
+
export declare const detectUserName: (name: string) => boolean;
|
|
8
|
+
export declare const detectPhoneNumber: (phoneNum: string) => boolean;
|
|
9
|
+
export declare function withAnimated(WrappedComponent: React.ComponentType<any>): React.ComponentType;
|
|
10
|
+
export declare const phoneValid: (phone: string) => boolean;
|
|
11
|
+
export declare const lightenColor: (color: string, percent: number) => string;
|
|
12
|
+
export declare function getFileExtension(filename: string): string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { GestureResponderEvent } from 'react-native';
|
|
2
|
+
declare const touchableEvents: readonly ["onPress", "onLongPress", "onPressIn", "onPressOut"];
|
|
3
|
+
type TouchableEventObject = Partial<Record<(typeof touchableEvents)[number], (event: GestureResponderEvent) => void>>;
|
|
4
|
+
export default function hasTouchHandler(touchableEventObject: TouchableEventObject): boolean;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const roundLayoutSize: (size: number) => number;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
type FiltersArray = readonly ((style: keyof ViewStyle) => boolean)[];
|
|
3
|
+
type MappedTuple<Tuple extends FiltersArray> = {
|
|
4
|
+
[Index in keyof Tuple]: ViewStyle;
|
|
5
|
+
} & {
|
|
6
|
+
length: Tuple['length'];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Utility function to extract styles in separate objects
|
|
10
|
+
*
|
|
11
|
+
* @param styles The style object you want to filter
|
|
12
|
+
* @param filters The filters by which you want to split the styles
|
|
13
|
+
* @returns An array of filtered style objects:
|
|
14
|
+
* - The first style object contains the properties that didn't match any filter
|
|
15
|
+
* - After that there will be a style object for each filter you passed in the same order as the matching filters
|
|
16
|
+
* - A style property will exist in a single style object, the first filter it matched
|
|
17
|
+
*/
|
|
18
|
+
export declare function splitStyles<Tuple extends FiltersArray>(styles: ViewStyle, ...filters: Tuple): [ViewStyle, ...MappedTuple<Tuple>];
|
|
19
|
+
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" | "info" | "warning" | "error";
|
|
8
|
+
onPress?: () => void;
|
|
9
|
+
title?: string;
|
|
10
|
+
}) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const toastRef: React.RefObject<ToastRef | null>;
|
|
13
|
+
export declare const showToast: ({ message, duration, position, type, onPress, title, }: {
|
|
14
|
+
message?: string;
|
|
15
|
+
duration?: number;
|
|
16
|
+
position?: "top" | "bottom";
|
|
17
|
+
type?: "success" | "info" | "warning" | "error";
|
|
18
|
+
onPress?: () => void;
|
|
19
|
+
title?: string;
|
|
20
|
+
}) => void;
|
|
21
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sapo-components-ui-rn",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "React Native UI Components Library",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.esm.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "rollup -c",
|
|
14
|
+
"test": "jest --passWithNoTests",
|
|
15
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
16
|
+
"prepare": "npm run build",
|
|
17
|
+
"prepublishOnly": "npm run build",
|
|
18
|
+
"clean": "rimraf dist",
|
|
19
|
+
"storybook-generate": "sb-rn-get-stories",
|
|
20
|
+
"storybook": "start-storybook -p 6006",
|
|
21
|
+
"build-storybook": "build-storybook",
|
|
22
|
+
"storybook-native": "storybook start -p 7007"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://git.dktsoft.com:2008/sapo-mobile/mobile-components-rn.git"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"react-native",
|
|
30
|
+
"ui",
|
|
31
|
+
"components",
|
|
32
|
+
"Sapo",
|
|
33
|
+
"typescript"
|
|
34
|
+
],
|
|
35
|
+
"author": "Sapo",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"@d11/react-native-fast-image": "*",
|
|
39
|
+
"@react-native-community/masked-view": ">=0.1.11",
|
|
40
|
+
"@react-navigation/native": "*",
|
|
41
|
+
"@react-navigation/stack": "*",
|
|
42
|
+
"color": "^4.2.3",
|
|
43
|
+
"deepmerge": "^4.3.0",
|
|
44
|
+
"react": ">=18.0.0",
|
|
45
|
+
"react-native": ">=0.70.0",
|
|
46
|
+
"react-native-gesture-handler": ">=2.9.0",
|
|
47
|
+
"react-native-reanimated": ">=3.0.0",
|
|
48
|
+
"react-native-safe-area-context": ">=4.5.0",
|
|
49
|
+
"react-native-screens": ">=3.20.0",
|
|
50
|
+
"react-native-svg": "^15.11.2",
|
|
51
|
+
"react-native-vector-icons": "^9.2.0",
|
|
52
|
+
"use-latest-callback": "^0.2.3",
|
|
53
|
+
"util": "^0.12.5"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@callstack/react-theme-provider": "^3.0.0"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@babel/core": "^7.12.0",
|
|
60
|
+
"@babel/runtime": "^7.12.0",
|
|
61
|
+
"@callstack/react-theme-provider": "^3.0.0",
|
|
62
|
+
"@gorhom/bottom-sheet": "^5.1.2",
|
|
63
|
+
"@react-native-async-storage/async-storage": "^2.1.2",
|
|
64
|
+
"@react-native-community/datetimepicker": "^8.3.0",
|
|
65
|
+
"@react-native-community/eslint-config": "^2.0.0",
|
|
66
|
+
"@react-native-community/slider": "^4.5.6",
|
|
67
|
+
"@rollup/plugin-commonjs": "^21.0.0",
|
|
68
|
+
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
69
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
70
|
+
"@storybook/addon-essentials": "^8.6.12",
|
|
71
|
+
"@storybook/addon-ondevice-actions": "^8.6.2",
|
|
72
|
+
"@storybook/addon-ondevice-controls": "^8.6.2",
|
|
73
|
+
"@storybook/addons": "^7.6.17",
|
|
74
|
+
"@storybook/cli": "^8.6.12",
|
|
75
|
+
"@storybook/react": "^8.6.12",
|
|
76
|
+
"@storybook/react-native": "^8.6.2",
|
|
77
|
+
"@svgr/cli": "^8.1.0",
|
|
78
|
+
"@svgr/core": "^8.1.0",
|
|
79
|
+
"@types/color": "^4.2.0",
|
|
80
|
+
"@types/jest": "^27.0.0",
|
|
81
|
+
"@types/lodash": "^4.17.16",
|
|
82
|
+
"@types/react": "^19.1.2",
|
|
83
|
+
"@types/react-native": "^0.73.0",
|
|
84
|
+
"babel-loader": "^10.0.0",
|
|
85
|
+
"cpy": "^11.1.0",
|
|
86
|
+
"eslint": "^7.32.0",
|
|
87
|
+
"jest": "^27.0.0",
|
|
88
|
+
"lodash": "^4.17.21",
|
|
89
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
90
|
+
"react": "^19.0.0",
|
|
91
|
+
"react-dom": "^19.1.0",
|
|
92
|
+
"react-native": "^0.78.0",
|
|
93
|
+
"react-native-storybook-loader": "^2.0.5",
|
|
94
|
+
"react-native-svg": "^15.11.2",
|
|
95
|
+
"react-native-svg-transformer": "^1.5.1",
|
|
96
|
+
"react-native-web": "^0.20.0",
|
|
97
|
+
"rimraf": "^3.0.2",
|
|
98
|
+
"rollup": "^2.60.0",
|
|
99
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
100
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
101
|
+
"typescript": "^5.8.3",
|
|
102
|
+
"webpack": "^5.99.5"
|
|
103
|
+
}
|
|
104
|
+
}
|
package/src/.DS_Store
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="2" y="2" width="20" height="20" rx="6" fill="#0088FF"/>
|
|
3
|
+
<path d="M17.7745 8.32544L10.4245 15.6751L6.74951 12.0004" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const SKIP = Symbol('SKIP');
|
|
2
|
+
|
|
3
|
+
module.exports = function rewire(babel, options) {
|
|
4
|
+
const t = babel.types;
|
|
5
|
+
|
|
6
|
+
const { name, index, mappings } = require(options.mappings ||
|
|
7
|
+
'../../mappings.json');
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
visitor: {
|
|
11
|
+
ImportDeclaration(path) {
|
|
12
|
+
if (path.node.source.value !== name || path.node[SKIP]) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
path.node.source.value = `${name}/${index}`;
|
|
17
|
+
path.replaceWithMultiple(
|
|
18
|
+
path.node.specifiers.reduce((declarations, specifier) => {
|
|
19
|
+
const mapping = mappings[specifier.imported.name];
|
|
20
|
+
|
|
21
|
+
if (mapping) {
|
|
22
|
+
const alias = `${name}/${mapping.path}`;
|
|
23
|
+
const identifier = t.identifier(specifier.local.name);
|
|
24
|
+
|
|
25
|
+
let s;
|
|
26
|
+
|
|
27
|
+
switch (mapping.name) {
|
|
28
|
+
case 'default':
|
|
29
|
+
s = t.importDefaultSpecifier(identifier);
|
|
30
|
+
break;
|
|
31
|
+
case '*':
|
|
32
|
+
s = t.importNamespaceSpecifier(identifier);
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
s = t.importSpecifier(identifier, t.identifier(mapping.name));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declarations.push(
|
|
39
|
+
t.importDeclaration([s], t.stringLiteral(alias))
|
|
40
|
+
);
|
|
41
|
+
} else {
|
|
42
|
+
const previous = declarations.find(
|
|
43
|
+
(d) => d.source.value === path.node.source.value
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (previous) {
|
|
47
|
+
previous.specifiers.push(specifier);
|
|
48
|
+
} else {
|
|
49
|
+
const node = t.importDeclaration([specifier], path.node.source);
|
|
50
|
+
node[SKIP] = true;
|
|
51
|
+
declarations.push(node);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return declarations;
|
|
56
|
+
}, [])
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
path.requeue();
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
};
|
|
Binary file
|