@nexara/nativeflow 0.1.8 → 0.1.9

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 (269) hide show
  1. package/lib/commonjs/assets/svg/Check.js.map +1 -1
  2. package/lib/commonjs/assets/svg/X.js.map +1 -1
  3. package/lib/commonjs/assets/svg/index.js.map +1 -1
  4. package/lib/commonjs/components/Avatar/AvatarImage.js.map +1 -1
  5. package/lib/commonjs/components/Avatar/AvatarText.js.map +1 -1
  6. package/lib/commonjs/components/Avatar/index.js.map +1 -1
  7. package/lib/commonjs/components/Button/Button.js.map +1 -1
  8. package/lib/commonjs/components/Button/utils.js.map +1 -1
  9. package/lib/commonjs/components/CheckBox/CheckBox.js.map +1 -1
  10. package/lib/commonjs/components/Chip/Chip.js.map +1 -1
  11. package/lib/commonjs/components/Chip/utils.js.map +1 -1
  12. package/lib/commonjs/components/Dialog/Dialog.js.map +1 -1
  13. package/lib/commonjs/components/Dialog/DialogBody.js.map +1 -1
  14. package/lib/commonjs/components/Dialog/DialogDescription.js.map +1 -1
  15. package/lib/commonjs/components/Dialog/DialogFoot.js.map +1 -1
  16. package/lib/commonjs/components/Dialog/DialogHead.js.map +1 -1
  17. package/lib/commonjs/components/Dialog/index.js.map +1 -1
  18. package/lib/commonjs/components/Divider/Divider.js.map +1 -1
  19. package/lib/commonjs/components/Grid/Grid.js.map +1 -1
  20. package/lib/commonjs/components/Icon/Icon.js.map +1 -1
  21. package/lib/commonjs/components/IconButton/IconButton.js.map +1 -1
  22. package/lib/commonjs/components/Link/Link.js.map +1 -1
  23. package/lib/commonjs/components/Menu/Menu.js.map +1 -1
  24. package/lib/commonjs/components/Menu/MenuItem.js.map +1 -1
  25. package/lib/commonjs/components/Menu/MenuItemLabel.js.map +1 -1
  26. package/lib/commonjs/components/Menu/calculations.js.map +1 -1
  27. package/lib/commonjs/components/Menu/index.js.map +1 -1
  28. package/lib/commonjs/components/Portal/Portal.js.map +1 -1
  29. package/lib/commonjs/components/Portal/PortalContext.js.map +1 -1
  30. package/lib/commonjs/components/Portal/PortalProvider.js.map +1 -1
  31. package/lib/commonjs/components/Progress/Progress.js.map +1 -1
  32. package/lib/commonjs/components/Provider/ContextManager.js.map +1 -1
  33. package/lib/commonjs/components/Provider/NativeProvider.js.map +1 -1
  34. package/lib/commonjs/components/Radio/RadioGroup.js.map +1 -1
  35. package/lib/commonjs/components/Radio/RadioItem.js.map +1 -1
  36. package/lib/commonjs/components/Radio/index.js.map +1 -1
  37. package/lib/commonjs/components/Slider/Slider.js.map +1 -1
  38. package/lib/commonjs/components/Stack/HStack.js.map +1 -1
  39. package/lib/commonjs/components/Stack/VStack.js.map +1 -1
  40. package/lib/commonjs/components/Stack/index.js.map +1 -1
  41. package/lib/commonjs/components/StyledComponents/StyledText.js.map +1 -1
  42. package/lib/commonjs/components/StyledComponents/StyledView.js.map +1 -1
  43. package/lib/commonjs/components/StyledComponents/index.js.map +1 -1
  44. package/lib/commonjs/components/Surface/Surface.js.map +1 -1
  45. package/lib/commonjs/components/Switch/Switch.js.map +1 -1
  46. package/lib/commonjs/components/TouchableRipple/TouchableRipple.js.map +1 -1
  47. package/lib/commonjs/components/UserInput/UserInput.js.map +1 -1
  48. package/lib/commonjs/components/UserInput/UserInputV2.js.map +1 -1
  49. package/lib/commonjs/components/UserInput/generateColors.js.map +1 -1
  50. package/lib/commonjs/constants/breakPoints.js.map +1 -1
  51. package/lib/commonjs/constants/dialogSizes.js.map +1 -1
  52. package/lib/commonjs/constants/index.js.map +1 -1
  53. package/lib/commonjs/constants/theme.js.map +1 -1
  54. package/lib/commonjs/constants/typographySizes.js.map +1 -1
  55. package/lib/commonjs/helpers/CalculateGridSize.js +1 -1
  56. package/lib/commonjs/helpers/CalculateGridSize.js.map +1 -1
  57. package/lib/commonjs/helpers/DeviceSizeCategory.js.map +1 -1
  58. package/lib/commonjs/helpers/ResponsiveCalculations.js +4 -1
  59. package/lib/commonjs/helpers/ResponsiveCalculations.js.map +1 -1
  60. package/lib/commonjs/helpers/index.js.map +1 -1
  61. package/lib/commonjs/hooks/index.js.map +1 -1
  62. package/lib/commonjs/hooks/useColorScheme.js.map +1 -1
  63. package/lib/commonjs/hooks/useConditionalWindowDimension.js.map +1 -1
  64. package/lib/commonjs/hooks/useScalingMode.js.map +1 -1
  65. package/lib/commonjs/hooks/useTheme.js.map +1 -1
  66. package/lib/commonjs/index.d.js.map +1 -1
  67. package/lib/commonjs/index.js.map +1 -1
  68. package/lib/commonjs/themes/DarkTheme.js.map +1 -1
  69. package/lib/commonjs/themes/LightTheme.js.map +1 -1
  70. package/lib/commonjs/themes/index.js.map +1 -1
  71. package/lib/commonjs/types/avatar.type.js.map +1 -1
  72. package/lib/commonjs/types/button.type.js.map +1 -1
  73. package/lib/commonjs/types/checkbox.type.js.map +1 -1
  74. package/lib/commonjs/types/chip.type.js.map +1 -1
  75. package/lib/commonjs/types/common.type.js.map +1 -1
  76. package/lib/commonjs/types/dialog.type.js.map +1 -1
  77. package/lib/commonjs/types/divider.type.js.map +1 -1
  78. package/lib/commonjs/types/grid.type.js.map +1 -1
  79. package/lib/commonjs/types/index.js.map +1 -1
  80. package/lib/commonjs/types/link.type.js.map +1 -1
  81. package/lib/commonjs/types/menu.type.js.map +1 -1
  82. package/lib/commonjs/types/progress.type.js.map +1 -1
  83. package/lib/commonjs/types/radio.type.js.map +1 -1
  84. package/lib/commonjs/types/stack.type.js.map +1 -1
  85. package/lib/commonjs/types/styledComponents.type.js.map +1 -1
  86. package/lib/commonjs/types/surface.type.js.map +1 -1
  87. package/lib/commonjs/types/switch.type.js.map +1 -1
  88. package/lib/commonjs/types/userInput.type.js.map +1 -1
  89. package/lib/commonjs/utils/index.js.map +1 -1
  90. package/lib/module/assets/svg/Check.js.map +1 -1
  91. package/lib/module/assets/svg/X.js.map +1 -1
  92. package/lib/module/assets/svg/index.js.map +1 -1
  93. package/lib/module/components/Avatar/AvatarImage.js.map +1 -1
  94. package/lib/module/components/Avatar/AvatarText.js.map +1 -1
  95. package/lib/module/components/Avatar/index.js.map +1 -1
  96. package/lib/module/components/Button/Button.js.map +1 -1
  97. package/lib/module/components/Button/utils.js.map +1 -1
  98. package/lib/module/components/CheckBox/CheckBox.js.map +1 -1
  99. package/lib/module/components/Chip/Chip.js.map +1 -1
  100. package/lib/module/components/Chip/utils.js.map +1 -1
  101. package/lib/module/components/Dialog/Dialog.js.map +1 -1
  102. package/lib/module/components/Dialog/DialogBody.js.map +1 -1
  103. package/lib/module/components/Dialog/DialogDescription.js.map +1 -1
  104. package/lib/module/components/Dialog/DialogFoot.js.map +1 -1
  105. package/lib/module/components/Dialog/DialogHead.js.map +1 -1
  106. package/lib/module/components/Dialog/index.js.map +1 -1
  107. package/lib/module/components/Divider/Divider.js.map +1 -1
  108. package/lib/module/components/Grid/Grid.js.map +1 -1
  109. package/lib/module/components/Icon/Icon.js.map +1 -1
  110. package/lib/module/components/IconButton/IconButton.js.map +1 -1
  111. package/lib/module/components/Link/Link.js.map +1 -1
  112. package/lib/module/components/Menu/Menu.js.map +1 -1
  113. package/lib/module/components/Menu/MenuItem.js.map +1 -1
  114. package/lib/module/components/Menu/MenuItemLabel.js.map +1 -1
  115. package/lib/module/components/Menu/calculations.js.map +1 -1
  116. package/lib/module/components/Menu/index.js.map +1 -1
  117. package/lib/module/components/Portal/Portal.js.map +1 -1
  118. package/lib/module/components/Portal/PortalContext.js.map +1 -1
  119. package/lib/module/components/Portal/PortalProvider.js.map +1 -1
  120. package/lib/module/components/Progress/Progress.js.map +1 -1
  121. package/lib/module/components/Provider/ContextManager.js.map +1 -1
  122. package/lib/module/components/Provider/NativeProvider.js.map +1 -1
  123. package/lib/module/components/Radio/RadioGroup.js.map +1 -1
  124. package/lib/module/components/Radio/RadioItem.js.map +1 -1
  125. package/lib/module/components/Radio/index.js.map +1 -1
  126. package/lib/module/components/Slider/Slider.js.map +1 -1
  127. package/lib/module/components/Stack/HStack.js.map +1 -1
  128. package/lib/module/components/Stack/VStack.js.map +1 -1
  129. package/lib/module/components/Stack/index.js.map +1 -1
  130. package/lib/module/components/StyledComponents/StyledText.js.map +1 -1
  131. package/lib/module/components/StyledComponents/StyledView.js.map +1 -1
  132. package/lib/module/components/StyledComponents/index.js.map +1 -1
  133. package/lib/module/components/Surface/Surface.js.map +1 -1
  134. package/lib/module/components/Switch/Switch.js.map +1 -1
  135. package/lib/module/components/TouchableRipple/TouchableRipple.js.map +1 -1
  136. package/lib/module/components/UserInput/UserInput.js.map +1 -1
  137. package/lib/module/components/UserInput/UserInputV2.js.map +1 -1
  138. package/lib/module/components/UserInput/generateColors.js.map +1 -1
  139. package/lib/module/constants/breakPoints.js.map +1 -1
  140. package/lib/module/constants/dialogSizes.js.map +1 -1
  141. package/lib/module/constants/index.js.map +1 -1
  142. package/lib/module/constants/theme.js.map +1 -1
  143. package/lib/module/constants/typographySizes.js.map +1 -1
  144. package/lib/module/helpers/CalculateGridSize.js +1 -1
  145. package/lib/module/helpers/CalculateGridSize.js.map +1 -1
  146. package/lib/module/helpers/DeviceSizeCategory.js.map +1 -1
  147. package/lib/module/helpers/ResponsiveCalculations.js +4 -1
  148. package/lib/module/helpers/ResponsiveCalculations.js.map +1 -1
  149. package/lib/module/helpers/index.js.map +1 -1
  150. package/lib/module/hooks/index.js.map +1 -1
  151. package/lib/module/hooks/useColorScheme.js.map +1 -1
  152. package/lib/module/hooks/useConditionalWindowDimension.js.map +1 -1
  153. package/lib/module/hooks/useScalingMode.js.map +1 -1
  154. package/lib/module/hooks/useTheme.js.map +1 -1
  155. package/lib/module/index.d.js.map +1 -1
  156. package/lib/module/index.js.map +1 -1
  157. package/lib/module/themes/DarkTheme.js.map +1 -1
  158. package/lib/module/themes/LightTheme.js.map +1 -1
  159. package/lib/module/themes/index.js.map +1 -1
  160. package/lib/module/types/avatar.type.js.map +1 -1
  161. package/lib/module/types/button.type.js.map +1 -1
  162. package/lib/module/types/checkbox.type.js.map +1 -1
  163. package/lib/module/types/chip.type.js.map +1 -1
  164. package/lib/module/types/common.type.js.map +1 -1
  165. package/lib/module/types/dialog.type.js.map +1 -1
  166. package/lib/module/types/divider.type.js.map +1 -1
  167. package/lib/module/types/grid.type.js.map +1 -1
  168. package/lib/module/types/index.js.map +1 -1
  169. package/lib/module/types/link.type.js.map +1 -1
  170. package/lib/module/types/menu.type.js.map +1 -1
  171. package/lib/module/types/progress.type.js.map +1 -1
  172. package/lib/module/types/radio.type.js.map +1 -1
  173. package/lib/module/types/stack.type.js.map +1 -1
  174. package/lib/module/types/styledComponents.type.js.map +1 -1
  175. package/lib/module/types/surface.type.js.map +1 -1
  176. package/lib/module/types/switch.type.js.map +1 -1
  177. package/lib/module/types/userInput.type.js.map +1 -1
  178. package/lib/module/utils/index.js.map +1 -1
  179. package/lib/typescript/commonjs/src/components/UserInput/UserInput.d.ts.map +1 -1
  180. package/lib/typescript/commonjs/src/helpers/ResponsiveCalculations.d.ts.map +1 -1
  181. package/lib/typescript/module/src/components/UserInput/UserInput.d.ts.map +1 -1
  182. package/lib/typescript/module/src/helpers/ResponsiveCalculations.d.ts.map +1 -1
  183. package/package.json +2 -2
  184. package/src/assets/svg/Check.tsx +16 -16
  185. package/src/assets/svg/X.tsx +15 -15
  186. package/src/assets/svg/index.ts +1 -1
  187. package/src/components/Avatar/AvatarImage.tsx +33 -33
  188. package/src/components/Avatar/AvatarText.tsx +34 -34
  189. package/src/components/Avatar/index.ts +8 -8
  190. package/src/components/Button/Button.tsx +205 -205
  191. package/src/components/Button/utils.ts +141 -141
  192. package/src/components/CheckBox/CheckBox.tsx +118 -118
  193. package/src/components/Chip/Chip.tsx +82 -82
  194. package/src/components/Chip/utils.ts +109 -109
  195. package/src/components/Dialog/Dialog.tsx +124 -124
  196. package/src/components/Dialog/DialogBody.tsx +31 -31
  197. package/src/components/Dialog/DialogDescription.tsx +27 -27
  198. package/src/components/Dialog/DialogFoot.tsx +35 -35
  199. package/src/components/Dialog/DialogHead.tsx +50 -50
  200. package/src/components/Dialog/index.ts +10 -10
  201. package/src/components/Divider/Divider.tsx +22 -22
  202. package/src/components/Grid/Grid.tsx +61 -61
  203. package/src/components/Icon/Icon.tsx +31 -31
  204. package/src/components/IconButton/IconButton.tsx +44 -44
  205. package/src/components/Link/Link.tsx +38 -38
  206. package/src/components/Menu/Menu.tsx +142 -142
  207. package/src/components/Menu/MenuItem.tsx +33 -33
  208. package/src/components/Menu/MenuItemLabel.tsx +21 -21
  209. package/src/components/Menu/calculations.ts +33 -33
  210. package/src/components/Menu/index.ts +7 -7
  211. package/src/components/Portal/Portal.tsx +18 -18
  212. package/src/components/Portal/PortalContext.tsx +9 -9
  213. package/src/components/Portal/PortalProvider.tsx +36 -36
  214. package/src/components/Progress/Progress.tsx +66 -66
  215. package/src/components/Provider/ContextManager.tsx +8 -8
  216. package/src/components/Provider/NativeProvider.tsx +72 -72
  217. package/src/components/Radio/RadioGroup.tsx +39 -39
  218. package/src/components/Radio/RadioItem.tsx +72 -72
  219. package/src/components/Radio/index.ts +8 -8
  220. package/src/components/Slider/Slider.tsx +45 -45
  221. package/src/components/Stack/HStack.tsx +32 -32
  222. package/src/components/Stack/VStack.tsx +26 -26
  223. package/src/components/Stack/index.ts +8 -8
  224. package/src/components/StyledComponents/StyledText.tsx +49 -49
  225. package/src/components/StyledComponents/StyledView.tsx +44 -44
  226. package/src/components/StyledComponents/index.tsx +5 -5
  227. package/src/components/Surface/Surface.tsx +31 -31
  228. package/src/components/Switch/Switch.tsx +36 -36
  229. package/src/components/TouchableRipple/TouchableRipple.tsx +92 -92
  230. package/src/components/UserInput/UserInput.tsx +135 -135
  231. package/src/components/UserInput/UserInputV2.tsx +132 -132
  232. package/src/components/UserInput/generateColors.ts +13 -13
  233. package/src/constants/breakPoints.ts +17 -17
  234. package/src/constants/dialogSizes.ts +11 -11
  235. package/src/constants/index.ts +2 -2
  236. package/src/constants/theme.ts +32 -32
  237. package/src/constants/typographySizes.ts +19 -19
  238. package/src/helpers/CalculateGridSize.ts +25 -25
  239. package/src/helpers/DeviceSizeCategory.ts +21 -21
  240. package/src/helpers/ResponsiveCalculations.ts +107 -104
  241. package/src/helpers/index.ts +2 -2
  242. package/src/hooks/index.ts +3 -3
  243. package/src/hooks/useColorScheme.tsx +11 -11
  244. package/src/hooks/useConditionalWindowDimension.tsx +7 -7
  245. package/src/hooks/useScalingMode.tsx +6 -6
  246. package/src/hooks/useTheme.tsx +12 -12
  247. package/src/index.d.ts +2 -2
  248. package/src/index.ts +52 -52
  249. package/src/themes/DarkTheme.ts +177 -177
  250. package/src/themes/LightTheme.ts +88 -88
  251. package/src/themes/index.ts +3 -3
  252. package/src/types/avatar.type.ts +40 -40
  253. package/src/types/button.type.ts +76 -76
  254. package/src/types/checkbox.type.ts +64 -64
  255. package/src/types/chip.type.ts +65 -65
  256. package/src/types/common.type.ts +109 -109
  257. package/src/types/dialog.type.ts +89 -89
  258. package/src/types/divider.type.ts +15 -15
  259. package/src/types/grid.type.ts +71 -71
  260. package/src/types/index.ts +16 -16
  261. package/src/types/link.type.ts +14 -14
  262. package/src/types/menu.type.ts +100 -100
  263. package/src/types/progress.type.ts +15 -15
  264. package/src/types/radio.type.ts +78 -78
  265. package/src/types/stack.type.ts +46 -46
  266. package/src/types/styledComponents.type.ts +70 -70
  267. package/src/types/surface.type.ts +19 -19
  268. package/src/types/switch.type.ts +39 -39
  269. package/src/types/userInput.type.ts +98 -98
@@ -1,142 +1,142 @@
1
- import type { ButtonVariant, ThemeTypes } from "../../types";
2
-
3
-
4
- const getButtonBorderColor = ({
5
- theme,
6
- strokeColor,
7
- disabled
8
- }: {
9
- theme: ThemeTypes;
10
- strokeColor: string | undefined;
11
- disabled: boolean;
12
- }) => {
13
- if (disabled) {
14
- return theme.colors.border.default;
15
- }
16
- if (strokeColor) {
17
- return strokeColor
18
- }
19
- return theme.colors.border.default;
20
- };
21
-
22
-
23
- const getButtonTextColor = ({
24
- theme,
25
- checkVariant,
26
- titleColor,
27
- disabled
28
- }: {
29
- theme: ThemeTypes;
30
- checkVariant: (variant: ButtonVariant) => boolean;
31
- titleColor: string | undefined;
32
- disabled: boolean;
33
- }) => {
34
-
35
- if (disabled) {
36
- return theme.colors.typography.disabled;
37
- }
38
- else if (titleColor) {
39
- return titleColor
40
- }
41
- else if (checkVariant('outlined')) {
42
- return theme.colors.typography.primary;
43
- }
44
- return theme.colors.brand.onPrimary;
45
- };
46
-
47
- const getButtonBackgroundColor = ({
48
- theme,
49
- checkVariant,
50
- bg,
51
- disabled
52
- }: {
53
- theme: ThemeTypes;
54
- checkVariant: (variant: ButtonVariant) => boolean;
55
- bg: string | undefined;
56
- disabled: boolean;
57
- }) => {
58
-
59
- if (disabled) {
60
- return theme.colors.states.disabled;
61
- }
62
- else if (bg) {
63
- return bg
64
- }
65
- else if (checkVariant('contained')) {
66
- return theme.colors.brand.primary;
67
- }
68
- else if (checkVariant('outlined')) {
69
- return 'transparent';
70
- }
71
- return theme.colors.brand.primary;
72
- };
73
-
74
-
75
- // const getButtonIconColor = ({
76
- // theme,
77
- // checkVariant,
78
- // disabled,
79
- // }: {
80
- // theme: ThemeTypes;
81
- // checkVariant: (variant: ButtonVariant) => boolean;
82
- // disabled: boolean;
83
- // }) => {
84
- // if (disabled) {
85
- // return theme.colors.iconDisable;
86
- // } else if (checkVariant('outlined')) {
87
- // return theme.colors.iconPrimary
88
- // }
89
- // return theme.colors.iconSecondary;
90
- // };
91
-
92
- const getButtonColors = ({
93
- theme,
94
- variant,
95
- bg,
96
- titleColor,
97
- strokeColor,
98
- disabled
99
- }: {
100
- theme: ThemeTypes;
101
- variant: ButtonVariant;
102
- bg: string | undefined;
103
- titleColor: string | undefined;
104
- strokeColor: string | undefined;
105
- disabled: boolean;
106
- }) => {
107
-
108
- const checkVariant = (variantToCompare: ButtonVariant) => {
109
- return variant === variantToCompare;
110
- };
111
- const backgroundColor = getButtonBackgroundColor({
112
- theme,
113
- checkVariant,
114
- bg,
115
- disabled
116
- });
117
- const buttonTextColor = getButtonTextColor({
118
- theme,
119
- checkVariant,
120
- titleColor,
121
- disabled
122
- });
123
- const buttonBorderColor = getButtonBorderColor({
124
- theme,
125
- strokeColor,
126
- disabled
127
- });
128
- // const buttonIconColor = getButtonIconColor({
129
- // checkVariant,
130
- // theme,
131
- // disabled
132
- // });
133
-
134
- return {
135
- backgroundColor,
136
- buttonTextColor,
137
- buttonBorderColor,
138
- // buttonIconColor
139
- }
140
- };
141
-
1
+ import type { ButtonVariant, ThemeTypes } from "../../types";
2
+
3
+
4
+ const getButtonBorderColor = ({
5
+ theme,
6
+ strokeColor,
7
+ disabled
8
+ }: {
9
+ theme: ThemeTypes;
10
+ strokeColor: string | undefined;
11
+ disabled: boolean;
12
+ }) => {
13
+ if (disabled) {
14
+ return theme.colors.border.default;
15
+ }
16
+ if (strokeColor) {
17
+ return strokeColor
18
+ }
19
+ return theme.colors.border.default;
20
+ };
21
+
22
+
23
+ const getButtonTextColor = ({
24
+ theme,
25
+ checkVariant,
26
+ titleColor,
27
+ disabled
28
+ }: {
29
+ theme: ThemeTypes;
30
+ checkVariant: (variant: ButtonVariant) => boolean;
31
+ titleColor: string | undefined;
32
+ disabled: boolean;
33
+ }) => {
34
+
35
+ if (disabled) {
36
+ return theme.colors.typography.disabled;
37
+ }
38
+ else if (titleColor) {
39
+ return titleColor
40
+ }
41
+ else if (checkVariant('outlined')) {
42
+ return theme.colors.typography.primary;
43
+ }
44
+ return theme.colors.brand.onPrimary;
45
+ };
46
+
47
+ const getButtonBackgroundColor = ({
48
+ theme,
49
+ checkVariant,
50
+ bg,
51
+ disabled
52
+ }: {
53
+ theme: ThemeTypes;
54
+ checkVariant: (variant: ButtonVariant) => boolean;
55
+ bg: string | undefined;
56
+ disabled: boolean;
57
+ }) => {
58
+
59
+ if (disabled) {
60
+ return theme.colors.states.disabled;
61
+ }
62
+ else if (bg) {
63
+ return bg
64
+ }
65
+ else if (checkVariant('contained')) {
66
+ return theme.colors.brand.primary;
67
+ }
68
+ else if (checkVariant('outlined')) {
69
+ return 'transparent';
70
+ }
71
+ return theme.colors.brand.primary;
72
+ };
73
+
74
+
75
+ // const getButtonIconColor = ({
76
+ // theme,
77
+ // checkVariant,
78
+ // disabled,
79
+ // }: {
80
+ // theme: ThemeTypes;
81
+ // checkVariant: (variant: ButtonVariant) => boolean;
82
+ // disabled: boolean;
83
+ // }) => {
84
+ // if (disabled) {
85
+ // return theme.colors.iconDisable;
86
+ // } else if (checkVariant('outlined')) {
87
+ // return theme.colors.iconPrimary
88
+ // }
89
+ // return theme.colors.iconSecondary;
90
+ // };
91
+
92
+ const getButtonColors = ({
93
+ theme,
94
+ variant,
95
+ bg,
96
+ titleColor,
97
+ strokeColor,
98
+ disabled
99
+ }: {
100
+ theme: ThemeTypes;
101
+ variant: ButtonVariant;
102
+ bg: string | undefined;
103
+ titleColor: string | undefined;
104
+ strokeColor: string | undefined;
105
+ disabled: boolean;
106
+ }) => {
107
+
108
+ const checkVariant = (variantToCompare: ButtonVariant) => {
109
+ return variant === variantToCompare;
110
+ };
111
+ const backgroundColor = getButtonBackgroundColor({
112
+ theme,
113
+ checkVariant,
114
+ bg,
115
+ disabled
116
+ });
117
+ const buttonTextColor = getButtonTextColor({
118
+ theme,
119
+ checkVariant,
120
+ titleColor,
121
+ disabled
122
+ });
123
+ const buttonBorderColor = getButtonBorderColor({
124
+ theme,
125
+ strokeColor,
126
+ disabled
127
+ });
128
+ // const buttonIconColor = getButtonIconColor({
129
+ // checkVariant,
130
+ // theme,
131
+ // disabled
132
+ // });
133
+
134
+ return {
135
+ backgroundColor,
136
+ buttonTextColor,
137
+ buttonBorderColor,
138
+ // buttonIconColor
139
+ }
140
+ };
141
+
142
142
  export { getButtonColors };
@@ -1,118 +1,118 @@
1
- import { useEffect, useMemo, useRef, useState, type FC } from "react";
2
- import { StyleSheet, TouchableWithoutFeedback, Animated, type ViewStyle } from "react-native";
3
- import { StyledText, StyledView } from "../StyledComponents";
4
- import { useTheme } from "../../hooks";
5
- import { horizontalScale, verticalScale } from "../../helpers";
6
- import { Check } from "../../assets/svg";
7
- import type { CheckBoxProps } from "../../types";
8
-
9
-
10
- const CheckBox: FC<CheckBoxProps> = ({
11
- variant = 'square',
12
- isChecked = false,
13
- defaultValue = false,
14
- activeBgColor,
15
- inActiveBgColor = 'transparent',
16
- iconColor,
17
- disableBuiltInState = false,
18
- disabled = false,
19
- label = 'Checkbox',
20
- fScale = 'xs',
21
- fs,
22
- ff,
23
- // size = 22,
24
- size = 20,
25
- iconSize,
26
- containerStyle,
27
- labelStyle,
28
- checkBoxStyle,
29
- onPress,
30
- }) => {
31
- const [isCheckboxChecked, setIsCheckboxChecked] = useState<boolean>(defaultValue);
32
-
33
- useEffect(() => {
34
- setIsCheckboxChecked(defaultValue);
35
- }, [defaultValue]);
36
-
37
- const STYLES = useMemo(Styles, []);
38
-
39
- const scaleVal = useRef(new Animated.Value(1)).current;
40
- const { colors }: any = useTheme();
41
- activeBgColor = disabled ? colors.states.disabled : activeBgColor ?? colors.brand.primary;
42
- iconSize = iconSize ?? size / 1.5;
43
- const bgColor = (!disableBuiltInState && isCheckboxChecked) || (disableBuiltInState && isChecked) ? activeBgColor : inActiveBgColor;
44
- const textColor = disabled ? colors.typography.disabled : colors.typography.primary;
45
-
46
- const dynamicMainContStyles: ViewStyle = {
47
- height: verticalScale(size),
48
- width: verticalScale(size),
49
- borderColor: disabled ? colors.border.default : activeBgColor,
50
- borderRadius: verticalScale(variant === 'square' ? 5 : size),
51
- backgroundColor: bgColor
52
- };
53
-
54
- const animatedStyle = {
55
- transform: [{ scale: scaleVal }]
56
- };
57
-
58
- const animateScale = (toValue: number) => {
59
- Animated.spring(scaleVal, {
60
- toValue,
61
- speed: 20,
62
- bounciness: 8,
63
- useNativeDriver: true,
64
- }).start();
65
- };
66
- const onUserClick = () => {
67
- if (!disableBuiltInState) {
68
- onPress?.(!isCheckboxChecked);
69
- setIsCheckboxChecked(!isCheckboxChecked);
70
- } else {
71
- onPress?.(!isChecked);
72
- }
73
- };
74
- return (
75
- // <StyledView>
76
- <StyledView style={[STYLES.CONTAINER, containerStyle]}>
77
-
78
- <TouchableWithoutFeedback
79
- onPressIn={() => animateScale(0.8)}
80
- onPressOut={() => animateScale(1)}
81
- onPress={onUserClick}
82
- disabled={disabled}
83
- >
84
- <Animated.View style={[STYLES.CHECKBOX_PARENT_CONT, dynamicMainContStyles, checkBoxStyle, animatedStyle]}>
85
- {
86
- (disableBuiltInState ? isChecked : isCheckboxChecked) &&
87
- <Check
88
- color={disabled ? colors.states.disabled : iconColor ?? colors.brand.onPrimary}
89
- size={verticalScale(iconSize)}
90
- />
91
- }
92
- </Animated.View>
93
- </TouchableWithoutFeedback>
94
- {
95
- label &&
96
- <StyledText style={labelStyle} fs={fs} ff={ff} color={textColor} fScale={fScale}>{label}</StyledText>
97
- }
98
-
99
- </StyledView>
100
- // </StyledView>
101
- )
102
- }
103
- export default CheckBox;
104
- export type { CheckBoxProps };
105
-
106
- const Styles = () => StyleSheet.create({
107
- CONTAINER: {
108
- flexDirection: 'row',
109
- gap: horizontalScale(10),
110
- alignItems: 'center',
111
- },
112
- CHECKBOX_PARENT_CONT: {
113
- borderWidth: 0.8,
114
- alignItems: 'center',
115
- justifyContent: 'center',
116
- padding: horizontalScale(7)
117
- }
118
- });
1
+ import { useEffect, useMemo, useRef, useState, type FC } from "react";
2
+ import { StyleSheet, TouchableWithoutFeedback, Animated, type ViewStyle } from "react-native";
3
+ import { StyledText, StyledView } from "../StyledComponents";
4
+ import { useTheme } from "../../hooks";
5
+ import { horizontalScale, verticalScale } from "../../helpers";
6
+ import { Check } from "../../assets/svg";
7
+ import type { CheckBoxProps } from "../../types";
8
+
9
+
10
+ const CheckBox: FC<CheckBoxProps> = ({
11
+ variant = 'square',
12
+ isChecked = false,
13
+ defaultValue = false,
14
+ activeBgColor,
15
+ inActiveBgColor = 'transparent',
16
+ iconColor,
17
+ disableBuiltInState = false,
18
+ disabled = false,
19
+ label = 'Checkbox',
20
+ fScale = 'xs',
21
+ fs,
22
+ ff,
23
+ // size = 22,
24
+ size = 20,
25
+ iconSize,
26
+ containerStyle,
27
+ labelStyle,
28
+ checkBoxStyle,
29
+ onPress,
30
+ }) => {
31
+ const [isCheckboxChecked, setIsCheckboxChecked] = useState<boolean>(defaultValue);
32
+
33
+ useEffect(() => {
34
+ setIsCheckboxChecked(defaultValue);
35
+ }, [defaultValue]);
36
+
37
+ const STYLES = useMemo(Styles, []);
38
+
39
+ const scaleVal = useRef(new Animated.Value(1)).current;
40
+ const { colors }: any = useTheme();
41
+ activeBgColor = disabled ? colors.states.disabled : activeBgColor ?? colors.brand.primary;
42
+ iconSize = iconSize ?? size / 1.5;
43
+ const bgColor = (!disableBuiltInState && isCheckboxChecked) || (disableBuiltInState && isChecked) ? activeBgColor : inActiveBgColor;
44
+ const textColor = disabled ? colors.typography.disabled : colors.typography.primary;
45
+
46
+ const dynamicMainContStyles: ViewStyle = {
47
+ height: verticalScale(size),
48
+ width: verticalScale(size),
49
+ borderColor: disabled ? colors.border.default : activeBgColor,
50
+ borderRadius: verticalScale(variant === 'square' ? 5 : size),
51
+ backgroundColor: bgColor
52
+ };
53
+
54
+ const animatedStyle = {
55
+ transform: [{ scale: scaleVal }]
56
+ };
57
+
58
+ const animateScale = (toValue: number) => {
59
+ Animated.spring(scaleVal, {
60
+ toValue,
61
+ speed: 20,
62
+ bounciness: 8,
63
+ useNativeDriver: true,
64
+ }).start();
65
+ };
66
+ const onUserClick = () => {
67
+ if (!disableBuiltInState) {
68
+ onPress?.(!isCheckboxChecked);
69
+ setIsCheckboxChecked(!isCheckboxChecked);
70
+ } else {
71
+ onPress?.(!isChecked);
72
+ }
73
+ };
74
+ return (
75
+ // <StyledView>
76
+ <StyledView style={[STYLES.CONTAINER, containerStyle]}>
77
+
78
+ <TouchableWithoutFeedback
79
+ onPressIn={() => animateScale(0.8)}
80
+ onPressOut={() => animateScale(1)}
81
+ onPress={onUserClick}
82
+ disabled={disabled}
83
+ >
84
+ <Animated.View style={[STYLES.CHECKBOX_PARENT_CONT, dynamicMainContStyles, checkBoxStyle, animatedStyle]}>
85
+ {
86
+ (disableBuiltInState ? isChecked : isCheckboxChecked) &&
87
+ <Check
88
+ color={disabled ? colors.states.disabled : iconColor ?? colors.brand.onPrimary}
89
+ size={verticalScale(iconSize)}
90
+ />
91
+ }
92
+ </Animated.View>
93
+ </TouchableWithoutFeedback>
94
+ {
95
+ label &&
96
+ <StyledText style={labelStyle} fs={fs} ff={ff} color={textColor} fScale={fScale}>{label}</StyledText>
97
+ }
98
+
99
+ </StyledView>
100
+ // </StyledView>
101
+ )
102
+ }
103
+ export default CheckBox;
104
+ export type { CheckBoxProps };
105
+
106
+ const Styles = () => StyleSheet.create({
107
+ CONTAINER: {
108
+ flexDirection: 'row',
109
+ gap: horizontalScale(10),
110
+ alignItems: 'center',
111
+ },
112
+ CHECKBOX_PARENT_CONT: {
113
+ borderWidth: 0.8,
114
+ alignItems: 'center',
115
+ justifyContent: 'center',
116
+ padding: horizontalScale(7)
117
+ }
118
+ });
@@ -1,82 +1,82 @@
1
- import React, { type FC } from 'react';
2
- import { StyleSheet, TouchableOpacity } from 'react-native';
3
- import { StyledText, StyledView } from '../StyledComponents';
4
- import { horizontalScale, verticalScale } from "../../helpers/ResponsiveCalculations";
5
- import { useTheme } from '../../hooks';
6
- import { getChipColors } from './utils';
7
- import type { ChipProps } from '../../types';
8
-
9
- const Chip: FC<ChipProps> = ({
10
- label = 'Chip',
11
- labelColor,
12
- fs,
13
- fScale = 'sm',
14
- ff,
15
- bg,
16
- br = 7,
17
- gap = 7,
18
- paddingV = 6,
19
- paddingH = 15,
20
- stroke = 0.8,
21
- strokeColor,
22
- rippleColor,
23
- disabled = false,
24
- renderLeftIcon,
25
- renderRightIcon,
26
- containerStyle,
27
- textStyle,
28
- active = false,
29
- ...rest
30
- }) => {
31
-
32
- const theme: any = useTheme();
33
-
34
- const { buttonTextColor, buttonBorderColor, backgroundColor } = getChipColors({
35
- theme,
36
- bg,
37
- labelColor,
38
- strokeColor,
39
- disabled,
40
- active
41
- });
42
-
43
- const STYLES = StyleSheet.create({
44
- CONTAINER: {
45
- flexDirection: 'row',
46
- alignItems: 'center',
47
- borderWidth: stroke,
48
- borderColor: buttonBorderColor,
49
- backgroundColor: backgroundColor,
50
- borderRadius: verticalScale(br),
51
- paddingVertical: verticalScale(paddingV),
52
- paddingLeft: horizontalScale((renderLeftIcon && paddingH / 2) ?? paddingH),
53
- paddingRight: horizontalScale((renderRightIcon && paddingH / 2) ?? paddingH),
54
- gap: horizontalScale(gap)
55
- },
56
- TEXT: {
57
- color: buttonTextColor,
58
- }
59
- });
60
- return (<>
61
- <StyledView alignSelf='flex-start'>
62
- <TouchableOpacity
63
- disabled={disabled}
64
- {...rest}
65
- >
66
- <StyledView style={[STYLES.CONTAINER, containerStyle]}>
67
- {
68
- React.isValidElement(renderLeftIcon) && renderLeftIcon
69
- }
70
- <StyledText fScale={fScale} ff={ff} fs={fs} style={[STYLES.TEXT, textStyle]}>{label}</StyledText>
71
- {
72
- React.isValidElement(renderRightIcon) && renderRightIcon
73
- }
74
- </StyledView>
75
-
76
- </TouchableOpacity>
77
- </StyledView>
78
- </>);
79
- }
80
- export default Chip;
81
- export type { ChipProps };
82
-
1
+ import React, { type FC } from 'react';
2
+ import { StyleSheet, TouchableOpacity } from 'react-native';
3
+ import { StyledText, StyledView } from '../StyledComponents';
4
+ import { horizontalScale, verticalScale } from "../../helpers/ResponsiveCalculations";
5
+ import { useTheme } from '../../hooks';
6
+ import { getChipColors } from './utils';
7
+ import type { ChipProps } from '../../types';
8
+
9
+ const Chip: FC<ChipProps> = ({
10
+ label = 'Chip',
11
+ labelColor,
12
+ fs,
13
+ fScale = 'sm',
14
+ ff,
15
+ bg,
16
+ br = 7,
17
+ gap = 7,
18
+ paddingV = 6,
19
+ paddingH = 15,
20
+ stroke = 0.8,
21
+ strokeColor,
22
+ rippleColor,
23
+ disabled = false,
24
+ renderLeftIcon,
25
+ renderRightIcon,
26
+ containerStyle,
27
+ textStyle,
28
+ active = false,
29
+ ...rest
30
+ }) => {
31
+
32
+ const theme: any = useTheme();
33
+
34
+ const { buttonTextColor, buttonBorderColor, backgroundColor } = getChipColors({
35
+ theme,
36
+ bg,
37
+ labelColor,
38
+ strokeColor,
39
+ disabled,
40
+ active
41
+ });
42
+
43
+ const STYLES = StyleSheet.create({
44
+ CONTAINER: {
45
+ flexDirection: 'row',
46
+ alignItems: 'center',
47
+ borderWidth: stroke,
48
+ borderColor: buttonBorderColor,
49
+ backgroundColor: backgroundColor,
50
+ borderRadius: verticalScale(br),
51
+ paddingVertical: verticalScale(paddingV),
52
+ paddingLeft: horizontalScale((renderLeftIcon && paddingH / 2) ?? paddingH),
53
+ paddingRight: horizontalScale((renderRightIcon && paddingH / 2) ?? paddingH),
54
+ gap: horizontalScale(gap)
55
+ },
56
+ TEXT: {
57
+ color: buttonTextColor,
58
+ }
59
+ });
60
+ return (<>
61
+ <StyledView alignSelf='flex-start'>
62
+ <TouchableOpacity
63
+ disabled={disabled}
64
+ {...rest}
65
+ >
66
+ <StyledView style={[STYLES.CONTAINER, containerStyle]}>
67
+ {
68
+ React.isValidElement(renderLeftIcon) && renderLeftIcon
69
+ }
70
+ <StyledText fScale={fScale} ff={ff} fs={fs} style={[STYLES.TEXT, textStyle]}>{label}</StyledText>
71
+ {
72
+ React.isValidElement(renderRightIcon) && renderRightIcon
73
+ }
74
+ </StyledView>
75
+
76
+ </TouchableOpacity>
77
+ </StyledView>
78
+ </>);
79
+ }
80
+ export default Chip;
81
+ export type { ChipProps };
82
+