@hoddy-ui/core 1.0.89 → 1.0.91

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.
@@ -141,24 +141,25 @@ function colors(theme) {
141
141
  }
142
142
 
143
143
  // ../src/config/KeyManager.ts
144
- var apiKey = {
144
+ var config = {
145
145
  GOOGLE_MAP_API_KEY: ""
146
146
  };
147
- function setApiKey(key) {
148
- apiKey = key;
147
+ function setConfig(key) {
148
+ config = key;
149
149
  }
150
- function getApiKey() {
151
- return apiKey;
150
+ function getConfig() {
151
+ return config;
152
152
  }
153
153
 
154
154
  // ../src/config/index.ts
155
- function initialize(config) {
155
+ function initialize(config2) {
156
156
  try {
157
- setApiKey({
158
- GOOGLE_MAP_API_KEY: config.googleMapApiKey
157
+ setConfig({
158
+ GOOGLE_MAP_API_KEY: config2.googleMapApiKey,
159
+ DEFAULT_FONT_FAMILY: config2.fontFamily
159
160
  });
160
- if (config.colors)
161
- setExtraColors(config.colors);
161
+ if (config2.colors)
162
+ setExtraColors(config2.colors);
162
163
  } catch (error) {
163
164
  console.error("Error reading the config file:", error);
164
165
  }
@@ -207,6 +208,8 @@ var Typography = forwardRef(
207
208
  numberOfLines,
208
209
  adjustsFontSizeToFit,
209
210
  fontWeight = 400,
211
+ fontFamily,
212
+ // NEW PROP ADDED
210
213
  ...props
211
214
  }, ref) => {
212
215
  const colors2 = useColors();
@@ -229,7 +232,9 @@ var Typography = forwardRef(
229
232
  textTransform: textCase,
230
233
  alignItems: "center",
231
234
  textAlign: align,
232
- fontWeight: fontWeight.toString()
235
+ fontWeight: fontWeight.toString(),
236
+ fontFamily: fontFamily || getConfig().DEFAULT_FONT_FAMILY || "System"
237
+ // Use custom font if provided, else default
233
238
  }
234
239
  });
235
240
  return /* @__PURE__ */ React2.createElement(
@@ -238,7 +243,7 @@ var Typography = forwardRef(
238
243
  ref,
239
244
  numberOfLines,
240
245
  adjustsFontSizeToFit,
241
- style: { ...styles2.text, ...style },
246
+ style: [styles2.text, style],
242
247
  ...props
243
248
  },
244
249
  children
@@ -574,6 +579,7 @@ var LinkButton = ({
574
579
  text: {
575
580
  fontSize: moderateScale2(fontSize),
576
581
  fontWeight,
582
+ fontFamily: getConfig().DEFAULT_FONT_FAMILY || "System",
577
583
  color: disabled ? "#777" : colors2[color].main
578
584
  }
579
585
  });
@@ -680,7 +686,8 @@ var Button = forwardRef2(
680
686
  text: {
681
687
  color: disabled ? variant === "text" || variant === "outlined" ? colors2.black[1] : colors2[color].text : colors2[color][variant === "text" || variant === "outlined" ? "main" : "text"],
682
688
  fontWeight: variant === "outlined" ? "700" : "500",
683
- fontSize: size === "small" ? "12@ms" : "16@ms"
689
+ fontSize: size === "small" ? "12@ms" : "16@ms",
690
+ fontFamily: getConfig().DEFAULT_FONT_FAMILY || "System"
684
691
  }
685
692
  });
686
693
  return /* @__PURE__ */ React8.createElement(
@@ -877,14 +884,21 @@ var Popup = ({
877
884
  }
878
885
  });
879
886
  React11.useEffect(() => {
880
- setShow(open);
881
- setTimeout(() => {
882
- setShowSecondary(open);
883
- }, 500);
887
+ if (open) {
888
+ setShow(open);
889
+ setTimeout(() => {
890
+ setShowSecondary(open);
891
+ }, 500);
892
+ } else {
893
+ closeAction();
894
+ }
884
895
  }, [open]);
885
896
  const closeAction = () => {
886
- setShow(false);
887
- onClose();
897
+ setShowSecondary(false);
898
+ setTimeout(() => {
899
+ setShow(false);
900
+ onClose();
901
+ }, 300);
888
902
  };
889
903
  return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
890
904
  Modal,
@@ -1314,8 +1328,10 @@ var TextField = ({
1314
1328
  }) => {
1315
1329
  const colors2 = useColors();
1316
1330
  const [focused, setFocused] = useState7(false);
1317
- const labelAnim = useRef(new Animated.Value(0)).current;
1318
1331
  const height = moderateScale3(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1);
1332
+ const labelAnim = useRef(
1333
+ new Animated.Value(height / moderateScale3(variant === "text" ? 2.5 : 3.2))
1334
+ ).current;
1319
1335
  React15.useEffect(() => {
1320
1336
  if (focused || value) {
1321
1337
  Animated.timing(labelAnim, {
@@ -1357,6 +1373,7 @@ var TextField = ({
1357
1373
  paddingLeft: variant === "text" ? 0 : moderateScale3(15),
1358
1374
  paddingRight: moderateScale3(10),
1359
1375
  paddingTop: "11@vs",
1376
+ fontFamily: getConfig().DEFAULT_FONT_FAMILY || "System",
1360
1377
  color: colors2.black[1],
1361
1378
  zIndex: 10
1362
1379
  // backgroundColor: "#284",
@@ -1368,6 +1385,7 @@ var TextField = ({
1368
1385
  paddingTop: "13@ms"
1369
1386
  },
1370
1387
  label: {
1388
+ fontFamily: getConfig().DEFAULT_FONT_FAMILY || "System",
1371
1389
  position: "absolute",
1372
1390
  left: variant === "text" ? 0 : moderateScale3(15),
1373
1391
  fontSize: focused || value ? "10@s" : "13@s",
@@ -1458,15 +1476,33 @@ var TextField = ({
1458
1476
  style: styles2.input
1459
1477
  }
1460
1478
  ),
1461
- end && /* @__PURE__ */ React15.createElement(View10, { style: { marginRight: 20 } }, end),
1462
- options && /* @__PURE__ */ React15.createElement(View10, { style: { marginRight: 20 } }, /* @__PURE__ */ React15.createElement(
1463
- Ionicons3,
1479
+ end && /* @__PURE__ */ React15.createElement(
1480
+ View10,
1464
1481
  {
1465
- name: "chevron-down",
1466
- color: colors2.textSecondary.main,
1467
- size: 24
1468
- }
1469
- ))
1482
+ style: {
1483
+ marginRight: 20,
1484
+ paddingTop: variant === "text" ? ms(13) : 0
1485
+ }
1486
+ },
1487
+ end
1488
+ ),
1489
+ options && /* @__PURE__ */ React15.createElement(
1490
+ View10,
1491
+ {
1492
+ style: {
1493
+ marginRight: variant === "text" ? 0 : 20,
1494
+ paddingTop: variant === "text" ? ms(13) : 0
1495
+ }
1496
+ },
1497
+ /* @__PURE__ */ React15.createElement(
1498
+ Ionicons3,
1499
+ {
1500
+ name: "chevron-down",
1501
+ color: colors2.textSecondary.main,
1502
+ size: 24
1503
+ }
1504
+ )
1505
+ )
1470
1506
  ), helperText && /* @__PURE__ */ React15.createElement(
1471
1507
  Typography_default,
1472
1508
  {
@@ -1545,13 +1581,13 @@ var TextField2 = ({
1545
1581
  alignSelf: "stretch",
1546
1582
  paddingLeft: moderateScale3(10),
1547
1583
  paddingRight: moderateScale3(10),
1548
- color: colors2.dark.light,
1584
+ color: colors2.dark.main,
1549
1585
  zIndex: 10
1550
1586
  // backgroundColor: "#284",
1551
1587
  },
1552
1588
  inputText: {
1553
1589
  fontSize: "14@ms",
1554
- color: colors2.dark.light,
1590
+ color: colors2.dark.main,
1555
1591
  paddingLeft: moderateScale3(10)
1556
1592
  },
1557
1593
  placeholder: {
@@ -1679,12 +1715,12 @@ var TextField_default = TextField;
1679
1715
  import * as Location from "expo-location";
1680
1716
  import { ScaledSheet as ScaledSheet13 } from "react-native-size-matters";
1681
1717
  setTimeout(() => {
1682
- const { GOOGLE_MAP_API_KEY } = getApiKey();
1718
+ const { GOOGLE_MAP_API_KEY } = getConfig();
1683
1719
  if (GOOGLE_MAP_API_KEY)
1684
1720
  Location.setGoogleApiKey(GOOGLE_MAP_API_KEY);
1685
1721
  }, 500);
1686
1722
  var getPredictionsFromCoords = async (coords) => {
1687
- const { GOOGLE_MAP_API_KEY } = getApiKey();
1723
+ const { GOOGLE_MAP_API_KEY } = getConfig();
1688
1724
  if (!GOOGLE_MAP_API_KEY)
1689
1725
  console.error(
1690
1726
  "Google map api key needs to be set to use this component \nMake sure to run initialize() with a valid google map api key"
@@ -1719,7 +1755,7 @@ var Locator = ({
1719
1755
  float = true,
1720
1756
  country = "ng"
1721
1757
  }) => {
1722
- const { GOOGLE_MAP_API_KEY } = getApiKey();
1758
+ const { GOOGLE_MAP_API_KEY } = getConfig();
1723
1759
  const [changed, setChanged] = useState8(false);
1724
1760
  const [value, setValue] = useState8("");
1725
1761
  const [prediction, setPrediction] = useState8([]);
@@ -1954,7 +1990,10 @@ var Spinner_default = Spinner;
1954
1990
 
1955
1991
  // ../src/Components/OTPInput.tsx
1956
1992
  import React19, { useMemo } from "react";
1957
- import { TextInput as TextInput3, View as View14 } from "react-native";
1993
+ import {
1994
+ TextInput as TextInput3,
1995
+ View as View14
1996
+ } from "react-native";
1958
1997
  import { ScaledSheet as ScaledSheet16, ms as ms3 } from "react-native-size-matters";
1959
1998
  var OTPInput = ({
1960
1999
  length = 6,
@@ -1969,6 +2008,36 @@ var OTPInput = ({
1969
2008
  () => Array(length).fill(0).map((_) => React19.createRef()),
1970
2009
  [length]
1971
2010
  );
2011
+ console.log("v", value);
2012
+ const onChangeHandler = (val, index) => {
2013
+ if (value.length >= length && val.length > 0)
2014
+ return;
2015
+ if (val.length > 1) {
2016
+ console.log("reached", val);
2017
+ const digits = val.replace(/\D/g, "").slice(0, length);
2018
+ onChange(digits);
2019
+ if (digits.length === length) {
2020
+ inputRefs[length - 1].current?.focus();
2021
+ }
2022
+ return;
2023
+ }
2024
+ if (val.length === 0) {
2025
+ const newValue2 = value.slice(0, index) + value.slice(index + 1);
2026
+ onChange(newValue2);
2027
+ if (index > 0) {
2028
+ inputRefs[index - 1].current?.focus();
2029
+ }
2030
+ return;
2031
+ }
2032
+ const digit = val.replace(/\D/g, "").slice(0, 1);
2033
+ if (!digit)
2034
+ return;
2035
+ const newValue = value.slice(0, index) + digit + value.slice(index + 1);
2036
+ onChange(newValue);
2037
+ if (index < length - 1) {
2038
+ inputRefs[index + 1].current?.focus();
2039
+ }
2040
+ };
1972
2041
  const colors2 = useColors();
1973
2042
  const styles2 = ScaledSheet16.create({
1974
2043
  root: {},
@@ -1991,27 +2060,7 @@ var OTPInput = ({
1991
2060
  TextInput3,
1992
2061
  {
1993
2062
  ref: inputRefs[index],
1994
- onChangeText: (val) => {
1995
- if (val.length === 1) {
1996
- if (index !== length - 1)
1997
- inputRefs[index + 1].current?.focus();
1998
- let text = value;
1999
- text = text.slice(0, index) + val + text.slice(index + 1);
2000
- onChange(text);
2001
- } else if (val.length === 0) {
2002
- if (index !== 0) {
2003
- inputRefs[index - 1].current?.focus();
2004
- let text = value;
2005
- text = text.slice(0, index);
2006
- onChange(text);
2007
- } else
2008
- onChange("");
2009
- } else {
2010
- let text = val.replace(/\D/g, "").slice(0, length);
2011
- onChange(text);
2012
- inputRefs[text.length < length - 1 ? text.length : length - 1]?.current?.focus();
2013
- }
2014
- },
2063
+ onChangeText: (val) => onChangeHandler(val, index),
2015
2064
  value: value[index] || "",
2016
2065
  blurOnSubmit: false,
2017
2066
  keyboardType: "number-pad",