@hoddy-ui/core 2.5.48 → 2.5.52

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.
@@ -65,6 +65,30 @@ function colors(theme) {
65
65
  text: "#ffffff",
66
66
  ...extraColors?.light?.primary,
67
67
  ...extraColors?.dark?.primary
68
+ },
69
+ error: {
70
+ ...extraColors?.light?.error,
71
+ ...extraColors?.dark?.error
72
+ },
73
+ secondary: {
74
+ ...extraColors?.light?.secondary,
75
+ ...extraColors?.dark?.secondary
76
+ },
77
+ warning: {
78
+ ...extraColors?.light?.warning,
79
+ ...extraColors?.dark?.warning
80
+ },
81
+ success: {
82
+ ...extraColors?.light?.success,
83
+ ...extraColors?.dark?.success
84
+ },
85
+ info: {
86
+ ...extraColors?.light?.info,
87
+ ...extraColors?.dark?.info
88
+ },
89
+ blue: {
90
+ ...extraColors?.light?.blue,
91
+ ...extraColors?.dark?.blue
68
92
  }
69
93
  };
70
94
  const dynamicColors = theme === "dark" ? darkColors : lightColors;
@@ -173,7 +197,7 @@ function initialize(config2) {
173
197
 
174
198
  // components/AdaptiveStatusBarNext.tsx
175
199
  import { useFocusEffect } from "expo-router";
176
- import React4, { useState as useState2 } from "react";
200
+ import React4 from "react";
177
201
  import { Platform as Platform3, StatusBar } from "react-native";
178
202
 
179
203
  // ../src/hooks.ts
@@ -422,7 +446,6 @@ var ConfigureSystemUI = () => {
422
446
  NavigationBar.setStyle("dark");
423
447
  }
424
448
  } else {
425
- NavigationBar.setBackgroundColorAsync(colors2.white[1]);
426
449
  if (theme === "dark") {
427
450
  NavigationBar.setButtonStyleAsync("light");
428
451
  } else {
@@ -554,15 +577,11 @@ var useNavScreenOptions = (type) => {
554
577
 
555
578
  // components/AdaptiveStatusBarNext.tsx
556
579
  var AdaptiveStatusBar = ({ translucent = false }) => {
557
- const [focused, setFocused] = useState2(false);
558
580
  const colors2 = useColors();
559
581
  const theme = useTheme();
560
582
  const statusbarHandler = () => {
561
583
  StatusBar.setBarStyle(theme === "dark" ? "light-content" : "dark-content");
562
584
  if (Platform3.OS === "android") {
563
- StatusBar.setBackgroundColor(
564
- translucent ? "transparent" : colors2.white[1]
565
- );
566
585
  StatusBar.setTranslucent(true);
567
586
  }
568
587
  };
@@ -1246,7 +1265,8 @@ var RatingInput = ({
1246
1265
  var RatingStars = ({
1247
1266
  rating = 0,
1248
1267
  size = 16,
1249
- color = "#FFD700"
1268
+ color = "#FFD700",
1269
+ inactiveColor = "textSecondary"
1250
1270
  }) => {
1251
1271
  const colors2 = useColors();
1252
1272
  const styles = ScaledSheet8.create({
@@ -1269,7 +1289,7 @@ var RatingStars = ({
1269
1289
  key: index,
1270
1290
  name: "star",
1271
1291
  size,
1272
- color: colors2.textSecondary.light
1292
+ color: colors2[inactiveColor]?.main || inactiveColor
1273
1293
  }
1274
1294
  )));
1275
1295
  };
@@ -1363,13 +1383,13 @@ import {
1363
1383
  TouchableOpacity as TouchableOpacity7,
1364
1384
  View as View10
1365
1385
  } from "react-native";
1386
+ import DateTimePickerModal from "react-native-modal-datetime-picker";
1366
1387
  import {
1367
1388
  ScaledSheet as ScaledSheet12,
1368
1389
  moderateScale as moderateScale2,
1369
1390
  ms as ms7,
1370
1391
  verticalScale
1371
1392
  } from "react-native-size-matters";
1372
- import DateTimePickerModal from "react-native-modal-datetime-picker";
1373
1393
 
1374
1394
  // ../src/Components/SelectMenu.tsx
1375
1395
  import { MaterialIcons as MaterialIcons4 } from "@expo/vector-icons";
@@ -1497,325 +1517,54 @@ var SelectMenu = ({
1497
1517
  var SelectMenu_default = SelectMenu;
1498
1518
 
1499
1519
  // ../src/Components/TextField.tsx
1500
- var TextField = ({
1501
- label,
1502
- keyboardType,
1503
- variant,
1504
- color = "primary",
1505
- value,
1506
- type,
1507
- placeholder = "",
1508
- helperText,
1509
- onChangeText,
1510
- onSubmitEditing = () => {
1511
- },
1512
- onFocus = () => {
1513
- },
1514
- onBlur = () => {
1515
- },
1516
- error,
1517
- start,
1518
- size = "normal",
1519
- rounded,
1520
- disabled = false,
1521
- style = {},
1522
- inputStyles = {},
1523
- gutterBottom = 0,
1524
- end,
1525
- options,
1526
- selectMenuProps,
1527
- ...props
1528
- }) => {
1529
- const colors2 = useColors();
1530
- const [focused, setFocused] = useState7(false);
1531
- const [datePickerVisible, setDatePickerVisible] = useState7(false);
1532
- const isDate = type === "date";
1533
- const height2 = moderateScale2(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1);
1534
- const labelAnim = useRef2(
1535
- new Animated3.Value(height2 / moderateScale2(variant === "text" ? 2.5 : 3.2))
1536
- ).current;
1537
- React15.useEffect(() => {
1538
- if (focused || value) {
1539
- Animated3.timing(labelAnim, {
1540
- toValue: verticalScale(variant === "text" ? 2 : 4),
1541
- duration: 300,
1542
- useNativeDriver: false
1543
- }).start();
1544
- } else {
1545
- Animated3.timing(labelAnim, {
1546
- toValue: height2 / moderateScale2(variant === "text" ? 2.5 : 3.2),
1547
- duration: 300,
1548
- useNativeDriver: false
1549
- }).start();
1550
- }
1551
- }, [focused, value]);
1552
- const styles = ScaledSheet12.create({
1553
- root: {
1554
- marginBottom: ms7(gutterBottom),
1555
- width: "100%",
1556
- ...style
1557
- },
1558
- container: {
1559
- height: height2,
1560
- overflow: "hidden",
1561
- backgroundColor: variant === "outlined" || variant === "text" ? "#fff0" : focused ? colors2.white[3] : colors2.white[4],
1562
- flexDirection: "row",
1563
- borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.textSecondary.main,
1564
- borderWidth: error ? 1 : variant === "outlined" ? focused ? 2 : 0.5 : 0,
1565
- borderBottomWidth: variant === "text" ? 0.5 : void 0,
1566
- width: "100%",
1567
- borderRadius: variant === "text" ? 0 : rounded ? 30 : 7,
1568
- alignItems: "center",
1569
- ...inputStyles
1570
- },
1571
- input: {
1572
- fontSize: "14@s",
1573
- flex: 1,
1574
- alignSelf: "stretch",
1575
- paddingLeft: variant === "text" ? 0 : moderateScale2(15),
1576
- paddingRight: moderateScale2(10),
1577
- paddingTop: "11@vs",
1578
- fontFamily: getFontFamily(400),
1579
- color: colors2.black[1],
1580
- zIndex: 10
1581
- // backgroundColor: "#284",
1582
- },
1583
- inputText: {
1584
- fontSize: "14@ms",
1585
- flex: 1,
1586
- paddingLeft: variant === "text" ? 0 : moderateScale2(15),
1587
- paddingTop: "13@ms"
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
- },
1604
- label: {
1605
- fontFamily: getFontFamily(400),
1606
- position: "absolute",
1607
- left: variant === "text" ? 0 : moderateScale2(15),
1608
- fontSize: focused || value ? "10@s" : "13@s",
1609
- color: focused ? colors2[color].main : colors2.textSecondary.main
1610
- },
1611
- helperText: {
1612
- paddingHorizontal: "15@s",
1613
- flex: 1,
1614
- color: focused ? colors2[color].dark : colors2.textSecondary.main,
1615
- paddingTop: "4@ms"
1616
- },
1617
- error: {
1618
- paddingLeft: 10,
1619
- paddingRight: 10,
1620
- paddingTop: 5,
1621
- flexDirection: "row",
1622
- alignItems: "center"
1623
- },
1624
- errorText: {
1625
- fontSize: 12,
1626
- marginLeft: 10
1627
- }
1628
- });
1629
- const formProps = type === "email" ? {
1630
- textContentType: "emailAddress",
1631
- keyboardType: "email-address",
1632
- autoCapitalize: "none",
1633
- autoCompleteType: "email"
1634
- } : type === "number" ? {
1635
- keyboardType: "numeric"
1636
- } : type === "tel" ? {
1637
- textContentType: "telephoneNumber",
1638
- keyboardType: "phone-pad"
1639
- } : type === "search" ? {
1640
- keyboardType: "web-search",
1641
- returnKeyType: "search",
1642
- autoCapitalize: "none"
1643
- } : type === "password" ? {
1644
- secureTextEntry: true,
1645
- autoCompleteType: "password",
1646
- autoCapitalize: "none",
1647
- textContentType: "password"
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
- };
1685
- return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(View10, { style: styles.root }, /* @__PURE__ */ React15.createElement(
1686
- TouchableOpacity7,
1687
- {
1688
- onPress: handleContainerPress,
1689
- style: styles.container
1690
- },
1691
- /* @__PURE__ */ React15.createElement(Animated3.Text, { style: { ...styles.label, top: labelAnim } }, label),
1692
- start,
1693
- options ? /* @__PURE__ */ React15.createElement(
1694
- View10,
1695
- {
1696
- style: { flex: 1, alignItems: "center", flexDirection: "row" }
1697
- },
1698
- options.find((cur) => cur.value === value)?.start && /* @__PURE__ */ React15.createElement(
1699
- View10,
1700
- {
1701
- style: {
1702
- paddingTop: variant !== "outlined" ? ms7(13) : 0,
1703
- paddingRight: 10
1704
- }
1705
- },
1706
- options.find((cur) => cur.value === value)?.start
1707
- ),
1708
- /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.inputText }, options.find((cur) => cur.value === value)?.label)
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(
1727
- TextInput2,
1728
- {
1729
- onFocus: () => {
1730
- onFocus();
1731
- setFocused(true);
1732
- },
1733
- onBlur: () => {
1734
- onBlur();
1735
- setFocused(false);
1736
- },
1737
- value,
1738
- onChangeText,
1739
- keyboardType,
1740
- editable: !disabled,
1741
- selectTextOnFocus: !disabled,
1742
- onSubmitEditing,
1743
- placeholderTextColor: colors2.textSecondary.main,
1744
- ...formProps,
1745
- ...props,
1746
- style: styles.input
1747
- }
1748
- ),
1749
- end && /* @__PURE__ */ React15.createElement(
1750
- View10,
1751
- {
1752
- style: {
1753
- marginRight: 20,
1754
- paddingTop: variant === "text" ? ms7(13) : 0
1755
- }
1756
- },
1757
- end
1758
- ),
1759
- options && /* @__PURE__ */ React15.createElement(
1760
- View10,
1761
- {
1762
- style: {
1763
- marginRight: variant === "text" ? 0 : 20,
1764
- paddingTop: variant === "text" ? ms7(13) : 0
1765
- }
1766
- },
1767
- /* @__PURE__ */ React15.createElement(
1768
- Ionicons4,
1769
- {
1770
- name: "chevron-down",
1771
- color: colors2.textSecondary.main,
1772
- size: 24
1773
- }
1774
- )
1775
- )
1776
- ), helperText && /* @__PURE__ */ React15.createElement(
1777
- Typography_default,
1778
- {
1779
- color: "textSecondary",
1780
- style: styles.helperText,
1781
- variant: "caption"
1782
- },
1783
- helperText
1784
- ), error && /* @__PURE__ */ React15.createElement(View10, { style: styles.error }, /* @__PURE__ */ React15.createElement(MaterialIcons5, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.errorText, color: "error" }, error))), options && /* @__PURE__ */ React15.createElement(
1785
- SelectMenu_default,
1786
- {
1787
- options,
1788
- value,
1789
- open: focused,
1790
- onClose: () => setFocused(false),
1791
- label,
1792
- helperText,
1793
- onChange: onChangeText,
1794
- ...selectMenuProps
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
- }
1808
- ));
1809
- };
1810
- var TextField2 = React15.forwardRef(
1520
+ var formPropsFromType = (type, showPassword) => type === "email" ? {
1521
+ textContentType: "emailAddress",
1522
+ keyboardType: "email-address",
1523
+ autoCapitalize: "none",
1524
+ autoCompleteType: "email"
1525
+ } : type === "number" ? { keyboardType: "numeric" } : type === "tel" ? {
1526
+ textContentType: "telephoneNumber",
1527
+ keyboardType: "phone-pad"
1528
+ } : type === "search" ? {
1529
+ keyboardType: "web-search",
1530
+ returnKeyType: "search",
1531
+ autoCapitalize: "none"
1532
+ } : type === "password" ? {
1533
+ secureTextEntry: !showPassword,
1534
+ autoCompleteType: "password",
1535
+ autoCapitalize: "none",
1536
+ textContentType: "password"
1537
+ } : {};
1538
+ function parseDateValue(value) {
1539
+ if (!value)
1540
+ return /* @__PURE__ */ new Date();
1541
+ if (value instanceof Date)
1542
+ return value;
1543
+ const isoParts = `${value}`.split("-");
1544
+ if (isoParts.length === 3) {
1545
+ const [year, month, day] = isoParts;
1546
+ const parsed = new Date(
1547
+ parseInt(year, 10),
1548
+ parseInt(month, 10) - 1,
1549
+ parseInt(day, 10)
1550
+ );
1551
+ if (!isNaN(parsed.getTime()))
1552
+ return parsed;
1553
+ }
1554
+ const fallback = new Date(value);
1555
+ return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
1556
+ }
1557
+ var TextFieldBase = React15.forwardRef(
1811
1558
  ({
1812
1559
  label,
1813
1560
  labelProps,
1561
+ labelVariant,
1814
1562
  keyboardType,
1563
+ variant = "outlined",
1815
1564
  color = "primary",
1816
1565
  value,
1817
1566
  type,
1818
- placeholder,
1567
+ placeholder = "",
1819
1568
  helperText,
1820
1569
  onChangeText,
1821
1570
  onSubmitEditing = () => {
@@ -1826,90 +1575,145 @@ var TextField2 = React15.forwardRef(
1826
1575
  },
1827
1576
  error,
1828
1577
  start,
1578
+ size = "normal",
1829
1579
  rounded,
1830
1580
  disabled = false,
1831
1581
  style = {},
1832
1582
  inputStyles = {},
1833
- gutterBottom = 8,
1583
+ gutterBottom,
1834
1584
  end,
1835
1585
  options,
1836
1586
  multiline,
1837
1587
  selectMenuProps,
1588
+ labelAlwaysOpen,
1838
1589
  ...props
1839
1590
  }, ref) => {
1840
1591
  const colors2 = useColors();
1592
+ const theme = useTheme();
1841
1593
  const [focused, _setFocused] = useState7(false);
1842
1594
  const [showPassword, setShowPassword] = useState7(false);
1843
1595
  const [datePickerVisible, setDatePickerVisible] = useState7(false);
1844
1596
  const isDate = type === "date";
1845
- const height2 = moderateScale2(
1597
+ const setFocused = (next) => {
1598
+ if (options && next) {
1599
+ Keyboard3.dismiss();
1600
+ setTimeout(() => _setFocused(next), 100);
1601
+ } else {
1602
+ _setFocused(next);
1603
+ }
1604
+ };
1605
+ const isFloating = labelVariant === "floating";
1606
+ const labelOpen = labelAlwaysOpen || focused || value;
1607
+ const baseHeight = moderateScale2(
1846
1608
  multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
1847
1609
  );
1848
- const setFocused = (value2) => {
1849
- if (options && value2) {
1850
- Keyboard3.dismiss();
1851
- setTimeout(() => {
1852
- _setFocused(value2);
1853
- }, 100);
1610
+ const sizeMultiplier = isFloating ? size === "large" ? 1.2 : size === "small" ? 0.8 : 1 : 1;
1611
+ const height2 = baseHeight * sizeMultiplier;
1612
+ const labelAnim = useRef2(
1613
+ new Animated3.Value(
1614
+ height2 / moderateScale2(variant === "text" ? 2.5 : 3.2)
1615
+ )
1616
+ ).current;
1617
+ React15.useEffect(() => {
1618
+ if (!isFloating)
1619
+ return;
1620
+ if (labelOpen) {
1621
+ Animated3.timing(labelAnim, {
1622
+ toValue: verticalScale(variant === "text" ? 2 : 4),
1623
+ duration: 300,
1624
+ useNativeDriver: false
1625
+ }).start();
1854
1626
  } else {
1855
- _setFocused(value2);
1627
+ Animated3.timing(labelAnim, {
1628
+ toValue: height2 / moderateScale2(variant === "text" ? 2.5 : 3.2),
1629
+ duration: 300,
1630
+ useNativeDriver: false
1631
+ }).start();
1632
+ }
1633
+ }, [isFloating, labelOpen, variant, height2]);
1634
+ const formProps = formPropsFromType(type, showPassword);
1635
+ const handleDateConfirm = (date) => {
1636
+ const year = date.getFullYear();
1637
+ const month = `${date.getMonth() + 1}`.padStart(2, "0");
1638
+ const day = `${date.getDate()}`.padStart(2, "0");
1639
+ onChangeText?.(`${year}-${month}-${day}`);
1640
+ setDatePickerVisible(false);
1641
+ setFocused(false);
1642
+ };
1643
+ const handleContainerPress = () => {
1644
+ if (disabled)
1645
+ return;
1646
+ setFocused(true);
1647
+ if (isDate) {
1648
+ onFocus();
1649
+ setDatePickerVisible(true);
1856
1650
  }
1857
1651
  };
1652
+ const inputPadding = variant === "text" ? 0 : moderateScale2(isFloating ? 15 : 10);
1653
+ const containerBorderRadius = variant === "text" ? 0 : rounded ? 30 : isFloating ? 7 : 10;
1654
+ const datePlaceholderColor = colors2.textSecondary.light;
1858
1655
  const styles = ScaledSheet12.create({
1859
1656
  root: {
1860
- marginBottom: ms7(gutterBottom),
1657
+ marginBottom: ms7(gutterBottom ?? (isFloating ? 0 : 8)),
1658
+ width: "100%",
1861
1659
  ...style
1862
1660
  },
1863
1661
  container: {
1864
1662
  height: height2,
1865
1663
  overflow: "hidden",
1866
1664
  flexDirection: "row",
1867
- borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.white[4],
1868
- borderWidth: error ? 1 : focused ? 2 : 1,
1665
+ backgroundColor: variant === "outlined" || variant === "text" ? "#fff0" : focused ? colors2.white[2] + "dd" : colors2.white[2],
1666
+ borderColor: error ? colors2.error.main : isFloating && focused && variant === "contained" ? colors2[color].light : focused ? colors2[color].main : colors2.textSecondary.main,
1667
+ borderWidth: error ? 1 : isFloating && focused && variant === "contained" ? 1 : variant === "outlined" ? focused ? 2 : 0.5 : 0,
1668
+ borderBottomWidth: variant === "text" ? 0.5 : void 0,
1869
1669
  width: "100%",
1870
- borderRadius: rounded ? 30 : 10,
1670
+ borderRadius: containerBorderRadius,
1871
1671
  alignItems: multiline ? "flex-start" : "center",
1872
1672
  paddingVertical: multiline ? 10 : 0,
1873
1673
  ...inputStyles
1874
1674
  },
1875
1675
  input: {
1876
- fontSize: "14@s",
1676
+ fontSize: "14@ms",
1877
1677
  flex: 1,
1878
1678
  alignSelf: "stretch",
1879
- paddingLeft: moderateScale2(10),
1679
+ padding: 0,
1680
+ paddingLeft: inputPadding,
1681
+ lineHeight: "18@ms",
1880
1682
  paddingRight: moderateScale2(10),
1881
- color: colors2.dark.main,
1683
+ ...isFloating ? { marginTop: "13@ms", fontFamily: getFontFamily(400) } : {},
1684
+ color: disabled ? colors2.textSecondary.main : colors2.dark.main,
1882
1685
  zIndex: 10
1883
- // backgroundColor: "#284",
1884
1686
  },
1885
1687
  inputText: {
1886
1688
  fontSize: "14@ms",
1887
- color: colors2.dark.main,
1888
- paddingLeft: moderateScale2(10)
1889
- },
1890
- placeholder: {
1891
- fontSize: "14@ms",
1892
- color: colors2.textSecondary.light,
1893
- paddingLeft: moderateScale2(10)
1689
+ flex: 1,
1690
+ paddingLeft: inputPadding,
1691
+ ...isFloating ? { paddingTop: "13@ms" } : {}
1894
1692
  },
1895
1693
  dateContent: {
1896
1694
  flexDirection: "row",
1897
1695
  alignItems: "center",
1898
1696
  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
1697
+ paddingLeft: inputPadding,
1698
+ paddingRight: moderateScale2(10),
1699
+ paddingTop: isFloating ? variant === "text" ? ms7(13) : ms7(12) : multiline ? 4 : 0
1908
1700
  },
1909
- label: {},
1701
+ dateText: { fontSize: "14@ms", flex: 1 },
1702
+ datePlaceholder: { color: datePlaceholderColor },
1703
+ ...isFloating ? {
1704
+ contentWrapper: { flex: 1, position: "relative" },
1705
+ label: {
1706
+ fontFamily: getFontFamily(400),
1707
+ position: "absolute",
1708
+ left: inputPadding,
1709
+ fontSize: labelOpen ? "10@ms" : "13@ms",
1710
+ color: error ? colors2.error.main : focused ? theme === "dark" ? colors2[color].light : colors2[color].main : colors2.textSecondary.main
1711
+ }
1712
+ } : {},
1910
1713
  helperText: {
1911
- paddingHorizontal: "15@s",
1912
- color: focused ? colors2[color].dark : "#fffa",
1714
+ paddingHorizontal: "15@ms",
1715
+ flex: 1,
1716
+ color: error ? colors2.error.main : focused ? theme === "dark" ? colors2[color].light : colors2[color].main : colors2.textSecondary.main,
1913
1717
  paddingTop: "4@ms"
1914
1718
  },
1915
1719
  error: {
@@ -1919,84 +1723,129 @@ var TextField2 = React15.forwardRef(
1919
1723
  flexDirection: "row",
1920
1724
  alignItems: "center"
1921
1725
  },
1922
- errorText: {
1923
- fontSize: 12,
1924
- marginLeft: 10
1726
+ errorText: { fontSize: 12, marginLeft: 10, fontWeight: "400" },
1727
+ placeholder: {
1728
+ fontSize: "14@ms",
1729
+ color: colors2.textSecondary.light,
1730
+ paddingLeft: inputPadding
1925
1731
  }
1926
1732
  });
1927
- const formProps = type === "email" ? {
1928
- textContentType: "emailAddress",
1929
- keyboardType: "email-address",
1930
- autoCapitalize: "none",
1931
- autoCompleteType: "email"
1932
- } : type === "number" ? {
1933
- keyboardType: "numeric"
1934
- } : type === "tel" ? {
1935
- textContentType: "telephoneNumber",
1936
- keyboardType: "phone-pad"
1937
- } : type === "search" ? {
1938
- keyboardType: "web-search",
1939
- returnKeyType: "search",
1940
- autoCapitalize: "none"
1941
- } : type === "password" ? {
1942
- secureTextEntry: !showPassword,
1943
- autoCompleteType: "password",
1944
- autoCapitalize: "none",
1945
- textContentType: "password"
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
- };
1983
- return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(View10, { style: styles.root }, label && /* @__PURE__ */ React15.createElement(
1733
+ const selectedOption = options?.find((cur) => cur.value === value);
1734
+ const showPasswordToggle = type === "password" && !end && !options && !isDate;
1735
+ return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(View10, { style: styles.root }, isFloating ? null : label != null && label !== "" ? /* @__PURE__ */ React15.createElement(
1984
1736
  Typography_default,
1985
1737
  {
1986
1738
  variant: "body2",
1987
- color: "textSecondary",
1739
+ color: error ? "error" : "textSecondary",
1988
1740
  gutterBottom: 7,
1989
1741
  ...labelProps
1990
1742
  },
1991
1743
  label
1992
- ), /* @__PURE__ */ React15.createElement(
1744
+ ) : null, /* @__PURE__ */ React15.createElement(
1993
1745
  TouchableOpacity7,
1994
1746
  {
1995
1747
  onPress: handleContainerPress,
1996
- style: styles.container
1748
+ style: styles.container,
1749
+ activeOpacity: 1
1997
1750
  },
1998
- /* @__PURE__ */ React15.createElement(View10, { style: { marginTop: multiline ? 5 : 0 } }, start),
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(
1751
+ /* @__PURE__ */ React15.createElement(View10, { style: { marginTop: multiline && !isFloating ? 5 : 0 } }, start),
1752
+ isFloating ? /* @__PURE__ */ React15.createElement(View10, { style: styles.contentWrapper }, label != null && label !== "" ? /* @__PURE__ */ React15.createElement(
1753
+ Animated3.Text,
1754
+ {
1755
+ style: { ...styles.label, top: labelAnim },
1756
+ pointerEvents: "none"
1757
+ },
1758
+ label
1759
+ ) : null, options ? /* @__PURE__ */ React15.createElement(
1760
+ View10,
1761
+ {
1762
+ style: {
1763
+ flex: 1,
1764
+ alignItems: "center",
1765
+ flexDirection: "row"
1766
+ }
1767
+ },
1768
+ isFloating && selectedOption?.start ? /* @__PURE__ */ React15.createElement(
1769
+ View10,
1770
+ {
1771
+ style: {
1772
+ paddingTop: variant !== "outlined" ? ms7(13) : 0,
1773
+ paddingRight: 10
1774
+ }
1775
+ },
1776
+ selectedOption.start
1777
+ ) : null,
1778
+ selectedOption ? /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.inputText }, selectedOption.label) : !isFloating && /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.placeholder }, placeholder),
1779
+ isFloating ? /* @__PURE__ */ React15.createElement(
1780
+ View10,
1781
+ {
1782
+ style: {
1783
+ marginRight: variant === "text" ? 0 : 20,
1784
+ paddingTop: variant === "text" ? ms7(13) : 0
1785
+ }
1786
+ },
1787
+ /* @__PURE__ */ React15.createElement(
1788
+ Ionicons4,
1789
+ {
1790
+ name: "chevron-down",
1791
+ color: colors2.textSecondary.main,
1792
+ size: 24
1793
+ }
1794
+ )
1795
+ ) : /* @__PURE__ */ React15.createElement(
1796
+ Ionicons4,
1797
+ {
1798
+ name: "chevron-down",
1799
+ size: 24,
1800
+ style: { marginLeft: "auto", marginRight: 15 },
1801
+ color: colors2.dark.light
1802
+ }
1803
+ )
1804
+ ) : isDate ? /* @__PURE__ */ React15.createElement(View10, { style: styles.dateContent }, /* @__PURE__ */ React15.createElement(
1805
+ Typography_default,
1806
+ {
1807
+ style: [
1808
+ styles.dateText,
1809
+ !value ? styles.datePlaceholder : void 0
1810
+ ],
1811
+ color: value ? "dark" : "textSecondary"
1812
+ },
1813
+ value || placeholder
1814
+ ), /* @__PURE__ */ React15.createElement(View10, { style: { marginLeft: 8 } }, end ?? /* @__PURE__ */ React15.createElement(
1815
+ Ionicons4,
1816
+ {
1817
+ name: "calendar-outline",
1818
+ size: 22,
1819
+ color: colors2.textSecondary.main
1820
+ }
1821
+ ))) : /* @__PURE__ */ React15.createElement(
1822
+ TextInput2,
1823
+ {
1824
+ ref,
1825
+ onFocus: () => {
1826
+ onFocus();
1827
+ setFocused(true);
1828
+ },
1829
+ onBlur: () => {
1830
+ onBlur();
1831
+ setFocused(false);
1832
+ },
1833
+ value,
1834
+ onChangeText,
1835
+ key: type === "password" ? showPassword ? "show" : "hide" : void 0,
1836
+ keyboardType,
1837
+ placeholderTextColor: colors2.textSecondary.light,
1838
+ editable: !disabled,
1839
+ placeholder: labelOpen ? placeholder : "",
1840
+ selectTextOnFocus: !disabled,
1841
+ onSubmitEditing,
1842
+ multiline,
1843
+ textAlignVertical: multiline ? "top" : "center",
1844
+ ...formProps,
1845
+ ...props,
1846
+ style: styles.input
1847
+ }
1848
+ )) : options ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, selectedOption ? /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.inputText }, selectedOption.label) : /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.placeholder }, placeholder), /* @__PURE__ */ React15.createElement(
2000
1849
  Ionicons4,
2001
1850
  {
2002
1851
  name: "chevron-down",
@@ -2035,7 +1884,7 @@ var TextField2 = React15.forwardRef(
2035
1884
  },
2036
1885
  value,
2037
1886
  onChangeText,
2038
- key: showPassword ? "show" : "hide",
1887
+ key: type === "password" ? showPassword ? "show" : "hide" : void 0,
2039
1888
  keyboardType,
2040
1889
  placeholderTextColor: colors2.textSecondary.light,
2041
1890
  editable: !disabled,
@@ -2043,13 +1892,22 @@ var TextField2 = React15.forwardRef(
2043
1892
  selectTextOnFocus: !disabled,
2044
1893
  onSubmitEditing,
2045
1894
  multiline,
2046
- extAlignVertical: multiline ? "top" : "center",
1895
+ textAlignVertical: multiline ? "top" : "center",
2047
1896
  ...formProps,
2048
1897
  ...props,
2049
1898
  style: styles.input
2050
1899
  }
2051
1900
  ),
2052
- end ? /* @__PURE__ */ React15.createElement(View10, { style: { marginRight: 20 } }, end) : type === "password" && /* @__PURE__ */ React15.createElement(
1901
+ end && !options ? /* @__PURE__ */ React15.createElement(
1902
+ View10,
1903
+ {
1904
+ style: {
1905
+ marginRight: 20,
1906
+ paddingTop: isFloating && variant === "text" ? ms7(13) : 0
1907
+ }
1908
+ },
1909
+ end
1910
+ ) : showPasswordToggle ? /* @__PURE__ */ React15.createElement(
2053
1911
  TouchableOpacity7,
2054
1912
  {
2055
1913
  style: { marginRight: 20 },
@@ -2063,16 +1921,16 @@ var TextField2 = React15.forwardRef(
2063
1921
  color: colors2.textSecondary.main
2064
1922
  }
2065
1923
  )
2066
- )
2067
- ), helperText && /* @__PURE__ */ React15.createElement(
1924
+ ) : null
1925
+ ), helperText ? /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.helperText, variant: "caption" }, helperText) : null, error ? /* @__PURE__ */ React15.createElement(View10, { style: styles.error }, /* @__PURE__ */ React15.createElement(MaterialIcons5, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ React15.createElement(
2068
1926
  Typography_default,
2069
1927
  {
2070
- color: "textSecondary",
2071
- style: styles.helperText,
2072
- variant: "caption"
1928
+ style: styles.errorText,
1929
+ color: "error",
1930
+ fontWeight: 400
2073
1931
  },
2074
- helperText
2075
- ), error && /* @__PURE__ */ React15.createElement(View10, { style: styles.error }, /* @__PURE__ */ React15.createElement(MaterialIcons5, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.errorText, color: "error" }, error))), options && /* @__PURE__ */ React15.createElement(
1932
+ error
1933
+ )) : null), options ? /* @__PURE__ */ React15.createElement(
2076
1934
  SelectMenu_default,
2077
1935
  {
2078
1936
  options,
@@ -2084,9 +1942,45 @@ var TextField2 = React15.forwardRef(
2084
1942
  onChange: onChangeText,
2085
1943
  ...selectMenuProps
2086
1944
  }
2087
- ));
1945
+ ) : null, isDate ? /* @__PURE__ */ React15.createElement(
1946
+ DateTimePickerModal,
1947
+ {
1948
+ isVisible: datePickerVisible,
1949
+ mode: "date",
1950
+ date: parseDateValue(value),
1951
+ onConfirm: handleDateConfirm,
1952
+ onCancel: () => {
1953
+ setDatePickerVisible(false);
1954
+ setFocused(false);
1955
+ }
1956
+ }
1957
+ ) : null);
1958
+ }
1959
+ );
1960
+ TextFieldBase.displayName = "TextFieldBase";
1961
+ var TextField = React15.forwardRef((props, ref) => /* @__PURE__ */ React15.createElement(
1962
+ TextFieldBase,
1963
+ {
1964
+ ...props,
1965
+ ref,
1966
+ labelVariant: "floating",
1967
+ gutterBottom: props.gutterBottom ?? 0,
1968
+ placeholder: props.placeholder ?? ""
2088
1969
  }
1970
+ ));
1971
+ TextField.displayName = "TextField";
1972
+ var TextField2 = React15.forwardRef(
1973
+ (props, ref) => /* @__PURE__ */ React15.createElement(
1974
+ TextFieldBase,
1975
+ {
1976
+ ...props,
1977
+ ref,
1978
+ labelVariant: "external",
1979
+ gutterBottom: props.gutterBottom ?? 8
1980
+ }
1981
+ )
2089
1982
  );
1983
+ TextField2.displayName = "TextField2";
2090
1984
  var TextField_default = TextField;
2091
1985
 
2092
1986
  // ../src/Components/Locator.tsx
@@ -3053,6 +2947,7 @@ export {
3053
2947
  Spinner_default as Spinner,
3054
2948
  TextField_default as TextField,
3055
2949
  TextField2,
2950
+ TextFieldBase,
3056
2951
  Typography_default as Typography,
3057
2952
  UIThemeContext,
3058
2953
  UIThemeProvider,