react-native-shared-components 0.3.1 → 0.3.3

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 (86) hide show
  1. package/README.md +0 -5
  2. package/lib/module/assets/arrow-left.png +0 -0
  3. package/lib/module/assets/arrow-right.png +0 -0
  4. package/lib/module/assets/avatar.png +0 -0
  5. package/lib/module/assets/check-circle.png +0 -0
  6. package/lib/module/assets/chevron-up.png +0 -0
  7. package/lib/module/assets/eye-off.png +0 -0
  8. package/lib/module/assets/eye.png +0 -0
  9. package/lib/module/assets/ic-solar_danger-bold.png +0 -0
  10. package/lib/module/assets/minus.png +0 -0
  11. package/lib/module/assets/plus.png +0 -0
  12. package/lib/module/assets/search-md.png +0 -0
  13. package/lib/module/assets/x.png +0 -0
  14. package/lib/module/components/BaseButton/index.js +159 -0
  15. package/lib/module/components/BaseButton/index.js.map +1 -0
  16. package/lib/module/components/BaseContainer/index.js +63 -0
  17. package/lib/module/components/BaseContainer/index.js.map +1 -0
  18. package/lib/module/components/BaseContainer/styles.js +20 -0
  19. package/lib/module/components/BaseContainer/styles.js.map +1 -0
  20. package/lib/module/components/BaseText/index.js +36 -0
  21. package/lib/module/components/BaseText/index.js.map +1 -0
  22. package/lib/module/components/index.js +3 -1
  23. package/lib/module/components/index.js.map +1 -1
  24. package/lib/module/constants/Colors.js +151 -0
  25. package/lib/module/constants/Colors.js.map +1 -0
  26. package/lib/module/constants/commonStyles.js +16 -0
  27. package/lib/module/constants/commonStyles.js.map +1 -0
  28. package/lib/module/constants/index.js +5 -0
  29. package/lib/module/constants/index.js.map +1 -0
  30. package/lib/module/index.js +2 -3
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/module/utils/helper.js +11 -0
  33. package/lib/module/utils/helper.js.map +1 -0
  34. package/lib/module/utils/index.js +4 -0
  35. package/lib/module/utils/index.js.map +1 -0
  36. package/lib/typescript/src/components/BaseButton/index.d.ts +18 -0
  37. package/lib/typescript/src/components/BaseButton/index.d.ts.map +1 -0
  38. package/lib/typescript/src/components/BaseContainer/index.d.ts +24 -0
  39. package/lib/typescript/src/components/BaseContainer/index.d.ts.map +1 -0
  40. package/lib/typescript/src/components/BaseContainer/styles.d.ts +17 -0
  41. package/lib/typescript/src/components/BaseContainer/styles.d.ts.map +1 -0
  42. package/lib/typescript/src/components/BaseText/index.d.ts +10 -0
  43. package/lib/typescript/src/components/BaseText/index.d.ts.map +1 -0
  44. package/lib/typescript/src/components/index.d.ts +3 -1
  45. package/lib/typescript/src/components/index.d.ts.map +1 -1
  46. package/lib/typescript/src/constants/Colors.d.ts +145 -0
  47. package/lib/typescript/src/constants/Colors.d.ts.map +1 -0
  48. package/lib/typescript/src/constants/commonStyles.d.ts +10 -0
  49. package/lib/typescript/src/constants/commonStyles.d.ts.map +1 -0
  50. package/lib/typescript/src/constants/index.d.ts +3 -0
  51. package/lib/typescript/src/constants/index.d.ts.map +1 -0
  52. package/lib/typescript/src/index.d.ts +2 -1
  53. package/lib/typescript/src/index.d.ts.map +1 -1
  54. package/lib/typescript/src/utils/helper.d.ts +4 -0
  55. package/lib/typescript/src/utils/helper.d.ts.map +1 -0
  56. package/lib/typescript/src/utils/index.d.ts +2 -0
  57. package/lib/typescript/src/utils/index.d.ts.map +1 -0
  58. package/package.json +10 -4
  59. package/src/assets/arrow-left.png +0 -0
  60. package/src/assets/arrow-right.png +0 -0
  61. package/src/assets/avatar.png +0 -0
  62. package/src/assets/check-circle.png +0 -0
  63. package/src/assets/chevron-up.png +0 -0
  64. package/src/assets/eye-off.png +0 -0
  65. package/src/assets/eye.png +0 -0
  66. package/src/assets/ic-solar_danger-bold.png +0 -0
  67. package/src/assets/minus.png +0 -0
  68. package/src/assets/plus.png +0 -0
  69. package/src/assets/search-md.png +0 -0
  70. package/src/assets/x.png +0 -0
  71. package/src/components/BaseButton/index.tsx +225 -0
  72. package/src/components/BaseContainer/index.tsx +108 -0
  73. package/src/components/BaseContainer/styles.ts +18 -0
  74. package/src/components/BaseText/index.tsx +43 -0
  75. package/src/components/index.tsx +3 -1
  76. package/src/constants/Colors.ts +148 -0
  77. package/src/constants/commonStyles.ts +17 -0
  78. package/src/constants/index.tsx +2 -0
  79. package/src/index.tsx +2 -3
  80. package/src/utils/helper.ts +4 -0
  81. package/src/utils/index.tsx +1 -0
  82. package/lib/module/components/Button/index.js +0 -24
  83. package/lib/module/components/Button/index.js.map +0 -1
  84. package/lib/typescript/src/components/Button/index.d.ts +0 -11
  85. package/lib/typescript/src/components/Button/index.d.ts.map +0 -1
  86. package/src/components/Button/index.tsx +0 -32
@@ -0,0 +1,24 @@
1
+ import { type ColorValue, type TextStyle, type ViewStyle, type KeyboardAvoidingViewProps } from 'react-native';
2
+ import { type ReactNode } from 'react';
3
+ import { type BaseTextType } from '../BaseText';
4
+ export interface IBaseContainer {
5
+ title?: string;
6
+ center?: ReactNode;
7
+ right?: ReactNode;
8
+ left?: ReactNode;
9
+ onPressLeft?: () => void;
10
+ onPressRight?: () => void;
11
+ onPressCenter?: () => void;
12
+ styleTitle?: TextStyle;
13
+ isHeader?: boolean;
14
+ barStyle?: 'default' | 'light-content' | 'dark-content';
15
+ children: ReactNode;
16
+ style?: ViewStyle;
17
+ styleHeader?: ViewStyle;
18
+ backgroundColorStatusBar?: ColorValue | undefined;
19
+ edges?: Array<'top' | 'bottom' | 'left' | 'right'>;
20
+ keyboardAvoidingViewProps?: Omit<KeyboardAvoidingViewProps, 'children'>;
21
+ type?: BaseTextType;
22
+ }
23
+ export declare const BaseContainer: ({ style, title, left, right, center, onPressLeft, onPressRight, onPressCenter, styleTitle, isHeader, children, backgroundColorStatusBar, barStyle, styleHeader, edges, keyboardAvoidingViewProps, type, }: IBaseContainer) => import("react/jsx-runtime").JSX.Element;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/BaseContainer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,yBAAyB,EAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,GAAG,eAAe,GAAG,cAAc,CAAC;IACxD,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,wBAAwB,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAClD,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACnD,yBAAyB,CAAC,EAAE,IAAI,CAAC,yBAAyB,EAAE,UAAU,CAAC,CAAC;IACxE,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,GAAI,2MAkB3B,cAAc,4CAqDhB,CAAC"}
@@ -0,0 +1,17 @@
1
+ export declare const styles: {
2
+ container: {
3
+ flex: number;
4
+ };
5
+ safeView: {
6
+ flex: number;
7
+ };
8
+ header: {
9
+ alignItems: "center";
10
+ justifyContent: "space-between";
11
+ flexDirection: "row";
12
+ width: "100%";
13
+ paddingVertical: number;
14
+ paddingHorizontal: number;
15
+ };
16
+ };
17
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/BaseContainer/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;CAejB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { type TextProps } from 'react-native';
3
+ export type BaseTextType = 'ExtraBold' | 'Bold' | 'SemiBold' | 'Medium';
4
+ export interface BaseTextProps extends TextProps {
5
+ type?: BaseTextType;
6
+ size?: number;
7
+ children: React.ReactNode;
8
+ }
9
+ export declare const BaseText: React.FC<BaseTextProps>;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/BaseText/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;AAExE,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAgB5C,CAAC"}
@@ -1,2 +1,4 @@
1
- export * from './Button';
1
+ export * from './BaseButton';
2
+ export * from './BaseContainer';
3
+ export * from './BaseText';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
@@ -0,0 +1,145 @@
1
+ export declare const Colors: {
2
+ bg_default_primary_light: string;
3
+ bg_default_primary_dark: string;
4
+ bg_default_secondary_light: string;
5
+ bg_default_secondary_dark: string;
6
+ bg_default_tertiary_light: string;
7
+ bg_default_tertiary_dark: string;
8
+ bg_neutral_tertiary_light: string;
9
+ bg_inverse_primary_light: string;
10
+ bg_disabled_primary_light: string;
11
+ bg_brand_primary: string;
12
+ bg_brand_secondary: string;
13
+ bg_brand_tertiary: string;
14
+ bg_brand_over_light: string;
15
+ bg_brand_over_dark: string;
16
+ bg_green_primary: string;
17
+ bg_green_secondary: string;
18
+ bg_green_tertiary: string;
19
+ bg_green_over_light: string;
20
+ bg_green_over_dark: string;
21
+ bg_yellow_primary: string;
22
+ bg_yellow_secondary: string;
23
+ bg_yellow_tertiary: string;
24
+ bg_yellow_over_light: string;
25
+ bg_yellow_over_dark: string;
26
+ bg_red_primary: string;
27
+ bg_red_secondary: string;
28
+ bg_red_tertiary: string;
29
+ bg_red_over_light: string;
30
+ bg_red_over_dark: string;
31
+ border_default_primary_light: string;
32
+ border_default_primary_dark: string;
33
+ border_default_secondary_light: string;
34
+ border_default_secondary_dark: string;
35
+ border_default_tertiary_light: string;
36
+ border_default_tertiary_dark: string;
37
+ border_neutral_primary_light: string;
38
+ border_neutral_primary_dark: string;
39
+ border_neutral_secondary: string;
40
+ border_neutral_tertiary_light: string;
41
+ border_neutral_tertiary_dark: string;
42
+ border_disabled_primary_light: string;
43
+ border_disabled_primary_dark: string;
44
+ border_disabled_secondary_light: string;
45
+ border_disabled_secondary_dark: string;
46
+ border_disabled_tertiary_light: string;
47
+ border_disabled_tertiary_dark: string;
48
+ border_brand_primary: string;
49
+ border_brand_secondary: string;
50
+ border_brand_tertiary: string;
51
+ border_green_primary: string;
52
+ border_green_secondary: string;
53
+ border_green_tertiary: string;
54
+ border_yellow_primary: string;
55
+ border_yellow_secondary: string;
56
+ border_yellow_tertiary: string;
57
+ border_red_primary: string;
58
+ border_red_secondary: string;
59
+ border_red_tertiary: string;
60
+ icon_default_primary_light: string;
61
+ icon_default_primary_dark: string;
62
+ icon_default_secondary_light: string;
63
+ icon_default_secondary_dark: string;
64
+ icon_default_tertiary_light: string;
65
+ icon_default_tertiary_dark: string;
66
+ icon_neutral_primary_light: string;
67
+ icon_neutral_primary_dark: string;
68
+ icon_neutral_secondary_light: string;
69
+ icon_neutral_secondary_dark: string;
70
+ icon_neutral_tertiary: string;
71
+ icon_inverse_primary_light: string;
72
+ icon_inverse_primary_dark: string;
73
+ icon_inverse_secondary_light: string;
74
+ icon_inverse_secondary_dark: string;
75
+ icon_inverse_tertiary: string;
76
+ icon_disabled_primary_light: string;
77
+ icon_disabled_primary_dark: string;
78
+ icon_disabled_secondary_light: string;
79
+ icon_disabled_secondary_dark: string;
80
+ icon_disabled_tertiary_light: string;
81
+ icon_disabled_tertiary_dark: string;
82
+ icon_brand_primary: string;
83
+ icon_brand_secondary: string;
84
+ icon_brand_tertiary: string;
85
+ icon_brand_over: string;
86
+ icon_green_primary: string;
87
+ icon_green_secondary: string;
88
+ icon_green_tertiary: string;
89
+ icon_yellow_primary: string;
90
+ icon_yellow_secondary: string;
91
+ icon_yellow_tertiary: string;
92
+ icon_red_primary: string;
93
+ icon_red_secondary: string;
94
+ icon_red_tertiary: string;
95
+ text_default_primary_light: string;
96
+ text_default_primary_dark: string;
97
+ text_default_secondary_light: string;
98
+ text_default_secondary_dark: string;
99
+ text_default_tertiary_light: string;
100
+ text_default_tertiary_dark: string;
101
+ text_neutral_primary_light: string;
102
+ text_neutral_primary_dark: string;
103
+ text_neutral_secondary_light: string;
104
+ text_neutral_secondary_dark: string;
105
+ text_neutral_tertiary: string;
106
+ text_inverse_primary_light: string;
107
+ text_inverse_primary_dark: string;
108
+ text_inverse_secondary_light: string;
109
+ text_inverse_secondary_dark: string;
110
+ text_inverse_tertiary: string;
111
+ text_disabled_primary_light: string;
112
+ text_disabled_primary_dark: string;
113
+ text_disabled_secondary_light: string;
114
+ text_disabled_secondary_dark: string;
115
+ text_disabled_tertiary_light: string;
116
+ text_disabled_tertiary_dark: string;
117
+ text_brand_primary: string;
118
+ text_brand_secondary: string;
119
+ text_brand_tertiary: string;
120
+ text_brand_over: string;
121
+ text_green_primary: string;
122
+ text_green_secondary: string;
123
+ text_green_tertiary: string;
124
+ text_yellow_primary: string;
125
+ text_yellow_secondary: string;
126
+ text_yellow_tertiary: string;
127
+ text_red_primary: string;
128
+ text_red_secondary: string;
129
+ text_red_tertiary: string;
130
+ overlay_4: string;
131
+ overlay_20_light: string;
132
+ overlay_20_dark: string;
133
+ overlay_30_light: string;
134
+ overlay_30_dark: string;
135
+ overlay_40_light: string;
136
+ overlay_40_dark: string;
137
+ overlay_60_light: string;
138
+ overlay_60_dark: string;
139
+ overlay_80_light: string;
140
+ overlay_80_dark: string;
141
+ overlay_4_light: string;
142
+ overlay_8_light: string;
143
+ overlay_70_light: string;
144
+ };
145
+ //# sourceMappingURL=Colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Colors.d.ts","sourceRoot":"","sources":["../../../../src/constants/Colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmJlB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const SCREEN_WIDTH: number;
2
+ export declare const SCREEN_HEIGHT: number;
3
+ export declare const space_squish: ({ vertical, horizontal, }: {
4
+ vertical?: number;
5
+ horizontal?: number;
6
+ }) => {
7
+ paddingVertical: number;
8
+ paddingHorizontal: number;
9
+ };
10
+ //# sourceMappingURL=commonStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commonStyles.d.ts","sourceRoot":"","sources":["../../../../src/constants/commonStyles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,EAAE,MAAuC,CAAC;AACnE,eAAO,MAAM,aAAa,EAAE,MAAwC,CAAC;AAErE,eAAO,MAAM,YAAY,GAAI,2BAG1B;IACD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;;;CAKA,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './Colors';
2
+ export * from './commonStyles';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/constants/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
@@ -1,3 +1,4 @@
1
- export declare function multiply(a: number, b: number): number;
2
1
  export * from './components';
2
+ export * from './constants';
3
+ export * from './utils';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD;AACD,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const filterLayoutProps: (props: any) => {
2
+ otherProps: any;
3
+ };
4
+ //# sourceMappingURL=helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../../../src/utils/helper.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,GAAI,OAAO,GAAG;;CAG3C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './helper';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "react-native-shared-components",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "shared-components",
5
- "source": "./src/index.tsx",
6
- "main": "./lib/module/index.js",
5
+ "source": "./src/index.tsx",
6
+ "main": "./src/index.tsx",
7
+ "module": "./src/index.tsx",
7
8
  "types": "./lib/typescript/src/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
@@ -79,7 +80,7 @@
79
80
  "react-native": "0.76.9",
80
81
  "react-native-builder-bob": "^0.40.6",
81
82
  "release-it": "^17.10.0",
82
- "typescript": "^5.2.2"
83
+ "typescript": "^5.9.3"
83
84
  },
84
85
  "peerDependencies": {
85
86
  "react": "*",
@@ -149,5 +150,10 @@
149
150
  "languages": "js",
150
151
  "type": "library",
151
152
  "version": "0.49.8"
153
+ },
154
+ "dependencies": {
155
+ "react-native-iphone-screen-helper": "^2.1.2",
156
+ "react-native-paper": "^5.13.3",
157
+ "react-native-safe-area-context": "^5.4.0"
152
158
  }
153
159
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,225 @@
1
+ import React from 'react';
2
+ import {
3
+ TouchableOpacity,
4
+ ActivityIndicator,
5
+ StyleSheet,
6
+ type ViewStyle,
7
+ type TextStyle,
8
+ type TouchableOpacityProps,
9
+ } from 'react-native';
10
+ import { Colors } from '../../constants/Colors';
11
+ import { BaseText, type BaseTextType } from '../BaseText';
12
+
13
+ export type ButtonVariant = 'primary' | 'link-subtle' | 'red' | 'brand-subtle';
14
+ export type ButtonSize = 'small' | 'regular' | 'large';
15
+ export type ButtonType = 'common' | 'icon';
16
+
17
+ export interface BaseButtonProps extends Omit<TouchableOpacityProps, 'style'> {
18
+ type?: ButtonType;
19
+ variant?: ButtonVariant;
20
+ size?: ButtonSize;
21
+ label?: string;
22
+ icon?: React.ReactNode;
23
+ iconPosition?: 'left' | 'right';
24
+ loading?: boolean;
25
+ style?: ViewStyle;
26
+ textStyle?: TextStyle;
27
+ }
28
+
29
+ export const BaseButton: React.FC<BaseButtonProps> = ({
30
+ type = 'common',
31
+ variant = 'primary',
32
+ size = 'regular',
33
+ label,
34
+ icon,
35
+ iconPosition = 'right',
36
+ loading = false,
37
+ disabled = false,
38
+ style,
39
+ textStyle,
40
+ ...props
41
+ }) => {
42
+ const sizeStyle = styles[`size_${size}`];
43
+ const textSizeStyle = styles[`text_${size}`];
44
+ const variantStyle = disabled
45
+ ? styles.variant_disabled
46
+ : styles[`variant_${variant}`];
47
+ const textVariantStyle = disabled
48
+ ? styles.text_disabled
49
+ : styles[`text_variant_${variant}`];
50
+
51
+ const getTextType = (): BaseTextType => {
52
+ switch (size) {
53
+ case 'small':
54
+ return 'Medium';
55
+ case 'regular':
56
+ return 'SemiBold';
57
+ case 'large':
58
+ return 'Bold';
59
+ default:
60
+ return 'SemiBold';
61
+ }
62
+ };
63
+
64
+ const getTextSize = (): number => {
65
+ switch (size) {
66
+ case 'small':
67
+ return 14;
68
+ case 'regular':
69
+ return 16;
70
+ case 'large':
71
+ return 20;
72
+ default:
73
+ return 16;
74
+ }
75
+ };
76
+
77
+ if (type === 'icon') {
78
+ return (
79
+ <TouchableOpacity
80
+ disabled={disabled || loading}
81
+ activeOpacity={0.7}
82
+ style={[
83
+ styles.baseButton,
84
+ styles.iconButton,
85
+ sizeStyle,
86
+ variantStyle,
87
+ style,
88
+ ]}
89
+ {...props}
90
+ >
91
+ {loading ? (
92
+ <ActivityIndicator
93
+ size="small"
94
+ color={
95
+ disabled
96
+ ? Colors.text_disabled_tertiary_light
97
+ : variant === 'primary' || variant === 'red'
98
+ ? Colors.text_inverse_primary_light
99
+ : Colors.text_brand_primary
100
+ }
101
+ />
102
+ ) : (
103
+ icon
104
+ )}
105
+ </TouchableOpacity>
106
+ );
107
+ }
108
+
109
+ // Common button with text
110
+ return (
111
+ <TouchableOpacity
112
+ disabled={disabled || loading}
113
+ activeOpacity={0.7}
114
+ style={[styles.baseButton, sizeStyle, variantStyle, style]}
115
+ {...props}
116
+ >
117
+ {loading ? (
118
+ <ActivityIndicator
119
+ size="small"
120
+ color={
121
+ disabled
122
+ ? Colors.text_disabled_tertiary_light
123
+ : variant === 'primary' || variant === 'red'
124
+ ? Colors.text_inverse_primary_light
125
+ : Colors.text_brand_primary
126
+ }
127
+ />
128
+ ) : (
129
+ <>
130
+ {icon && iconPosition === 'left' && icon}
131
+ {label && (
132
+ <BaseText
133
+ type={getTextType()}
134
+ size={getTextSize()}
135
+ style={[textSizeStyle, textVariantStyle, textStyle]}
136
+ >
137
+ {label}
138
+ </BaseText>
139
+ )}
140
+ {icon && iconPosition === 'right' && icon}
141
+ </>
142
+ )}
143
+ </TouchableOpacity>
144
+ );
145
+ };
146
+
147
+ const styles = StyleSheet.create({
148
+ 'baseButton': {
149
+ flexDirection: 'row',
150
+ alignItems: 'center',
151
+ justifyContent: 'center',
152
+ borderWidth: 0,
153
+ },
154
+ 'iconButton': {
155
+ aspectRatio: 1,
156
+ },
157
+ 'size_small': {
158
+ height: 32,
159
+ paddingHorizontal: 12,
160
+ paddingVertical: 8,
161
+ borderRadius: 8,
162
+ gap: 6,
163
+ },
164
+ 'size_regular': {
165
+ height: 42,
166
+ paddingHorizontal: 16,
167
+ paddingVertical: 12,
168
+ borderRadius: 10,
169
+ gap: 8,
170
+ },
171
+ 'size_large': {
172
+ height: 60,
173
+ paddingHorizontal: 24,
174
+ paddingVertical: 18,
175
+ borderRadius: 12,
176
+ gap: 12,
177
+ },
178
+
179
+ 'variant_primary': {
180
+ backgroundColor: Colors.bg_brand_primary,
181
+ borderWidth: 0,
182
+ },
183
+ 'variant_red': {
184
+ backgroundColor: Colors.bg_red_primary,
185
+ borderWidth: 0,
186
+ },
187
+ 'variant_link-subtle': {
188
+ backgroundColor: 'transparent',
189
+ borderWidth: 1,
190
+ borderColor: Colors.border_brand_primary,
191
+ },
192
+ 'variant_brand-subtle': {
193
+ backgroundColor: Colors.bg_brand_tertiary,
194
+ borderWidth: 1,
195
+ borderColor: Colors.border_brand_primary,
196
+ },
197
+ 'variant_disabled': {
198
+ backgroundColor: Colors.bg_disabled_primary_light,
199
+ borderWidth: 0,
200
+ },
201
+ 'text_variant_primary': {
202
+ color: Colors.text_inverse_primary_light,
203
+ },
204
+ 'text_variant_red': {
205
+ color: Colors.text_inverse_primary_light,
206
+ },
207
+ 'text_variant_link-subtle': {
208
+ color: Colors.text_brand_primary,
209
+ },
210
+ 'text_variant_brand-subtle': {
211
+ color: Colors.text_brand_primary,
212
+ },
213
+ 'text_disabled': {
214
+ color: Colors.text_disabled_tertiary_light,
215
+ },
216
+ 'text_small': {
217
+ fontSize: 14,
218
+ },
219
+ 'text_regular': {
220
+ fontSize: 16,
221
+ },
222
+ 'text_large': {
223
+ fontSize: 20,
224
+ },
225
+ });
@@ -0,0 +1,108 @@
1
+ import {
2
+ KeyboardAvoidingView,
3
+ Platform,
4
+ StatusBar,
5
+ TouchableOpacity,
6
+ View,
7
+ type ColorValue,
8
+ type TextStyle,
9
+ type ViewStyle,
10
+ type KeyboardAvoidingViewProps,
11
+ } from 'react-native';
12
+ import { type ReactNode } from 'react';
13
+ import { styles } from './styles';
14
+ import { SafeAreaView } from 'react-native-safe-area-context';
15
+ import { BaseText, type BaseTextType } from '../BaseText';
16
+
17
+ export interface IBaseContainer {
18
+ title?: string;
19
+ center?: ReactNode;
20
+ right?: ReactNode;
21
+ left?: ReactNode;
22
+ onPressLeft?: () => void;
23
+ onPressRight?: () => void;
24
+ onPressCenter?: () => void;
25
+ styleTitle?: TextStyle;
26
+ isHeader?: boolean;
27
+ barStyle?: 'default' | 'light-content' | 'dark-content';
28
+ children: ReactNode;
29
+ style?: ViewStyle;
30
+ styleHeader?: ViewStyle;
31
+ backgroundColorStatusBar?: ColorValue | undefined;
32
+ edges?: Array<'top' | 'bottom' | 'left' | 'right'>;
33
+ keyboardAvoidingViewProps?: Omit<KeyboardAvoidingViewProps, 'children'>;
34
+ type?: BaseTextType;
35
+ }
36
+
37
+ export const BaseContainer = ({
38
+ style,
39
+ title,
40
+ left,
41
+ right,
42
+ center,
43
+ onPressLeft,
44
+ onPressRight,
45
+ onPressCenter,
46
+ styleTitle,
47
+ isHeader,
48
+ children,
49
+ backgroundColorStatusBar,
50
+ barStyle,
51
+ styleHeader,
52
+ edges,
53
+ keyboardAvoidingViewProps,
54
+ type = 'Medium',
55
+ }: IBaseContainer) => {
56
+ return (
57
+ <KeyboardAvoidingView
58
+ behavior={Platform.OS === 'ios' ? 'padding' : undefined}
59
+ style={styles.container}
60
+ {...keyboardAvoidingViewProps}
61
+ >
62
+ <View style={styles.container}>
63
+ <StatusBar
64
+ backgroundColor={backgroundColorStatusBar}
65
+ barStyle={barStyle}
66
+ />
67
+ <SafeAreaView style={[styles.safeView, style]} edges={edges}>
68
+ {isHeader && (
69
+ <View style={[styles.header, styleHeader]}>
70
+ {left ? (
71
+ <TouchableOpacity disabled={!onPressLeft} onPress={onPressLeft}>
72
+ {left}
73
+ </TouchableOpacity>
74
+ ) : (
75
+ <View />
76
+ )}
77
+ {center ? (
78
+ <TouchableOpacity
79
+ disabled={!onPressCenter}
80
+ onPress={onPressCenter}
81
+ >
82
+ {center}
83
+ </TouchableOpacity>
84
+ ) : title ? (
85
+ <BaseText type={type} style={styleTitle}>
86
+ {title}
87
+ </BaseText>
88
+ ) : (
89
+ <View />
90
+ )}
91
+ {right ? (
92
+ <TouchableOpacity
93
+ disabled={!onPressRight}
94
+ onPress={onPressRight}
95
+ >
96
+ {right}
97
+ </TouchableOpacity>
98
+ ) : (
99
+ <View />
100
+ )}
101
+ </View>
102
+ )}
103
+ {children}
104
+ </SafeAreaView>
105
+ </View>
106
+ </KeyboardAvoidingView>
107
+ );
108
+ };