@hoddy-ui/core 2.5.47 → 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,
@@ -1368,6 +1369,7 @@ import {
1368
1369
  ms as ms7,
1369
1370
  verticalScale
1370
1371
  } from "react-native-size-matters";
1372
+ import DateTimePickerModal from "react-native-modal-datetime-picker";
1371
1373
 
1372
1374
  // ../src/Components/SelectMenu.tsx
1373
1375
  import { MaterialIcons as MaterialIcons4 } from "@expo/vector-icons";
@@ -1502,6 +1504,7 @@ var TextField = ({
1502
1504
  color = "primary",
1503
1505
  value,
1504
1506
  type,
1507
+ placeholder = "",
1505
1508
  helperText,
1506
1509
  onChangeText,
1507
1510
  onSubmitEditing = () => {
@@ -1525,6 +1528,8 @@ var TextField = ({
1525
1528
  }) => {
1526
1529
  const colors2 = useColors();
1527
1530
  const [focused, setFocused] = useState7(false);
1531
+ const [datePickerVisible, setDatePickerVisible] = useState7(false);
1532
+ const isDate = type === "date";
1528
1533
  const height2 = moderateScale2(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1);
1529
1534
  const labelAnim = useRef2(
1530
1535
  new Animated3.Value(height2 / moderateScale2(variant === "text" ? 2.5 : 3.2))
@@ -1581,6 +1586,21 @@ var TextField = ({
1581
1586
  paddingLeft: variant === "text" ? 0 : moderateScale2(15),
1582
1587
  paddingTop: "13@ms"
1583
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
+ },
1584
1604
  label: {
1585
1605
  fontFamily: getFontFamily(400),
1586
1606
  position: "absolute",
@@ -1626,10 +1646,46 @@ var TextField = ({
1626
1646
  autoCapitalize: "none",
1627
1647
  textContentType: "password"
1628
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
+ };
1629
1685
  return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(View10, { style: styles.root }, /* @__PURE__ */ React15.createElement(
1630
1686
  TouchableOpacity7,
1631
1687
  {
1632
- onPress: () => setFocused(true),
1688
+ onPress: handleContainerPress,
1633
1689
  style: styles.container
1634
1690
  },
1635
1691
  /* @__PURE__ */ React15.createElement(Animated3.Text, { style: { ...styles.label, top: labelAnim } }, label),
@@ -1650,7 +1706,24 @@ var TextField = ({
1650
1706
  options.find((cur) => cur.value === value)?.start
1651
1707
  ),
1652
1708
  /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.inputText }, options.find((cur) => cur.value === value)?.label)
1653
- ) : /* @__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(
1654
1727
  TextInput2,
1655
1728
  {
1656
1729
  onFocus: () => {
@@ -1720,6 +1793,18 @@ var TextField = ({
1720
1793
  onChange: onChangeText,
1721
1794
  ...selectMenuProps
1722
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
+ }
1723
1808
  ));
1724
1809
  };
1725
1810
  var TextField2 = React15.forwardRef(
@@ -1730,6 +1815,7 @@ var TextField2 = React15.forwardRef(
1730
1815
  color = "primary",
1731
1816
  value,
1732
1817
  type,
1818
+ placeholder,
1733
1819
  helperText,
1734
1820
  onChangeText,
1735
1821
  onSubmitEditing = () => {
@@ -1745,7 +1831,6 @@ var TextField2 = React15.forwardRef(
1745
1831
  style = {},
1746
1832
  inputStyles = {},
1747
1833
  gutterBottom = 8,
1748
- placeholder,
1749
1834
  end,
1750
1835
  options,
1751
1836
  multiline,
@@ -1755,6 +1840,8 @@ var TextField2 = React15.forwardRef(
1755
1840
  const colors2 = useColors();
1756
1841
  const [focused, _setFocused] = useState7(false);
1757
1842
  const [showPassword, setShowPassword] = useState7(false);
1843
+ const [datePickerVisible, setDatePickerVisible] = useState7(false);
1844
+ const isDate = type === "date";
1758
1845
  const height2 = moderateScale2(
1759
1846
  multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
1760
1847
  );
@@ -1805,6 +1892,20 @@ var TextField2 = React15.forwardRef(
1805
1892
  color: colors2.textSecondary.light,
1806
1893
  paddingLeft: moderateScale2(10)
1807
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
+ },
1808
1909
  label: {},
1809
1910
  helperText: {
1810
1911
  paddingHorizontal: "15@s",
@@ -1843,6 +1944,42 @@ var TextField2 = React15.forwardRef(
1843
1944
  autoCapitalize: "none",
1844
1945
  textContentType: "password"
1845
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
+ };
1846
1983
  return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(View10, { style: styles.root }, label && /* @__PURE__ */ React15.createElement(
1847
1984
  Typography_default,
1848
1985
  {
@@ -1855,7 +1992,7 @@ var TextField2 = React15.forwardRef(
1855
1992
  ), /* @__PURE__ */ React15.createElement(
1856
1993
  TouchableOpacity7,
1857
1994
  {
1858
- onPress: () => setFocused(true),
1995
+ onPress: handleContainerPress,
1859
1996
  style: styles.container
1860
1997
  },
1861
1998
  /* @__PURE__ */ React15.createElement(View10, { style: { marginTop: multiline ? 5 : 0 } }, start),
@@ -1867,7 +2004,24 @@ var TextField2 = React15.forwardRef(
1867
2004
  style: { marginLeft: "auto", marginRight: 15 },
1868
2005
  color: colors2.dark.light
1869
2006
  }
1870
- )) : /* @__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(
1871
2025
  TextInput2,
1872
2026
  {
1873
2027
  ref,