@hoddy-ui/next 2.5.86 → 2.5.88

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.
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ __export(next_exports, {
52
52
  Spinner: () => Spinner_default,
53
53
  TextField: () => TextField_default,
54
54
  TextField2: () => TextField2,
55
+ TextFieldBase: () => TextFieldBase,
55
56
  Typography: () => Typography_default,
56
57
  UIThemeContext: () => UIThemeContext,
57
58
  UIThemeProvider: () => UIThemeProvider,
@@ -1532,325 +1533,54 @@ var SelectMenu = ({
1532
1533
  var SelectMenu_default = SelectMenu;
1533
1534
 
1534
1535
  // ../src/Components/TextField.tsx
1535
- var TextField = ({
1536
- label,
1537
- keyboardType,
1538
- variant,
1539
- color = "primary",
1540
- value,
1541
- type,
1542
- placeholder = "",
1543
- helperText,
1544
- onChangeText,
1545
- onSubmitEditing = () => {
1546
- },
1547
- onFocus = () => {
1548
- },
1549
- onBlur = () => {
1550
- },
1551
- error,
1552
- start,
1553
- size = "normal",
1554
- rounded,
1555
- disabled = false,
1556
- style = {},
1557
- inputStyles = {},
1558
- gutterBottom = 0,
1559
- end,
1560
- options,
1561
- selectMenuProps,
1562
- ...props
1563
- }) => {
1564
- const colors2 = useColors();
1565
- const [focused, setFocused] = (0, import_react16.useState)(false);
1566
- const [datePickerVisible, setDatePickerVisible] = (0, import_react16.useState)(false);
1567
- const isDate = type === "date";
1568
- const height2 = (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1);
1569
- const labelAnim = (0, import_react16.useRef)(
1570
- new import_react_native16.Animated.Value(height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2))
1571
- ).current;
1572
- import_react16.default.useEffect(() => {
1573
- if (focused || value) {
1574
- import_react_native16.Animated.timing(labelAnim, {
1575
- toValue: (0, import_react_native_size_matters13.verticalScale)(variant === "text" ? 2 : 4),
1576
- duration: 300,
1577
- useNativeDriver: false
1578
- }).start();
1579
- } else {
1580
- import_react_native16.Animated.timing(labelAnim, {
1581
- toValue: height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2),
1582
- duration: 300,
1583
- useNativeDriver: false
1584
- }).start();
1585
- }
1586
- }, [focused, value]);
1587
- const styles = import_react_native_size_matters13.ScaledSheet.create({
1588
- root: {
1589
- marginBottom: (0, import_react_native_size_matters13.ms)(gutterBottom),
1590
- width: "100%",
1591
- ...style
1592
- },
1593
- container: {
1594
- height: height2,
1595
- overflow: "hidden",
1596
- backgroundColor: variant === "outlined" || variant === "text" ? "#fff0" : focused ? colors2.white[3] : colors2.white[4],
1597
- flexDirection: "row",
1598
- borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.textSecondary.main,
1599
- borderWidth: error ? 1 : variant === "outlined" ? focused ? 2 : 0.5 : 0,
1600
- borderBottomWidth: variant === "text" ? 0.5 : void 0,
1601
- width: "100%",
1602
- borderRadius: variant === "text" ? 0 : rounded ? 30 : 7,
1603
- alignItems: "center",
1604
- ...inputStyles
1605
- },
1606
- input: {
1607
- fontSize: "14@s",
1608
- flex: 1,
1609
- alignSelf: "stretch",
1610
- paddingLeft: variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(15),
1611
- paddingRight: (0, import_react_native_size_matters13.moderateScale)(10),
1612
- paddingTop: "11@vs",
1613
- fontFamily: getFontFamily(400),
1614
- color: disabled ? colors2.textSecondary.main : colors2.dark.main,
1615
- zIndex: 10
1616
- // backgroundColor: "#284",
1617
- },
1618
- inputText: {
1619
- fontSize: "14@ms",
1620
- flex: 1,
1621
- paddingLeft: variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(15),
1622
- paddingTop: "13@ms"
1623
- },
1624
- dateContent: {
1625
- flexDirection: "row",
1626
- alignItems: "center",
1627
- flex: 1,
1628
- paddingLeft: variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(15),
1629
- paddingRight: (0, import_react_native_size_matters13.moderateScale)(10),
1630
- paddingTop: variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : (0, import_react_native_size_matters13.ms)(12)
1631
- },
1632
- dateText: {
1633
- fontSize: "14@ms",
1634
- flex: 1
1635
- },
1636
- datePlaceholder: {
1637
- color: colors2.textSecondary.main
1638
- },
1639
- label: {
1640
- fontFamily: getFontFamily(400),
1641
- position: "absolute",
1642
- left: variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(15),
1643
- fontSize: focused || value ? "10@s" : "13@s",
1644
- color: focused ? colors2[color].main : colors2.textSecondary.main
1645
- },
1646
- helperText: {
1647
- paddingHorizontal: "15@s",
1648
- flex: 1,
1649
- color: focused ? colors2[color].dark : colors2.textSecondary.main,
1650
- paddingTop: "4@ms"
1651
- },
1652
- error: {
1653
- paddingLeft: 10,
1654
- paddingRight: 10,
1655
- paddingTop: 5,
1656
- flexDirection: "row",
1657
- alignItems: "center"
1658
- },
1659
- errorText: {
1660
- fontSize: 12,
1661
- marginLeft: 10
1662
- }
1663
- });
1664
- const formProps = type === "email" ? {
1665
- textContentType: "emailAddress",
1666
- keyboardType: "email-address",
1667
- autoCapitalize: "none",
1668
- autoCompleteType: "email"
1669
- } : type === "number" ? {
1670
- keyboardType: "numeric"
1671
- } : type === "tel" ? {
1672
- textContentType: "telephoneNumber",
1673
- keyboardType: "phone-pad"
1674
- } : type === "search" ? {
1675
- keyboardType: "web-search",
1676
- returnKeyType: "search",
1677
- autoCapitalize: "none"
1678
- } : type === "password" ? {
1679
- secureTextEntry: true,
1680
- autoCompleteType: "password",
1681
- autoCapitalize: "none",
1682
- textContentType: "password"
1683
- } : {};
1684
- const parseDateValue = () => {
1685
- if (!value)
1686
- return /* @__PURE__ */ new Date();
1687
- if (value instanceof Date)
1688
- return value;
1689
- const isoParts = `${value}`.split("-");
1690
- if (isoParts.length === 3) {
1691
- const [year, month, day] = isoParts;
1692
- const parsed = new Date(
1693
- parseInt(year, 10),
1694
- parseInt(month, 10) - 1,
1695
- parseInt(day, 10)
1696
- );
1697
- if (!isNaN(parsed.getTime()))
1698
- return parsed;
1699
- }
1700
- const fallback = new Date(value);
1701
- return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
1702
- };
1703
- const handleDateConfirm = (date) => {
1704
- const year = date.getFullYear();
1705
- const month = `${date.getMonth() + 1}`.padStart(2, "0");
1706
- const day = `${date.getDate()}`.padStart(2, "0");
1707
- const dateString = `${year}-${month}-${day}`;
1708
- onChangeText?.(dateString);
1709
- setDatePickerVisible(false);
1710
- };
1711
- const handleContainerPress = () => {
1712
- if (disabled)
1713
- return;
1714
- setFocused(true);
1715
- if (isDate) {
1716
- onFocus();
1717
- setDatePickerVisible(true);
1718
- }
1719
- };
1720
- return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.root }, /* @__PURE__ */ import_react16.default.createElement(
1721
- import_react_native16.TouchableOpacity,
1722
- {
1723
- onPress: handleContainerPress,
1724
- style: styles.container
1725
- },
1726
- /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Animated.Text, { style: { ...styles.label, top: labelAnim } }, label),
1727
- start,
1728
- options ? /* @__PURE__ */ import_react16.default.createElement(
1729
- import_react_native16.View,
1730
- {
1731
- style: { flex: 1, alignItems: "center", flexDirection: "row" }
1732
- },
1733
- options.find((cur) => cur.value === value)?.start && /* @__PURE__ */ import_react16.default.createElement(
1734
- import_react_native16.View,
1735
- {
1736
- style: {
1737
- paddingTop: variant !== "outlined" ? (0, import_react_native_size_matters13.ms)(13) : 0,
1738
- paddingRight: 10
1739
- }
1740
- },
1741
- options.find((cur) => cur.value === value)?.start
1742
- ),
1743
- /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.inputText }, options.find((cur) => cur.value === value)?.label)
1744
- ) : isDate ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.dateContent }, /* @__PURE__ */ import_react16.default.createElement(
1745
- Typography_default,
1746
- {
1747
- style: [
1748
- styles.dateText,
1749
- !value ? styles.datePlaceholder : void 0
1750
- ],
1751
- color: value ? "dark" : "textSecondary"
1752
- },
1753
- value || placeholder
1754
- ), /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginLeft: 8 } }, end ?? /* @__PURE__ */ import_react16.default.createElement(
1755
- import_vector_icons8.Ionicons,
1756
- {
1757
- name: "calendar-outline",
1758
- size: 22,
1759
- color: colors2.textSecondary.main
1760
- }
1761
- ))) : /* @__PURE__ */ import_react16.default.createElement(
1762
- import_react_native16.TextInput,
1763
- {
1764
- onFocus: () => {
1765
- onFocus();
1766
- setFocused(true);
1767
- },
1768
- onBlur: () => {
1769
- onBlur();
1770
- setFocused(false);
1771
- },
1772
- value,
1773
- onChangeText,
1774
- keyboardType,
1775
- editable: !disabled,
1776
- selectTextOnFocus: !disabled,
1777
- onSubmitEditing,
1778
- placeholderTextColor: colors2.textSecondary.main,
1779
- ...formProps,
1780
- ...props,
1781
- style: styles.input
1782
- }
1783
- ),
1784
- end && /* @__PURE__ */ import_react16.default.createElement(
1785
- import_react_native16.View,
1786
- {
1787
- style: {
1788
- marginRight: 20,
1789
- paddingTop: variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : 0
1790
- }
1791
- },
1792
- end
1793
- ),
1794
- options && /* @__PURE__ */ import_react16.default.createElement(
1795
- import_react_native16.View,
1796
- {
1797
- style: {
1798
- marginRight: variant === "text" ? 0 : 20,
1799
- paddingTop: variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : 0
1800
- }
1801
- },
1802
- /* @__PURE__ */ import_react16.default.createElement(
1803
- import_vector_icons8.Ionicons,
1804
- {
1805
- name: "chevron-down",
1806
- color: colors2.textSecondary.main,
1807
- size: 24
1808
- }
1809
- )
1810
- )
1811
- ), helperText && /* @__PURE__ */ import_react16.default.createElement(
1812
- Typography_default,
1813
- {
1814
- color: "textSecondary",
1815
- style: styles.helperText,
1816
- variant: "caption"
1817
- },
1818
- helperText
1819
- ), error && /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.error }, /* @__PURE__ */ import_react16.default.createElement(import_vector_icons8.MaterialIcons, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.errorText, color: "error" }, error))), options && /* @__PURE__ */ import_react16.default.createElement(
1820
- SelectMenu_default,
1821
- {
1822
- options,
1823
- value,
1824
- open: focused,
1825
- onClose: () => setFocused(false),
1826
- label,
1827
- helperText,
1828
- onChange: onChangeText,
1829
- ...selectMenuProps
1830
- }
1831
- ), isDate && /* @__PURE__ */ import_react16.default.createElement(
1832
- import_react_native_modal_datetime_picker.default,
1833
- {
1834
- isVisible: datePickerVisible,
1835
- mode: "date",
1836
- date: parseDateValue(),
1837
- onConfirm: handleDateConfirm,
1838
- onCancel: () => {
1839
- setDatePickerVisible(false);
1840
- setFocused(false);
1841
- }
1842
- }
1843
- ));
1844
- };
1845
- var TextField2 = import_react16.default.forwardRef(
1536
+ var formPropsFromType = (type, showPassword) => type === "email" ? {
1537
+ textContentType: "emailAddress",
1538
+ keyboardType: "email-address",
1539
+ autoCapitalize: "none",
1540
+ autoCompleteType: "email"
1541
+ } : type === "number" ? { keyboardType: "numeric" } : type === "tel" ? {
1542
+ textContentType: "telephoneNumber",
1543
+ keyboardType: "phone-pad"
1544
+ } : type === "search" ? {
1545
+ keyboardType: "web-search",
1546
+ returnKeyType: "search",
1547
+ autoCapitalize: "none"
1548
+ } : type === "password" ? {
1549
+ secureTextEntry: !showPassword,
1550
+ autoCompleteType: "password",
1551
+ autoCapitalize: "none",
1552
+ textContentType: "password"
1553
+ } : {};
1554
+ function parseDateValue(value) {
1555
+ if (!value)
1556
+ return /* @__PURE__ */ new Date();
1557
+ if (value instanceof Date)
1558
+ return value;
1559
+ const isoParts = `${value}`.split("-");
1560
+ if (isoParts.length === 3) {
1561
+ const [year, month, day] = isoParts;
1562
+ const parsed = new Date(
1563
+ parseInt(year, 10),
1564
+ parseInt(month, 10) - 1,
1565
+ parseInt(day, 10)
1566
+ );
1567
+ if (!isNaN(parsed.getTime()))
1568
+ return parsed;
1569
+ }
1570
+ const fallback = new Date(value);
1571
+ return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
1572
+ }
1573
+ var TextFieldBase = import_react16.default.forwardRef(
1846
1574
  ({
1847
1575
  label,
1848
1576
  labelProps,
1577
+ labelVariant,
1849
1578
  keyboardType,
1579
+ variant = "outlined",
1850
1580
  color = "primary",
1851
1581
  value,
1852
1582
  type,
1853
- placeholder,
1583
+ placeholder = "",
1854
1584
  helperText,
1855
1585
  onChangeText,
1856
1586
  onSubmitEditing = () => {
@@ -1861,11 +1591,12 @@ var TextField2 = import_react16.default.forwardRef(
1861
1591
  },
1862
1592
  error,
1863
1593
  start,
1594
+ size = "normal",
1864
1595
  rounded,
1865
1596
  disabled = false,
1866
1597
  style = {},
1867
1598
  inputStyles = {},
1868
- gutterBottom = 8,
1599
+ gutterBottom,
1869
1600
  end,
1870
1601
  options,
1871
1602
  multiline,
@@ -1877,32 +1608,81 @@ var TextField2 = import_react16.default.forwardRef(
1877
1608
  const [showPassword, setShowPassword] = (0, import_react16.useState)(false);
1878
1609
  const [datePickerVisible, setDatePickerVisible] = (0, import_react16.useState)(false);
1879
1610
  const isDate = type === "date";
1880
- const height2 = (0, import_react_native_size_matters13.moderateScale)(
1611
+ const setFocused = (next) => {
1612
+ if (options && next) {
1613
+ import_react_native16.Keyboard.dismiss();
1614
+ setTimeout(() => _setFocused(next), 100);
1615
+ } else {
1616
+ _setFocused(next);
1617
+ }
1618
+ };
1619
+ const isFloating = labelVariant === "floating";
1620
+ const hasPlaceholder = placeholder != null && String(placeholder).trim() !== "";
1621
+ const labelOpen = focused || value || isFloating && hasPlaceholder;
1622
+ const baseHeight = (0, import_react_native_size_matters13.moderateScale)(
1881
1623
  multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
1882
1624
  );
1883
- const setFocused = (value2) => {
1884
- if (options && value2) {
1885
- import_react_native16.Keyboard.dismiss();
1886
- setTimeout(() => {
1887
- _setFocused(value2);
1888
- }, 100);
1625
+ const sizeMultiplier = isFloating ? size === "large" ? 1.2 : size === "small" ? 0.8 : 1 : 1;
1626
+ const height2 = baseHeight * sizeMultiplier;
1627
+ const labelAnim = (0, import_react16.useRef)(
1628
+ new import_react_native16.Animated.Value(
1629
+ height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2)
1630
+ )
1631
+ ).current;
1632
+ import_react16.default.useEffect(() => {
1633
+ if (!isFloating)
1634
+ return;
1635
+ if (labelOpen) {
1636
+ import_react_native16.Animated.timing(labelAnim, {
1637
+ toValue: (0, import_react_native_size_matters13.verticalScale)(variant === "text" ? 2 : 4),
1638
+ duration: 300,
1639
+ useNativeDriver: false
1640
+ }).start();
1889
1641
  } else {
1890
- _setFocused(value2);
1642
+ import_react_native16.Animated.timing(labelAnim, {
1643
+ toValue: height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2),
1644
+ duration: 300,
1645
+ useNativeDriver: false
1646
+ }).start();
1647
+ }
1648
+ }, [isFloating, labelOpen, variant, height2]);
1649
+ const formProps = formPropsFromType(type, showPassword);
1650
+ const handleDateConfirm = (date) => {
1651
+ const year = date.getFullYear();
1652
+ const month = `${date.getMonth() + 1}`.padStart(2, "0");
1653
+ const day = `${date.getDate()}`.padStart(2, "0");
1654
+ onChangeText?.(`${year}-${month}-${day}`);
1655
+ setDatePickerVisible(false);
1656
+ setFocused(false);
1657
+ };
1658
+ const handleContainerPress = () => {
1659
+ if (disabled)
1660
+ return;
1661
+ setFocused(true);
1662
+ if (isDate) {
1663
+ onFocus();
1664
+ setDatePickerVisible(true);
1891
1665
  }
1892
1666
  };
1667
+ const inputPadding = variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(isFloating ? 15 : 10);
1668
+ const containerBorderRadius = variant === "text" ? 0 : rounded ? 30 : isFloating ? 7 : 10;
1669
+ const datePlaceholderColor = colors2.textSecondary.light;
1893
1670
  const styles = import_react_native_size_matters13.ScaledSheet.create({
1894
1671
  root: {
1895
- marginBottom: (0, import_react_native_size_matters13.ms)(gutterBottom),
1672
+ marginBottom: (0, import_react_native_size_matters13.ms)(gutterBottom ?? (isFloating ? 0 : 8)),
1673
+ width: "100%",
1896
1674
  ...style
1897
1675
  },
1898
1676
  container: {
1899
1677
  height: height2,
1900
1678
  overflow: "hidden",
1901
1679
  flexDirection: "row",
1902
- borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.white[4],
1903
- borderWidth: error ? 1 : focused ? 2 : 1,
1680
+ backgroundColor: variant === "outlined" || variant === "text" ? "#fff0" : focused ? colors2.white[3] : colors2.white[2],
1681
+ borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.textSecondary.main,
1682
+ borderWidth: error ? 1 : variant === "outlined" ? focused ? 2 : 0.5 : 0,
1683
+ borderBottomWidth: variant === "text" ? 0.5 : void 0,
1904
1684
  width: "100%",
1905
- borderRadius: rounded ? 30 : 10,
1685
+ borderRadius: containerBorderRadius,
1906
1686
  alignItems: multiline ? "flex-start" : "center",
1907
1687
  paddingVertical: multiline ? 10 : 0,
1908
1688
  ...inputStyles
@@ -1911,40 +1691,42 @@ var TextField2 = import_react16.default.forwardRef(
1911
1691
  fontSize: "14@s",
1912
1692
  flex: 1,
1913
1693
  alignSelf: "stretch",
1914
- paddingLeft: (0, import_react_native_size_matters13.moderateScale)(10),
1694
+ paddingLeft: inputPadding,
1915
1695
  paddingRight: (0, import_react_native_size_matters13.moderateScale)(10),
1696
+ ...isFloating ? { paddingTop: "11@vs", fontFamily: getFontFamily(400) } : {},
1916
1697
  color: disabled ? colors2.textSecondary.main : colors2.dark.main,
1917
1698
  zIndex: 10
1918
- // backgroundColor: "#284",
1919
1699
  },
1920
1700
  inputText: {
1921
1701
  fontSize: "14@ms",
1922
- color: colors2.dark.main,
1923
- paddingLeft: (0, import_react_native_size_matters13.moderateScale)(10)
1924
- },
1925
- placeholder: {
1926
- fontSize: "14@ms",
1927
- color: colors2.textSecondary.light,
1928
- paddingLeft: (0, import_react_native_size_matters13.moderateScale)(10)
1702
+ flex: 1,
1703
+ paddingLeft: inputPadding,
1704
+ ...isFloating ? { paddingTop: "13@ms" } : {}
1929
1705
  },
1930
1706
  dateContent: {
1931
1707
  flexDirection: "row",
1932
1708
  alignItems: "center",
1933
1709
  flex: 1,
1934
- paddingHorizontal: (0, import_react_native_size_matters13.moderateScale)(10),
1935
- paddingTop: multiline ? 4 : 0
1936
- },
1937
- dateText: {
1938
- fontSize: "14@ms",
1939
- flex: 1
1940
- },
1941
- datePlaceholder: {
1942
- color: colors2.textSecondary.light
1710
+ paddingLeft: inputPadding,
1711
+ paddingRight: (0, import_react_native_size_matters13.moderateScale)(10),
1712
+ paddingTop: isFloating ? variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : (0, import_react_native_size_matters13.ms)(12) : multiline ? 4 : 0
1943
1713
  },
1944
- label: {},
1714
+ dateText: { fontSize: "14@ms", flex: 1 },
1715
+ datePlaceholder: { color: datePlaceholderColor },
1716
+ ...isFloating ? {
1717
+ contentWrapper: { flex: 1, position: "relative" },
1718
+ label: {
1719
+ fontFamily: getFontFamily(400),
1720
+ position: "absolute",
1721
+ left: inputPadding,
1722
+ fontSize: labelOpen ? "10@s" : "13@s",
1723
+ color: focused ? colors2[color].main : colors2.textSecondary.main
1724
+ }
1725
+ } : {},
1945
1726
  helperText: {
1946
1727
  paddingHorizontal: "15@s",
1947
- color: focused ? colors2[color].dark : "#fffa",
1728
+ flex: 1,
1729
+ color: focused ? colors2[color].dark : colors2.textSecondary.main,
1948
1730
  paddingTop: "4@ms"
1949
1731
  },
1950
1732
  error: {
@@ -1954,69 +1736,16 @@ var TextField2 = import_react16.default.forwardRef(
1954
1736
  flexDirection: "row",
1955
1737
  alignItems: "center"
1956
1738
  },
1957
- errorText: {
1958
- fontSize: 12,
1959
- marginLeft: 10
1739
+ errorText: { fontSize: 12, marginLeft: 10 },
1740
+ placeholder: {
1741
+ fontSize: "14@ms",
1742
+ color: colors2.textSecondary.light,
1743
+ paddingLeft: inputPadding
1960
1744
  }
1961
1745
  });
1962
- const formProps = type === "email" ? {
1963
- textContentType: "emailAddress",
1964
- keyboardType: "email-address",
1965
- autoCapitalize: "none",
1966
- autoCompleteType: "email"
1967
- } : type === "number" ? {
1968
- keyboardType: "numeric"
1969
- } : type === "tel" ? {
1970
- textContentType: "telephoneNumber",
1971
- keyboardType: "phone-pad"
1972
- } : type === "search" ? {
1973
- keyboardType: "web-search",
1974
- returnKeyType: "search",
1975
- autoCapitalize: "none"
1976
- } : type === "password" ? {
1977
- secureTextEntry: !showPassword,
1978
- autoCompleteType: "password",
1979
- autoCapitalize: "none",
1980
- textContentType: "password"
1981
- } : {};
1982
- const parseDateValue = () => {
1983
- if (!value)
1984
- return /* @__PURE__ */ new Date();
1985
- if (value instanceof Date)
1986
- return value;
1987
- const isoParts = `${value}`.split("-");
1988
- if (isoParts.length === 3) {
1989
- const [year, month, day] = isoParts;
1990
- const parsed = new Date(
1991
- parseInt(year, 10),
1992
- parseInt(month, 10) - 1,
1993
- parseInt(day, 10)
1994
- );
1995
- if (!isNaN(parsed.getTime()))
1996
- return parsed;
1997
- }
1998
- const fallback = new Date(value);
1999
- return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
2000
- };
2001
- const handleDateConfirm = (date) => {
2002
- const year = date.getFullYear();
2003
- const month = `${date.getMonth() + 1}`.padStart(2, "0");
2004
- const day = `${date.getDate()}`.padStart(2, "0");
2005
- const dateString = `${year}-${month}-${day}`;
2006
- onChangeText?.(dateString);
2007
- setDatePickerVisible(false);
2008
- setFocused(false);
2009
- };
2010
- const handleContainerPress = () => {
2011
- if (disabled)
2012
- return;
2013
- setFocused(true);
2014
- if (isDate) {
2015
- onFocus();
2016
- setDatePickerVisible(true);
2017
- }
2018
- };
2019
- return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.root }, label && /* @__PURE__ */ import_react16.default.createElement(
1746
+ const selectedOption = options?.find((cur) => cur.value === value);
1747
+ const showPasswordToggle = type === "password" && !end && !options && !isDate;
1748
+ return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.root }, isFloating ? null : label != null && label !== "" ? /* @__PURE__ */ import_react16.default.createElement(
2020
1749
  Typography_default,
2021
1750
  {
2022
1751
  variant: "body2",
@@ -2025,14 +1754,111 @@ var TextField2 = import_react16.default.forwardRef(
2025
1754
  ...labelProps
2026
1755
  },
2027
1756
  label
2028
- ), /* @__PURE__ */ import_react16.default.createElement(
1757
+ ) : null, /* @__PURE__ */ import_react16.default.createElement(
2029
1758
  import_react_native16.TouchableOpacity,
2030
1759
  {
2031
1760
  onPress: handleContainerPress,
2032
- style: styles.container
1761
+ style: styles.container,
1762
+ activeOpacity: 1
2033
1763
  },
2034
- /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginTop: multiline ? 5 : 0 } }, start),
2035
- options ? /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, value ? /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.inputText }, options.find((cur) => cur.value === value)?.label) : /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.placeholder }, placeholder), /* @__PURE__ */ import_react16.default.createElement(
1764
+ /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginTop: multiline && !isFloating ? 5 : 0 } }, start),
1765
+ isFloating ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.contentWrapper }, label != null && label !== "" ? /* @__PURE__ */ import_react16.default.createElement(
1766
+ import_react_native16.Animated.Text,
1767
+ {
1768
+ style: { ...styles.label, top: labelAnim },
1769
+ pointerEvents: "none"
1770
+ },
1771
+ label
1772
+ ) : null, options ? /* @__PURE__ */ import_react16.default.createElement(
1773
+ import_react_native16.View,
1774
+ {
1775
+ style: {
1776
+ flex: 1,
1777
+ alignItems: "center",
1778
+ flexDirection: "row"
1779
+ }
1780
+ },
1781
+ isFloating && selectedOption?.start ? /* @__PURE__ */ import_react16.default.createElement(
1782
+ import_react_native16.View,
1783
+ {
1784
+ style: {
1785
+ paddingTop: variant !== "outlined" ? (0, import_react_native_size_matters13.ms)(13) : 0,
1786
+ paddingRight: 10
1787
+ }
1788
+ },
1789
+ selectedOption.start
1790
+ ) : null,
1791
+ selectedOption ? /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.inputText }, selectedOption.label) : !isFloating && /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.placeholder }, placeholder),
1792
+ isFloating ? /* @__PURE__ */ import_react16.default.createElement(
1793
+ import_react_native16.View,
1794
+ {
1795
+ style: {
1796
+ marginRight: variant === "text" ? 0 : 20,
1797
+ paddingTop: variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : 0
1798
+ }
1799
+ },
1800
+ /* @__PURE__ */ import_react16.default.createElement(
1801
+ import_vector_icons8.Ionicons,
1802
+ {
1803
+ name: "chevron-down",
1804
+ color: colors2.textSecondary.main,
1805
+ size: 24
1806
+ }
1807
+ )
1808
+ ) : /* @__PURE__ */ import_react16.default.createElement(
1809
+ import_vector_icons8.Ionicons,
1810
+ {
1811
+ name: "chevron-down",
1812
+ size: 24,
1813
+ style: { marginLeft: "auto", marginRight: 15 },
1814
+ color: colors2.dark.light
1815
+ }
1816
+ )
1817
+ ) : isDate ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.dateContent }, /* @__PURE__ */ import_react16.default.createElement(
1818
+ Typography_default,
1819
+ {
1820
+ style: [
1821
+ styles.dateText,
1822
+ !value ? styles.datePlaceholder : void 0
1823
+ ],
1824
+ color: value ? "dark" : "textSecondary"
1825
+ },
1826
+ value || placeholder
1827
+ ), /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginLeft: 8 } }, end ?? /* @__PURE__ */ import_react16.default.createElement(
1828
+ import_vector_icons8.Ionicons,
1829
+ {
1830
+ name: "calendar-outline",
1831
+ size: 22,
1832
+ color: colors2.textSecondary.main
1833
+ }
1834
+ ))) : /* @__PURE__ */ import_react16.default.createElement(
1835
+ import_react_native16.TextInput,
1836
+ {
1837
+ ref,
1838
+ onFocus: () => {
1839
+ onFocus();
1840
+ setFocused(true);
1841
+ },
1842
+ onBlur: () => {
1843
+ onBlur();
1844
+ setFocused(false);
1845
+ },
1846
+ value,
1847
+ onChangeText,
1848
+ key: type === "password" ? showPassword ? "show" : "hide" : void 0,
1849
+ keyboardType,
1850
+ placeholderTextColor: colors2.textSecondary.light,
1851
+ editable: !disabled,
1852
+ placeholder,
1853
+ selectTextOnFocus: !disabled,
1854
+ onSubmitEditing,
1855
+ multiline,
1856
+ textAlignVertical: multiline ? "top" : "center",
1857
+ ...formProps,
1858
+ ...props,
1859
+ style: styles.input
1860
+ }
1861
+ )) : options ? /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, selectedOption ? /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.inputText }, selectedOption.label) : /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.placeholder }, placeholder), /* @__PURE__ */ import_react16.default.createElement(
2036
1862
  import_vector_icons8.Ionicons,
2037
1863
  {
2038
1864
  name: "chevron-down",
@@ -2071,7 +1897,7 @@ var TextField2 = import_react16.default.forwardRef(
2071
1897
  },
2072
1898
  value,
2073
1899
  onChangeText,
2074
- key: showPassword ? "show" : "hide",
1900
+ key: type === "password" ? showPassword ? "show" : "hide" : void 0,
2075
1901
  keyboardType,
2076
1902
  placeholderTextColor: colors2.textSecondary.light,
2077
1903
  editable: !disabled,
@@ -2079,13 +1905,22 @@ var TextField2 = import_react16.default.forwardRef(
2079
1905
  selectTextOnFocus: !disabled,
2080
1906
  onSubmitEditing,
2081
1907
  multiline,
2082
- extAlignVertical: multiline ? "top" : "center",
1908
+ textAlignVertical: multiline ? "top" : "center",
2083
1909
  ...formProps,
2084
1910
  ...props,
2085
1911
  style: styles.input
2086
1912
  }
2087
1913
  ),
2088
- end ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginRight: 20 } }, end) : type === "password" && /* @__PURE__ */ import_react16.default.createElement(
1914
+ end && !options ? /* @__PURE__ */ import_react16.default.createElement(
1915
+ import_react_native16.View,
1916
+ {
1917
+ style: {
1918
+ marginRight: 20,
1919
+ paddingTop: isFloating && variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : 0
1920
+ }
1921
+ },
1922
+ end
1923
+ ) : showPasswordToggle ? /* @__PURE__ */ import_react16.default.createElement(
2089
1924
  import_react_native16.TouchableOpacity,
2090
1925
  {
2091
1926
  style: { marginRight: 20 },
@@ -2099,16 +1934,8 @@ var TextField2 = import_react16.default.forwardRef(
2099
1934
  color: colors2.textSecondary.main
2100
1935
  }
2101
1936
  )
2102
- )
2103
- ), helperText && /* @__PURE__ */ import_react16.default.createElement(
2104
- Typography_default,
2105
- {
2106
- color: "textSecondary",
2107
- style: styles.helperText,
2108
- variant: "caption"
2109
- },
2110
- helperText
2111
- ), error && /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.error }, /* @__PURE__ */ import_react16.default.createElement(import_vector_icons8.MaterialIcons, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.errorText, color: "error" }, error))), options && /* @__PURE__ */ import_react16.default.createElement(
1937
+ ) : null
1938
+ ), helperText ? /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.helperText, variant: "caption" }, helperText) : null, error ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.error }, /* @__PURE__ */ import_react16.default.createElement(import_vector_icons8.MaterialIcons, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.errorText, color: "error" }, error)) : null), options ? /* @__PURE__ */ import_react16.default.createElement(
2112
1939
  SelectMenu_default,
2113
1940
  {
2114
1941
  options,
@@ -2120,21 +1947,45 @@ var TextField2 = import_react16.default.forwardRef(
2120
1947
  onChange: onChangeText,
2121
1948
  ...selectMenuProps
2122
1949
  }
2123
- ), isDate && /* @__PURE__ */ import_react16.default.createElement(
1950
+ ) : null, isDate ? /* @__PURE__ */ import_react16.default.createElement(
2124
1951
  import_react_native_modal_datetime_picker.default,
2125
1952
  {
2126
1953
  isVisible: datePickerVisible,
2127
1954
  mode: "date",
2128
- date: parseDateValue(),
1955
+ date: parseDateValue(value),
2129
1956
  onConfirm: handleDateConfirm,
2130
1957
  onCancel: () => {
2131
1958
  setDatePickerVisible(false);
2132
1959
  setFocused(false);
2133
1960
  }
2134
1961
  }
2135
- ));
1962
+ ) : null);
1963
+ }
1964
+ );
1965
+ TextFieldBase.displayName = "TextFieldBase";
1966
+ var TextField = import_react16.default.forwardRef((props, ref) => /* @__PURE__ */ import_react16.default.createElement(
1967
+ TextFieldBase,
1968
+ {
1969
+ ...props,
1970
+ ref,
1971
+ labelVariant: "floating",
1972
+ gutterBottom: props.gutterBottom ?? 0,
1973
+ placeholder: props.placeholder ?? ""
2136
1974
  }
1975
+ ));
1976
+ TextField.displayName = "TextField";
1977
+ var TextField2 = import_react16.default.forwardRef(
1978
+ (props, ref) => /* @__PURE__ */ import_react16.default.createElement(
1979
+ TextFieldBase,
1980
+ {
1981
+ ...props,
1982
+ ref,
1983
+ labelVariant: "external",
1984
+ gutterBottom: props.gutterBottom ?? 8
1985
+ }
1986
+ )
2137
1987
  );
1988
+ TextField2.displayName = "TextField2";
2138
1989
  var TextField_default = TextField;
2139
1990
 
2140
1991
  // ../src/Components/Locator.tsx
@@ -3053,6 +2904,7 @@ var next_default = HoddyUI;
3053
2904
  Spinner,
3054
2905
  TextField,
3055
2906
  TextField2,
2907
+ TextFieldBase,
3056
2908
  Typography,
3057
2909
  UIThemeContext,
3058
2910
  UIThemeProvider,