@hoddy-ui/core 1.0.99 → 1.1.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.
@@ -4,61 +4,65 @@ var setExtraColors = (c) => extraColors = c;
4
4
  function colors(theme) {
5
5
  const lightColors = {
6
6
  white: {
7
- 1: "#fff",
7
+ 1: "#ffffff",
8
8
  2: "#f7f7f7",
9
- 3: "#eee",
10
- 4: "#ddd",
11
- 5: "#bbb"
9
+ 3: "#eeeeee",
10
+ 4: "#dddddd",
11
+ 5: "#bbbbbb",
12
+ ...extraColors?.light?.white
12
13
  },
13
14
  black: {
14
- 1: "#888",
15
- 2: "#777",
16
- 3: "#555",
17
- 4: "#333",
18
- 5: "#000"
15
+ 1: "#888888",
16
+ 2: "#777777",
17
+ 3: "#555555",
18
+ 4: "#333333",
19
+ 5: "#000000",
20
+ ...extraColors?.light?.black
19
21
  }
20
22
  };
21
23
  const darkColors = {
22
24
  black: {
23
- 1: "#fff",
25
+ 1: "#ffffff",
24
26
  2: "#f7f7f7",
25
- 3: "#eee",
26
- 4: "#ddd",
27
- 5: "#aaa"
27
+ 3: "#eeeeee",
28
+ 4: "#dddddd",
29
+ 5: "#aaaaaa",
30
+ ...extraColors?.dark?.black
28
31
  },
29
32
  white: {
30
- 1: "#000",
31
- 2: "#222",
32
- 3: "#333",
33
- 4: "#444",
34
- 5: "#555"
33
+ 1: "#060606",
34
+ 2: "#222222",
35
+ 3: "#333333",
36
+ 4: "#444444",
37
+ 5: "#555555",
38
+ ...extraColors?.dark?.white
35
39
  },
36
40
  dark: {
37
41
  main: "#f2f3f4",
38
- light: "#fff",
39
- dark: "#ddd",
40
- text: "#000",
42
+ light: "#ffffff",
43
+ dark: "#dddddd",
44
+ text: "#000000",
41
45
  ...extraColors?.dark?.dark
42
46
  },
43
47
  light: {
44
- main: "#111",
45
- light: "#555",
46
- dark: "#333",
47
- text: "#fff",
48
+ main: "#111111",
49
+ light: "#555555",
50
+ dark: "#333333",
51
+ text: "#ffffff",
48
52
  ...extraColors?.dark?.light
49
53
  },
50
54
  textSecondary: {
51
- main: "#666",
52
- light: "#777",
53
- dark: "#444",
54
- text: "#fff",
55
+ main: "#666666",
56
+ light: "#777777",
57
+ dark: "#444444",
58
+ text: "#ffffff",
55
59
  ...extraColors?.dark?.textSecondary
56
60
  },
57
61
  primary: {
58
- main: "#f80",
59
- light: "#FEFFD3",
60
- dark: "#fa0",
61
- text: "#fff",
62
+ main: "#ff8800",
63
+ light: "#feffd3",
64
+ dark: "#ffaa00",
65
+ text: "#ffffff",
62
66
  ...extraColors?.light?.primary,
63
67
  ...extraColors?.dark?.primary
64
68
  }
@@ -67,73 +71,73 @@ function colors(theme) {
67
71
  return {
68
72
  ...extraColors[theme],
69
73
  primary: {
70
- main: "#f80",
71
- light: "#FEFFD3",
72
- dark: "#fa0",
73
- text: "#fff",
74
+ main: "#ff8800",
75
+ light: "#feffd3",
76
+ dark: "#ffaa00",
77
+ text: "#ffffff",
74
78
  ...extraColors?.light?.primary
75
79
  },
76
80
  secondary: {
77
- main: "#f11",
78
- light: "#f43",
79
- dark: "#d00",
80
- text: "#fff",
81
+ main: "#ff1111",
82
+ light: "#ff4433",
83
+ dark: "#dd0000",
84
+ text: "#ffffff",
81
85
  ...extraColors?.light?.secondary
82
86
  },
83
87
  light: {
84
- main: "#fff",
85
- light: "#fff",
86
- dark: "#ddd",
87
- text: "#000",
88
+ main: "#ffffff",
89
+ light: "#ffffff",
90
+ dark: "#dddddd",
91
+ text: "#000000",
88
92
  ...extraColors?.light?.light
89
93
  },
90
94
  dark: {
91
- main: "#000",
92
- light: "#777",
93
- dark: "#111",
94
- text: "#fff",
95
+ main: "#000000",
96
+ light: "#777777",
97
+ dark: "#111111",
98
+ text: "#ffffff",
95
99
  ...extraColors?.light?.dark
96
100
  },
97
101
  textSecondary: {
98
- main: "#aaa",
99
- light: "#bbb",
100
- dark: "#777",
101
- text: "#123",
102
+ main: "#aaaaaa",
103
+ light: "#bbbbbb",
104
+ dark: "#777777",
105
+ text: "#112233",
102
106
  ...extraColors?.light?.textSecondary
103
107
  },
104
108
  blue: {
105
- main: "#09F",
106
- light: "#39f",
107
- dark: "#028",
108
- text: "#fff",
109
+ main: "#0099ff",
110
+ light: "#3399ff",
111
+ dark: "#002288",
112
+ text: "#ffffff",
109
113
  ...extraColors?.light?.blue
110
114
  },
111
115
  info: {
112
- main: "#09f",
113
- light: "#3af",
114
- dark: "#08a",
115
- text: "#fff",
116
+ main: "#0099ff",
117
+ light: "#33aaff",
118
+ dark: "#0088aa",
119
+ text: "#ffffff",
116
120
  ...extraColors?.light?.info
117
121
  },
118
122
  success: {
119
- main: "#0a4",
120
- text: "#fff",
121
- light: "#5c3",
122
- dark: "#062",
123
+ main: "#00aa44",
124
+ text: "#ffffff",
125
+ light: "#55cc33",
126
+ dark: "#006622",
123
127
  ...extraColors?.light?.success
124
128
  },
125
129
  warning: {
126
- main: "#fa2",
127
- light: "#fc7",
128
- dark: "#f90",
129
- text: "#fff",
130
+ main: "#ffaa22",
131
+ light: "#ffcc77",
132
+ dark: "#ff9900",
133
+ text: "#ffffff",
130
134
  ...extraColors?.light?.warning
131
135
  },
132
136
  error: {
133
- main: "#D22",
134
- text: "#fff",
135
- light: "#f43",
136
- dark: "#a20",
137
+ main: "#dd2222",
138
+ text: "#ffffff",
139
+ light: "#ff4433",
140
+ dark: "#aa2200",
137
141
  ...extraColors?.light?.error
138
142
  },
139
143
  ...dynamicColors
@@ -167,7 +171,7 @@ function initialize(config2) {
167
171
 
168
172
  // components/AdaptiveStatusBarNext.tsx
169
173
  import { useFocusEffect } from "expo-router";
170
- import React5, { useState as useState3 } from "react";
174
+ import React5, { useState as useState2 } from "react";
171
175
  import { Platform as Platform3, StatusBar } from "react-native";
172
176
 
173
177
  // ../src/hooks.ts
@@ -179,8 +183,9 @@ import { vs } from "react-native-size-matters";
179
183
  import AsyncStorage from "@react-native-async-storage/async-storage";
180
184
  import * as NavigationBar from "expo-navigation-bar";
181
185
  import * as SystemUI from "expo-system-ui";
182
- import React4, { createContext, useReducer } from "react";
186
+ import React4, { createContext, useEffect as useEffect2, useReducer } from "react";
183
187
  import { Platform, useColorScheme } from "react-native";
188
+ import { SafeAreaProvider } from "react-native-safe-area-context";
184
189
 
185
190
  // ../src/Components/FlashMessage.tsx
186
191
  import React3, { useEffect, useState } from "react";
@@ -232,8 +237,8 @@ var Typography = forwardRef(
232
237
  textTransform: textCase,
233
238
  alignItems: "center",
234
239
  textAlign: align,
235
- fontWeight: fontWeight.toString(),
236
- fontFamily: fontFamily || getConfig().DEFAULT_FONT_FAMILY || "System"
240
+ fontWeight,
241
+ fontFamily: fontFamily || getConfig().DEFAULT_FONT_FAMILY || void 0
237
242
  // Use custom font if provided, else default
238
243
  }
239
244
  });
@@ -314,24 +319,10 @@ var FlashMessage = () => {
314
319
  var FlashMessage_default = FlashMessage;
315
320
 
316
321
  // ../src/theme/index.tsx
317
- import { SafeAreaProvider } from "react-native-safe-area-context";
318
322
  var UIThemeContext = createContext({
319
323
  themeState: { mode: "default", value: "light" }
320
324
  });
321
325
  function themeReducer(state, { type, payload }) {
322
- if (payload === "dark" || type === "dark") {
323
- SystemUI.setBackgroundColorAsync("#000000");
324
- if (Platform.OS === "android") {
325
- NavigationBar.setButtonStyleAsync("light");
326
- NavigationBar.setBackgroundColorAsync("#000000");
327
- }
328
- } else {
329
- SystemUI.setBackgroundColorAsync("#ffffff");
330
- if (Platform.OS === "android") {
331
- NavigationBar.setButtonStyleAsync("dark");
332
- NavigationBar.setBackgroundColorAsync("#fff");
333
- }
334
- }
335
326
  switch (type) {
336
327
  case "dark":
337
328
  return { mode: "dark", value: "dark" };
@@ -343,6 +334,24 @@ function themeReducer(state, { type, payload }) {
343
334
  return state;
344
335
  }
345
336
  }
337
+ var ConfigureSystemUI = () => {
338
+ const theme = useTheme();
339
+ const colors2 = useColors();
340
+ useEffect2(() => {
341
+ if (colors2) {
342
+ SystemUI.setBackgroundColorAsync(colors2.white[1]);
343
+ if (Platform.OS === "android") {
344
+ NavigationBar.setBackgroundColorAsync(colors2.white[1]);
345
+ if (theme === "dark") {
346
+ NavigationBar.setButtonStyleAsync("light");
347
+ } else {
348
+ NavigationBar.setButtonStyleAsync("dark");
349
+ }
350
+ }
351
+ }
352
+ }, [colors2, theme]);
353
+ return /* @__PURE__ */ React4.createElement(React4.Fragment, null);
354
+ };
346
355
  var UIThemeProvider = ({ children }) => {
347
356
  const [themeState, themeDispatch] = useReducer(themeReducer, {
348
357
  mode: "default",
@@ -378,7 +387,8 @@ var UIThemeProvider = ({ children }) => {
378
387
  }
379
388
  },
380
389
  children,
381
- /* @__PURE__ */ React4.createElement(FlashMessage_default, null)
390
+ /* @__PURE__ */ React4.createElement(FlashMessage_default, null),
391
+ /* @__PURE__ */ React4.createElement(ConfigureSystemUI, null)
382
392
  ));
383
393
  };
384
394
 
@@ -393,6 +403,7 @@ var useTheme = () => {
393
403
  };
394
404
  var useNavScreenOptions = (type) => {
395
405
  const colors2 = useColors();
406
+ const theme = useTheme();
396
407
  const options = {
397
408
  stack: {
398
409
  headerShown: false,
@@ -412,7 +423,7 @@ var useNavScreenOptions = (type) => {
412
423
  headerShown: false,
413
424
  headerTintColor: colors2.dark.main,
414
425
  tabBarStyle: {
415
- borderTopColor: colors2.white[3],
426
+ borderTopColor: theme === "dark" ? colors2.light.main : colors2.white[2],
416
427
  borderTopWidth: 1,
417
428
  // shadowColor: "#000",
418
429
  // shadowOffset: { height: -3, width: 0 },
@@ -453,28 +464,25 @@ var useNavScreenOptions = (type) => {
453
464
 
454
465
  // components/AdaptiveStatusBarNext.tsx
455
466
  var AdaptiveStatusBar = ({ translucent = false }) => {
456
- const [focused, setFocused] = useState3(false);
467
+ const [focused, setFocused] = useState2(false);
457
468
  const colors2 = useColors();
458
469
  const theme = useTheme();
470
+ const statusbarHandler = () => {
471
+ StatusBar.setBarStyle(theme === "dark" ? "light-content" : "dark-content");
472
+ if (Platform3.OS === "android") {
473
+ StatusBar.setBackgroundColor(
474
+ translucent ? "transparent" : colors2.white[1]
475
+ );
476
+ StatusBar.setTranslucent(true);
477
+ }
478
+ };
459
479
  useFocusEffect(
460
480
  React5.useCallback(() => {
461
- StatusBar.setBarStyle(
462
- theme === "dark" ? "light-content" : "dark-content"
463
- );
464
- if (Platform3.OS === "android") {
465
- StatusBar.setBackgroundColor(
466
- colors2.white[1] + (translucent ? "0" : "")
467
- );
468
- StatusBar.setTranslucent(true);
469
- }
481
+ statusbarHandler();
470
482
  }, [theme])
471
483
  );
472
484
  React5.useEffect(() => {
473
- StatusBar.setBarStyle(theme === "dark" ? "light-content" : "dark-content");
474
- if (Platform3.OS === "android") {
475
- StatusBar.setBackgroundColor(colors2.white[1] + (translucent ? "0" : ""));
476
- StatusBar.setTranslucent(true);
477
- }
485
+ statusbarHandler();
478
486
  }, [theme]);
479
487
  return /* @__PURE__ */ React5.createElement(React5.Fragment, null);
480
488
  };
@@ -665,7 +673,7 @@ var Button = forwardRef2(
665
673
  alignItems: "center",
666
674
  alignSelf: "flex-start",
667
675
  justifyContent: "center",
668
- backgroundColor: variant === "text" || variant === "outlined" ? null : translucent ? translucent === "dark" ? colors2.white[3] + "2" : colors2.black[3] + "2" : loading ? colors2[color].light : disabled ? colors2.white[4] : colors2[color].main,
676
+ backgroundColor: variant === "text" || variant === "outlined" ? null : translucent ? translucent === "dark" ? colors2.white[3] + "22" : colors2.black[3] + "22" : loading ? colors2[color].light : disabled ? colors2.white[4] : colors2[color].main,
669
677
  borderRadius: rounded ? 30 : 10,
670
678
  elevation: variant === "text" ? 0 : elevation,
671
679
  paddingVertical: size === "small" ? 8 : size === "large" ? "15@ms" : "13@ms",
@@ -806,7 +814,7 @@ var FormWrapper = ({
806
814
  // ../src/Components/StarRating.tsx
807
815
  import { Ionicons as Ionicons2 } from "@expo/vector-icons";
808
816
  import * as Haptics from "expo-haptics";
809
- import { useEffect as useEffect2, useState as useState5 } from "react";
817
+ import { useEffect as useEffect3, useState as useState4 } from "react";
810
818
  import {
811
819
  ActivityIndicator as ActivityIndicator2,
812
820
  TextInput,
@@ -826,7 +834,7 @@ import {
826
834
  TouchableWithoutFeedback as TouchableWithoutFeedback2,
827
835
  View as View5
828
836
  } from "react-native";
829
- import React11, { useState as useState4 } from "react";
837
+ import React11, { useState as useState3 } from "react";
830
838
  import { ScaledSheet as ScaledSheet7 } from "react-native-size-matters";
831
839
  var Popup = ({
832
840
  title,
@@ -836,11 +844,13 @@ var Popup = ({
836
844
  children,
837
845
  open,
838
846
  onClose = () => {
839
- }
847
+ },
848
+ style
840
849
  }) => {
850
+ const theme = useTheme();
841
851
  const colors2 = useColors();
842
- const [show, setShow] = useState4(open);
843
- const [showSecondary, setShowSecondary] = useState4(false);
852
+ const [show, setShow] = useState3(open);
853
+ const [showSecondary, setShowSecondary] = useState3(false);
844
854
  const styles2 = ScaledSheet7.create({
845
855
  root: {
846
856
  height: "100%",
@@ -857,12 +867,13 @@ var Popup = ({
857
867
  },
858
868
  container: {
859
869
  paddingBottom: sheet ? "30@ms" : 0,
860
- backgroundColor: colors2.white[2],
870
+ backgroundColor: theme === "dark" ? "#111" : colors2.white[2],
861
871
  borderTopLeftRadius: 20,
862
872
  borderTopRightRadius: 20,
863
873
  borderBottomRightRadius: sheet ? 0 : 20,
864
874
  borderBottomLeftRadius: sheet ? 0 : 20,
865
- width: "100%"
875
+ width: "100%",
876
+ ...style
866
877
  },
867
878
  content: {
868
879
  paddingHorizontal: bare ? void 0 : "10@ms"
@@ -972,11 +983,11 @@ var RatingInput = ({
972
983
  rating = 0,
973
984
  size = 16
974
985
  }) => {
975
- const [showReviewsModal, setShowReviewsModal] = useState5(false);
976
- const [rate, setRate] = useState5(0);
986
+ const [showReviewsModal, setShowReviewsModal] = useState4(false);
987
+ const [rate, setRate] = useState4(0);
977
988
  const colors2 = useColors();
978
- const [loading, setLoading] = useState5(false);
979
- const [review, setReview] = useState5("");
989
+ const [loading, setLoading] = useState4(false);
990
+ const [review, setReview] = useState4("");
980
991
  const styles2 = ScaledSheet8.create({
981
992
  root: {
982
993
  flexDirection: "row",
@@ -994,7 +1005,7 @@ var RatingInput = ({
994
1005
  height: "100@vs"
995
1006
  }
996
1007
  });
997
- useEffect2(() => {
1008
+ useEffect3(() => {
998
1009
  setRate(rating);
999
1010
  }, [rating]);
1000
1011
  const onRate = (index) => {
@@ -1119,7 +1130,7 @@ var Grid = ({
1119
1130
 
1120
1131
  // ../src/Components/Locator.tsx
1121
1132
  import { Ionicons as Ionicons4 } from "@expo/vector-icons";
1122
- import React16, { useEffect as useEffect3, useState as useState8 } from "react";
1133
+ import React16, { useEffect as useEffect4, useState as useState7 } from "react";
1123
1134
  import { Alert, TouchableOpacity as TouchableOpacity8, View as View11 } from "react-native";
1124
1135
 
1125
1136
  // ../src/Components/List.tsx
@@ -1141,7 +1152,7 @@ var ListItem = ({
1141
1152
  flexDirection: "row",
1142
1153
  alignItems: "center",
1143
1154
  paddingHorizontal: "10@s",
1144
- borderBottomColor: colors2.white[4],
1155
+ borderBottomColor: colors2.white[2],
1145
1156
  borderBottomWidth: divider ? 1 : 0,
1146
1157
  paddingVertical: "10@vs"
1147
1158
  }
@@ -1163,7 +1174,7 @@ var ListItem = ({
1163
1174
 
1164
1175
  // ../src/Components/TextField.tsx
1165
1176
  import { Ionicons as Ionicons3, MaterialIcons as MaterialIcons5 } from "@expo/vector-icons";
1166
- import React15, { useRef, useState as useState7 } from "react";
1177
+ import React15, { useRef, useState as useState6 } from "react";
1167
1178
  import { Animated, TextInput as TextInput2, TouchableOpacity as TouchableOpacity7, View as View10 } from "react-native";
1168
1179
  import {
1169
1180
  ScaledSheet as ScaledSheet12,
@@ -1174,7 +1185,7 @@ import {
1174
1185
 
1175
1186
  // ../src/Components/SelectMenu.tsx
1176
1187
  import { MaterialIcons as MaterialIcons4 } from "@expo/vector-icons";
1177
- import React14, { useCallback, useState as useState6 } from "react";
1188
+ import React14, { useCallback, useState as useState5 } from "react";
1178
1189
  import { FlatList, Modal as Modal2, TouchableOpacity as TouchableOpacity6, View as View9 } from "react-native";
1179
1190
  import { useSafeAreaInsets as useSafeAreaInsets2 } from "react-native-safe-area-context";
1180
1191
  import { ScaledSheet as ScaledSheet11 } from "react-native-size-matters";
@@ -1191,7 +1202,7 @@ var SelectMenu = ({
1191
1202
  }) => {
1192
1203
  const colors2 = useColors();
1193
1204
  const { bottom } = useSafeAreaInsets2();
1194
- const [search, setSearch] = useState6("");
1205
+ const [search, setSearch] = useState5("");
1195
1206
  const styles2 = ScaledSheet11.create({
1196
1207
  root: {
1197
1208
  backgroundColor: colors2.white[1],
@@ -1225,7 +1236,7 @@ var SelectMenu = ({
1225
1236
  {
1226
1237
  style: {
1227
1238
  ...styles2.option,
1228
- backgroundColor: item.value === value ? colors2.blue.light + "2" : colors2.white[2]
1239
+ backgroundColor: item.value === value ? colors2.blue.light + "22" : colors2.white[2]
1229
1240
  },
1230
1241
  onPress: () => {
1231
1242
  onChange(item.value);
@@ -1327,7 +1338,7 @@ var TextField = ({
1327
1338
  ...props
1328
1339
  }) => {
1329
1340
  const colors2 = useColors();
1330
- const [focused, setFocused] = useState7(false);
1341
+ const [focused, setFocused] = useState6(false);
1331
1342
  const height = moderateScale3(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1);
1332
1343
  const labelAnim = useRef(
1333
1344
  new Animated.Value(height / moderateScale3(variant === "text" ? 2.5 : 3.2))
@@ -1551,8 +1562,8 @@ var TextField2 = ({
1551
1562
  ...props
1552
1563
  }) => {
1553
1564
  const colors2 = useColors();
1554
- const [focused, _setFocused] = useState7(false);
1555
- const [showPassword, setShowPassword] = useState7(false);
1565
+ const [focused, _setFocused] = useState6(false);
1566
+ const [showPassword, setShowPassword] = useState6(false);
1556
1567
  const height = moderateScale3(
1557
1568
  props.multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
1558
1569
  );
@@ -1714,11 +1725,6 @@ var TextField_default = TextField;
1714
1725
  // ../src/Components/Locator.tsx
1715
1726
  import * as Location from "expo-location";
1716
1727
  import { ScaledSheet as ScaledSheet13 } from "react-native-size-matters";
1717
- setTimeout(() => {
1718
- const { GOOGLE_MAP_API_KEY } = getConfig();
1719
- if (GOOGLE_MAP_API_KEY)
1720
- Location.setGoogleApiKey(GOOGLE_MAP_API_KEY);
1721
- }, 500);
1722
1728
  var getPredictionsFromCoords = async (coords) => {
1723
1729
  const { GOOGLE_MAP_API_KEY } = getConfig();
1724
1730
  if (!GOOGLE_MAP_API_KEY)
@@ -1756,9 +1762,9 @@ var Locator = ({
1756
1762
  country = "ng"
1757
1763
  }) => {
1758
1764
  const { GOOGLE_MAP_API_KEY } = getConfig();
1759
- const [changed, setChanged] = useState8(false);
1760
- const [value, setValue] = useState8("");
1761
- const [prediction, setPrediction] = useState8([]);
1765
+ const [changed, setChanged] = useState7(false);
1766
+ const [value, setValue] = useState7("");
1767
+ const [prediction, setPrediction] = useState7([]);
1762
1768
  const colors2 = useColors();
1763
1769
  const styles2 = ScaledSheet13.create({
1764
1770
  list: {
@@ -1838,7 +1844,7 @@ var Locator = ({
1838
1844
  setChanged(false);
1839
1845
  setPrediction([]);
1840
1846
  };
1841
- useEffect3(() => {
1847
+ useEffect4(() => {
1842
1848
  if (!GOOGLE_MAP_API_KEY)
1843
1849
  console.error(
1844
1850
  "Google map api key needs to be set to use this component \nMake sure to run initialize() with a valid google map api key"
@@ -1968,7 +1974,7 @@ var Spinner = ({
1968
1974
  alignItems: "center",
1969
1975
  justifyContent: "center",
1970
1976
  position: fullscreen ? "absolute" : "relative",
1971
- backgroundColor: fullscreen ? colors2.white[1] + "d" : void 0,
1977
+ backgroundColor: fullscreen ? colors2.white[1] + "dd" : void 0,
1972
1978
  ...style
1973
1979
  },
1974
1980
  content: {