@hoddy-ui/core 2.5.46 → 2.5.48

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.
@@ -243,7 +243,7 @@ var Typography = forwardRef(
243
243
  const config2 = getConfig();
244
244
  const customFontSizes = config2.TYPOGRAPHY?.fontSizes;
245
245
  const baseFontSize = customFontSizes?.[variant] ?? DEFAULT_FONT_SIZES[variant];
246
- const f = fontSize || baseFontSize;
246
+ const f = fontSize || style?.fontSize || baseFontSize;
247
247
  const lh = lineHeight || f * 1.2;
248
248
  const styles = StyleSheet.create({
249
249
  text: {
@@ -339,6 +339,7 @@ var FlashMessage = () => {
339
339
  opacity: opacity.value
340
340
  };
341
341
  });
342
+ const textColor = type === "default" ? "#fff" : colors2[type].text;
342
343
  const styles = ScaledSheet.create({
343
344
  root: {
344
345
  position: "absolute",
@@ -347,7 +348,7 @@ var FlashMessage = () => {
347
348
  left: 0,
348
349
  paddingTop: top + 10,
349
350
  paddingHorizontal: "15@ms",
350
- backgroundColor: colors2[type].main,
351
+ backgroundColor: type === "default" ? "#333" : colors2[type].main,
351
352
  width: "100%",
352
353
  borderBottomLeftRadius: 10,
353
354
  borderBottomRightRadius: 10,
@@ -371,10 +372,10 @@ var FlashMessage = () => {
371
372
  variant: "h6",
372
373
  fontWeight: 600,
373
374
  gutterBottom: 3,
374
- style: { color: "#fff" }
375
+ color: textColor
375
376
  },
376
377
  message?.title
377
- ), /* @__PURE__ */ React2.createElement(Typography_default, { style: { color: "#fff" } }, message?.message)))), message?.actions?.map((cur, i) => /* @__PURE__ */ React2.createElement(
378
+ ), /* @__PURE__ */ React2.createElement(Typography_default, { color: textColor }, message?.message)))), message?.actions?.map((cur, i) => /* @__PURE__ */ React2.createElement(
378
379
  TouchableOpacity,
379
380
  {
380
381
  key: i,
@@ -621,7 +622,7 @@ var AlertX = ({
621
622
  var AlertX_default = AlertX;
622
623
 
623
624
  // ../src/Components/Avatar.tsx
624
- import { AntDesign } from "@expo/vector-icons";
625
+ import { Ionicons } from "@expo/vector-icons";
625
626
  import React6, { useState as useState3 } from "react";
626
627
  import { Image, View as View3 } from "react-native";
627
628
  import { ms as ms3, ScaledSheet as ScaledSheet3 } from "react-native-size-matters";
@@ -631,7 +632,8 @@ var Avatar = ({
631
632
  variant = "contained",
632
633
  source,
633
634
  size = 48,
634
- style = {}
635
+ style = {},
636
+ icon
635
637
  }) => {
636
638
  const colors2 = useColors();
637
639
  const [imageError, setImageError] = useState3(false);
@@ -661,12 +663,12 @@ var Avatar = ({
661
663
  source,
662
664
  onError: () => setImageError(true)
663
665
  }
664
- ) : label ? /* @__PURE__ */ React6.createElement(Typography_default, { style: { color: colors2[color].text } }, label[0]) : /* @__PURE__ */ React6.createElement(AntDesign, { name: "user", color: "#fff", size: Math.round(size / 1.5) }));
666
+ ) : label ? /* @__PURE__ */ React6.createElement(Typography_default, { style: { color: colors2[color].text } }, label[0]) : icon ? icon : /* @__PURE__ */ React6.createElement(Ionicons, { name: "person", color: "#fff", size: Math.round(size / 1.5) }));
665
667
  };
666
668
  var Avatar_default = Avatar;
667
669
 
668
670
  // ../src/Components/Button.tsx
669
- import { Ionicons, MaterialIcons as MaterialIcons2 } from "@expo/vector-icons";
671
+ import { Ionicons as Ionicons2, MaterialIcons as MaterialIcons2 } from "@expo/vector-icons";
670
672
  import React7, { forwardRef as forwardRef2 } from "react";
671
673
  import { ActivityIndicator, Text as Text2, TouchableOpacity as TouchableOpacity2 } from "react-native";
672
674
  import { ScaledSheet as ScaledSheet4, moderateScale, ms as ms4 } from "react-native-size-matters";
@@ -733,7 +735,7 @@ var IconButton = ({
733
735
  });
734
736
  const IconComp = {
735
737
  material: MaterialIcons2,
736
- ion: Ionicons
738
+ ion: Ionicons2
737
739
  }[iconType];
738
740
  return /* @__PURE__ */ React7.createElement(
739
741
  TouchableOpacity2,
@@ -916,7 +918,7 @@ var FormWrapper = forwardRef3(
916
918
  );
917
919
 
918
920
  // ../src/Components/StarRating.tsx
919
- import { Ionicons as Ionicons2 } from "@expo/vector-icons";
921
+ import { Ionicons as Ionicons3 } from "@expo/vector-icons";
920
922
  import * as Haptics from "expo-haptics";
921
923
  import React11, { useEffect as useEffect4, useState as useState5 } from "react";
922
924
  import {
@@ -1179,7 +1181,7 @@ var RatingInput = ({
1179
1181
  }
1180
1182
  },
1181
1183
  /* @__PURE__ */ React11.createElement(
1182
- Ionicons2,
1184
+ Ionicons3,
1183
1185
  {
1184
1186
  style: { marginLeft: 10 },
1185
1187
  name: index < rate ? "star" : "star-outline",
@@ -1254,7 +1256,7 @@ var RatingStars = ({
1254
1256
  }
1255
1257
  });
1256
1258
  return /* @__PURE__ */ React11.createElement(View6, { style: styles.root }, [...Array(Math.floor(rating))].map((_, index) => /* @__PURE__ */ React11.createElement(
1257
- Ionicons2,
1259
+ Ionicons3,
1258
1260
  {
1259
1261
  key: index,
1260
1262
  name: "star",
@@ -1262,7 +1264,7 @@ var RatingStars = ({
1262
1264
  color: colors2[color]?.main || color
1263
1265
  }
1264
1266
  )), [...Array(5 - Math.floor(rating))].map((_, index) => /* @__PURE__ */ React11.createElement(
1265
- Ionicons2,
1267
+ Ionicons3,
1266
1268
  {
1267
1269
  key: index,
1268
1270
  name: "star",
@@ -1308,7 +1310,7 @@ var Grid = ({
1308
1310
  };
1309
1311
 
1310
1312
  // ../src/Components/Locator.tsx
1311
- import { Ionicons as Ionicons4 } from "@expo/vector-icons";
1313
+ import { Ionicons as Ionicons5 } from "@expo/vector-icons";
1312
1314
  import React16, { useEffect as useEffect5, useState as useState8 } from "react";
1313
1315
  import { Alert, TouchableOpacity as TouchableOpacity8, View as View11 } from "react-native";
1314
1316
 
@@ -1352,7 +1354,7 @@ var ListItem = ({
1352
1354
  };
1353
1355
 
1354
1356
  // ../src/Components/TextField.tsx
1355
- import { Ionicons as Ionicons3, MaterialIcons as MaterialIcons5 } from "@expo/vector-icons";
1357
+ import { Ionicons as Ionicons4, MaterialIcons as MaterialIcons5 } from "@expo/vector-icons";
1356
1358
  import React15, { useRef as useRef2, useState as useState7 } from "react";
1357
1359
  import {
1358
1360
  Animated as Animated3,
@@ -1367,6 +1369,7 @@ import {
1367
1369
  ms as ms7,
1368
1370
  verticalScale
1369
1371
  } from "react-native-size-matters";
1372
+ import DateTimePickerModal from "react-native-modal-datetime-picker";
1370
1373
 
1371
1374
  // ../src/Components/SelectMenu.tsx
1372
1375
  import { MaterialIcons as MaterialIcons4 } from "@expo/vector-icons";
@@ -1501,6 +1504,7 @@ var TextField = ({
1501
1504
  color = "primary",
1502
1505
  value,
1503
1506
  type,
1507
+ placeholder = "",
1504
1508
  helperText,
1505
1509
  onChangeText,
1506
1510
  onSubmitEditing = () => {
@@ -1524,6 +1528,8 @@ var TextField = ({
1524
1528
  }) => {
1525
1529
  const colors2 = useColors();
1526
1530
  const [focused, setFocused] = useState7(false);
1531
+ const [datePickerVisible, setDatePickerVisible] = useState7(false);
1532
+ const isDate = type === "date";
1527
1533
  const height2 = moderateScale2(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1);
1528
1534
  const labelAnim = useRef2(
1529
1535
  new Animated3.Value(height2 / moderateScale2(variant === "text" ? 2.5 : 3.2))
@@ -1580,6 +1586,21 @@ var TextField = ({
1580
1586
  paddingLeft: variant === "text" ? 0 : moderateScale2(15),
1581
1587
  paddingTop: "13@ms"
1582
1588
  },
1589
+ dateContent: {
1590
+ flexDirection: "row",
1591
+ alignItems: "center",
1592
+ flex: 1,
1593
+ paddingLeft: variant === "text" ? 0 : moderateScale2(15),
1594
+ paddingRight: moderateScale2(10),
1595
+ paddingTop: variant === "text" ? ms7(13) : ms7(12)
1596
+ },
1597
+ dateText: {
1598
+ fontSize: "14@ms",
1599
+ flex: 1
1600
+ },
1601
+ datePlaceholder: {
1602
+ color: colors2.textSecondary.main
1603
+ },
1583
1604
  label: {
1584
1605
  fontFamily: getFontFamily(400),
1585
1606
  position: "absolute",
@@ -1625,10 +1646,46 @@ var TextField = ({
1625
1646
  autoCapitalize: "none",
1626
1647
  textContentType: "password"
1627
1648
  } : {};
1649
+ const parseDateValue = () => {
1650
+ if (!value)
1651
+ return /* @__PURE__ */ new Date();
1652
+ if (value instanceof Date)
1653
+ return value;
1654
+ const parts = `${value}`.split("/");
1655
+ if (parts.length === 3) {
1656
+ const [day, month, year] = parts;
1657
+ const parsed = new Date(
1658
+ parseInt(year, 10),
1659
+ parseInt(month, 10) - 1,
1660
+ parseInt(day, 10)
1661
+ );
1662
+ if (!isNaN(parsed.getTime()))
1663
+ return parsed;
1664
+ }
1665
+ const fallback = new Date(value);
1666
+ return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
1667
+ };
1668
+ const handleDateConfirm = (date) => {
1669
+ const day = date.getDate();
1670
+ const month = date.getMonth() + 1;
1671
+ const year = date.getFullYear();
1672
+ const dateString = `${day}/${month}/${year}`;
1673
+ onChangeText?.(dateString);
1674
+ setDatePickerVisible(false);
1675
+ };
1676
+ const handleContainerPress = () => {
1677
+ if (disabled)
1678
+ return;
1679
+ setFocused(true);
1680
+ if (isDate) {
1681
+ onFocus();
1682
+ setDatePickerVisible(true);
1683
+ }
1684
+ };
1628
1685
  return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(View10, { style: styles.root }, /* @__PURE__ */ React15.createElement(
1629
1686
  TouchableOpacity7,
1630
1687
  {
1631
- onPress: () => setFocused(true),
1688
+ onPress: handleContainerPress,
1632
1689
  style: styles.container
1633
1690
  },
1634
1691
  /* @__PURE__ */ React15.createElement(Animated3.Text, { style: { ...styles.label, top: labelAnim } }, label),
@@ -1649,7 +1706,24 @@ var TextField = ({
1649
1706
  options.find((cur) => cur.value === value)?.start
1650
1707
  ),
1651
1708
  /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.inputText }, options.find((cur) => cur.value === value)?.label)
1652
- ) : /* @__PURE__ */ React15.createElement(
1709
+ ) : isDate ? /* @__PURE__ */ React15.createElement(View10, { style: styles.dateContent }, /* @__PURE__ */ React15.createElement(
1710
+ Typography_default,
1711
+ {
1712
+ style: [
1713
+ styles.dateText,
1714
+ !value ? styles.datePlaceholder : void 0
1715
+ ],
1716
+ color: value ? "dark" : "textSecondary"
1717
+ },
1718
+ value || placeholder
1719
+ ), /* @__PURE__ */ React15.createElement(View10, { style: { marginLeft: 8 } }, end ?? /* @__PURE__ */ React15.createElement(
1720
+ Ionicons4,
1721
+ {
1722
+ name: "calendar-outline",
1723
+ size: 22,
1724
+ color: colors2.textSecondary.main
1725
+ }
1726
+ ))) : /* @__PURE__ */ React15.createElement(
1653
1727
  TextInput2,
1654
1728
  {
1655
1729
  onFocus: () => {
@@ -1691,7 +1765,7 @@ var TextField = ({
1691
1765
  }
1692
1766
  },
1693
1767
  /* @__PURE__ */ React15.createElement(
1694
- Ionicons3,
1768
+ Ionicons4,
1695
1769
  {
1696
1770
  name: "chevron-down",
1697
1771
  color: colors2.textSecondary.main,
@@ -1719,6 +1793,18 @@ var TextField = ({
1719
1793
  onChange: onChangeText,
1720
1794
  ...selectMenuProps
1721
1795
  }
1796
+ ), isDate && /* @__PURE__ */ React15.createElement(
1797
+ DateTimePickerModal,
1798
+ {
1799
+ isVisible: datePickerVisible,
1800
+ mode: "date",
1801
+ date: parseDateValue(),
1802
+ onConfirm: handleDateConfirm,
1803
+ onCancel: () => {
1804
+ setDatePickerVisible(false);
1805
+ setFocused(false);
1806
+ }
1807
+ }
1722
1808
  ));
1723
1809
  };
1724
1810
  var TextField2 = React15.forwardRef(
@@ -1729,6 +1815,7 @@ var TextField2 = React15.forwardRef(
1729
1815
  color = "primary",
1730
1816
  value,
1731
1817
  type,
1818
+ placeholder,
1732
1819
  helperText,
1733
1820
  onChangeText,
1734
1821
  onSubmitEditing = () => {
@@ -1744,7 +1831,6 @@ var TextField2 = React15.forwardRef(
1744
1831
  style = {},
1745
1832
  inputStyles = {},
1746
1833
  gutterBottom = 8,
1747
- placeholder,
1748
1834
  end,
1749
1835
  options,
1750
1836
  multiline,
@@ -1754,6 +1840,8 @@ var TextField2 = React15.forwardRef(
1754
1840
  const colors2 = useColors();
1755
1841
  const [focused, _setFocused] = useState7(false);
1756
1842
  const [showPassword, setShowPassword] = useState7(false);
1843
+ const [datePickerVisible, setDatePickerVisible] = useState7(false);
1844
+ const isDate = type === "date";
1757
1845
  const height2 = moderateScale2(
1758
1846
  multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
1759
1847
  );
@@ -1804,6 +1892,20 @@ var TextField2 = React15.forwardRef(
1804
1892
  color: colors2.textSecondary.light,
1805
1893
  paddingLeft: moderateScale2(10)
1806
1894
  },
1895
+ dateContent: {
1896
+ flexDirection: "row",
1897
+ alignItems: "center",
1898
+ flex: 1,
1899
+ paddingHorizontal: moderateScale2(10),
1900
+ paddingTop: multiline ? 4 : 0
1901
+ },
1902
+ dateText: {
1903
+ fontSize: "14@ms",
1904
+ flex: 1
1905
+ },
1906
+ datePlaceholder: {
1907
+ color: colors2.textSecondary.light
1908
+ },
1807
1909
  label: {},
1808
1910
  helperText: {
1809
1911
  paddingHorizontal: "15@s",
@@ -1842,6 +1944,42 @@ var TextField2 = React15.forwardRef(
1842
1944
  autoCapitalize: "none",
1843
1945
  textContentType: "password"
1844
1946
  } : {};
1947
+ const parseDateValue = () => {
1948
+ if (!value)
1949
+ return /* @__PURE__ */ new Date();
1950
+ if (value instanceof Date)
1951
+ return value;
1952
+ const parts = `${value}`.split("/");
1953
+ if (parts.length === 3) {
1954
+ const [day, month, year] = parts;
1955
+ const parsed = new Date(
1956
+ parseInt(year, 10),
1957
+ parseInt(month, 10) - 1,
1958
+ parseInt(day, 10)
1959
+ );
1960
+ if (!isNaN(parsed.getTime()))
1961
+ return parsed;
1962
+ }
1963
+ const fallback = new Date(value);
1964
+ return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
1965
+ };
1966
+ const handleDateConfirm = (date) => {
1967
+ const day = date.getDate();
1968
+ const month = date.getMonth() + 1;
1969
+ const year = date.getFullYear();
1970
+ const dateString = `${day}/${month}/${year}`;
1971
+ onChangeText?.(dateString);
1972
+ setDatePickerVisible(false);
1973
+ };
1974
+ const handleContainerPress = () => {
1975
+ if (disabled)
1976
+ return;
1977
+ setFocused(true);
1978
+ if (isDate) {
1979
+ onFocus();
1980
+ setDatePickerVisible(true);
1981
+ }
1982
+ };
1845
1983
  return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(View10, { style: styles.root }, label && /* @__PURE__ */ React15.createElement(
1846
1984
  Typography_default,
1847
1985
  {
@@ -1854,19 +1992,36 @@ var TextField2 = React15.forwardRef(
1854
1992
  ), /* @__PURE__ */ React15.createElement(
1855
1993
  TouchableOpacity7,
1856
1994
  {
1857
- onPress: () => setFocused(true),
1995
+ onPress: handleContainerPress,
1858
1996
  style: styles.container
1859
1997
  },
1860
1998
  /* @__PURE__ */ React15.createElement(View10, { style: { marginTop: multiline ? 5 : 0 } }, start),
1861
1999
  options ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, value ? /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.inputText }, options.find((cur) => cur.value === value)?.label) : /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.placeholder }, placeholder), /* @__PURE__ */ React15.createElement(
1862
- Ionicons3,
2000
+ Ionicons4,
1863
2001
  {
1864
2002
  name: "chevron-down",
1865
2003
  size: 24,
1866
2004
  style: { marginLeft: "auto", marginRight: 15 },
1867
2005
  color: colors2.dark.light
1868
2006
  }
1869
- )) : /* @__PURE__ */ React15.createElement(
2007
+ )) : isDate ? /* @__PURE__ */ React15.createElement(View10, { style: styles.dateContent }, /* @__PURE__ */ React15.createElement(
2008
+ Typography_default,
2009
+ {
2010
+ style: [
2011
+ styles.dateText,
2012
+ !value ? styles.datePlaceholder : void 0
2013
+ ],
2014
+ color: value ? "dark" : "textSecondary"
2015
+ },
2016
+ value || placeholder
2017
+ ), /* @__PURE__ */ React15.createElement(View10, { style: { marginLeft: 8 } }, end ?? /* @__PURE__ */ React15.createElement(
2018
+ Ionicons4,
2019
+ {
2020
+ name: "calendar-outline",
2021
+ size: 22,
2022
+ color: colors2.textSecondary.main
2023
+ }
2024
+ ))) : /* @__PURE__ */ React15.createElement(
1870
2025
  TextInput2,
1871
2026
  {
1872
2027
  ref,
@@ -1901,7 +2056,7 @@ var TextField2 = React15.forwardRef(
1901
2056
  onPress: () => setShowPassword(!showPassword)
1902
2057
  },
1903
2058
  /* @__PURE__ */ React15.createElement(
1904
- Ionicons3,
2059
+ Ionicons4,
1905
2060
  {
1906
2061
  name: showPassword ? "eye-outline" : "eye-off-outline",
1907
2062
  size: 24,
@@ -2111,13 +2266,13 @@ var Locator = ({
2111
2266
  helperText,
2112
2267
  variant,
2113
2268
  end: /* @__PURE__ */ React16.createElement(View11, { style: { flexDirection: "row" } }, /* @__PURE__ */ React16.createElement(TouchableOpacity8, { onPress: locateMe, style: { marginRight: 10 } }, /* @__PURE__ */ React16.createElement(
2114
- Ionicons4,
2269
+ Ionicons5,
2115
2270
  {
2116
2271
  color: colors2.primary.main,
2117
2272
  size: 18,
2118
2273
  name: "location"
2119
2274
  }
2120
- )), /* @__PURE__ */ React16.createElement(TouchableOpacity8, { onPress: clear }, /* @__PURE__ */ React16.createElement(Ionicons4, { color: colors2.dark.main, size: 18, name: "close" })))
2275
+ )), /* @__PURE__ */ React16.createElement(TouchableOpacity8, { onPress: clear }, /* @__PURE__ */ React16.createElement(Ionicons5, { color: colors2.dark.main, size: 18, name: "close" })))
2121
2276
  }
2122
2277
  ), prediction.length > 0 && /* @__PURE__ */ React16.createElement(View11, { style: styles.list }, prediction.map(
2123
2278
  (cur, i) => i < 5 && /* @__PURE__ */ React16.createElement(
@@ -2129,7 +2284,7 @@ var Locator = ({
2129
2284
  onPress: () => locationPressed(cur)
2130
2285
  },
2131
2286
  /* @__PURE__ */ React16.createElement(
2132
- Ionicons4,
2287
+ Ionicons5,
2133
2288
  {
2134
2289
  name: "location-outline",
2135
2290
  style: { marginRight: 10 },