@hoddy-ui/next 2.5.85 → 2.5.87

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: colors2.black[1],
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,78 @@ 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)(
1881
- multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
1882
- );
1883
- const setFocused = (value2) => {
1884
- if (options && value2) {
1611
+ const setFocused = (next) => {
1612
+ if (options && next) {
1885
1613
  import_react_native16.Keyboard.dismiss();
1886
- setTimeout(() => {
1887
- _setFocused(value2);
1888
- }, 100);
1614
+ setTimeout(() => _setFocused(next), 100);
1889
1615
  } else {
1890
- _setFocused(value2);
1616
+ _setFocused(next);
1891
1617
  }
1892
1618
  };
1619
+ const isFloating = labelVariant === "floating";
1620
+ const hasPlaceholder = placeholder != null && String(placeholder).trim() !== "";
1621
+ const labelOpen = focused || value || isFloating && hasPlaceholder;
1622
+ const height2 = isFloating ? (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1) : (0, import_react_native_size_matters13.moderateScale)(multiline ? 50 + (props.numberOfLines || 1) * 18 : 50);
1623
+ const labelAnim = (0, import_react16.useRef)(
1624
+ new import_react_native16.Animated.Value(
1625
+ height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2)
1626
+ )
1627
+ ).current;
1628
+ import_react16.default.useEffect(() => {
1629
+ if (!isFloating)
1630
+ return;
1631
+ if (labelOpen) {
1632
+ import_react_native16.Animated.timing(labelAnim, {
1633
+ toValue: (0, import_react_native_size_matters13.verticalScale)(variant === "text" ? 2 : 4),
1634
+ duration: 300,
1635
+ useNativeDriver: false
1636
+ }).start();
1637
+ } else {
1638
+ import_react_native16.Animated.timing(labelAnim, {
1639
+ toValue: height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2),
1640
+ duration: 300,
1641
+ useNativeDriver: false
1642
+ }).start();
1643
+ }
1644
+ }, [isFloating, labelOpen, variant, height2]);
1645
+ const formProps = formPropsFromType(type, showPassword);
1646
+ const handleDateConfirm = (date) => {
1647
+ const year = date.getFullYear();
1648
+ const month = `${date.getMonth() + 1}`.padStart(2, "0");
1649
+ const day = `${date.getDate()}`.padStart(2, "0");
1650
+ onChangeText?.(`${year}-${month}-${day}`);
1651
+ setDatePickerVisible(false);
1652
+ setFocused(false);
1653
+ };
1654
+ const handleContainerPress = () => {
1655
+ if (disabled)
1656
+ return;
1657
+ setFocused(true);
1658
+ if (isDate) {
1659
+ onFocus();
1660
+ setDatePickerVisible(true);
1661
+ }
1662
+ };
1663
+ const inputPadding = variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(isFloating ? 15 : 10);
1664
+ const containerBorderRadius = variant === "text" ? 0 : rounded ? 30 : isFloating ? 7 : 10;
1665
+ const datePlaceholderColor = isFloating ? colors2.textSecondary.main : colors2.textSecondary.light;
1666
+ const helperTextUnfocusedColor = isFloating ? colors2.textSecondary.main : "#fffa";
1893
1667
  const styles = import_react_native_size_matters13.ScaledSheet.create({
1894
1668
  root: {
1895
- marginBottom: (0, import_react_native_size_matters13.ms)(gutterBottom),
1669
+ marginBottom: (0, import_react_native_size_matters13.ms)(gutterBottom ?? (isFloating ? 0 : 8)),
1670
+ width: "100%",
1896
1671
  ...style
1897
1672
  },
1898
1673
  container: {
1899
1674
  height: height2,
1900
1675
  overflow: "hidden",
1901
1676
  flexDirection: "row",
1902
- borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.white[4],
1903
- borderWidth: error ? 1 : focused ? 2 : 1,
1677
+ backgroundColor: variant === "outlined" || variant === "text" ? "#fff0" : focused ? colors2.white[3] : colors2.white[2],
1678
+ borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.textSecondary.main,
1679
+ borderWidth: error ? 1 : variant === "outlined" ? focused ? 2 : 0.5 : 0,
1680
+ borderBottomWidth: variant === "text" ? 0.5 : void 0,
1904
1681
  width: "100%",
1905
- borderRadius: rounded ? 30 : 10,
1682
+ borderRadius: containerBorderRadius,
1906
1683
  alignItems: multiline ? "flex-start" : "center",
1907
1684
  paddingVertical: multiline ? 10 : 0,
1908
1685
  ...inputStyles
@@ -1911,40 +1688,41 @@ var TextField2 = import_react16.default.forwardRef(
1911
1688
  fontSize: "14@s",
1912
1689
  flex: 1,
1913
1690
  alignSelf: "stretch",
1914
- paddingLeft: (0, import_react_native_size_matters13.moderateScale)(10),
1691
+ paddingLeft: inputPadding,
1915
1692
  paddingRight: (0, import_react_native_size_matters13.moderateScale)(10),
1916
- color: colors2.dark.main,
1693
+ ...isFloating ? { paddingTop: "11@vs", fontFamily: getFontFamily(400) } : {},
1694
+ color: disabled ? colors2.textSecondary.main : colors2.dark.main,
1917
1695
  zIndex: 10
1918
- // backgroundColor: "#284",
1919
1696
  },
1920
1697
  inputText: {
1921
1698
  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)
1699
+ flex: 1,
1700
+ paddingLeft: inputPadding,
1701
+ ...isFloating ? { paddingTop: "13@ms" } : {}
1929
1702
  },
1930
1703
  dateContent: {
1931
1704
  flexDirection: "row",
1932
1705
  alignItems: "center",
1933
1706
  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
1707
+ paddingLeft: inputPadding,
1708
+ paddingRight: (0, import_react_native_size_matters13.moderateScale)(10),
1709
+ paddingTop: isFloating ? variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : (0, import_react_native_size_matters13.ms)(12) : multiline ? 4 : 0
1943
1710
  },
1944
- label: {},
1711
+ dateText: { fontSize: "14@ms", flex: 1 },
1712
+ datePlaceholder: { color: datePlaceholderColor },
1713
+ ...isFloating ? {
1714
+ label: {
1715
+ fontFamily: getFontFamily(400),
1716
+ position: "absolute",
1717
+ left: variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(15),
1718
+ fontSize: labelOpen ? "10@s" : "13@s",
1719
+ color: focused ? colors2[color].main : colors2.textSecondary.main
1720
+ }
1721
+ } : {},
1945
1722
  helperText: {
1946
1723
  paddingHorizontal: "15@s",
1947
- color: focused ? colors2[color].dark : "#fffa",
1724
+ flex: 1,
1725
+ color: focused ? colors2[color].dark : helperTextUnfocusedColor,
1948
1726
  paddingTop: "4@ms"
1949
1727
  },
1950
1728
  error: {
@@ -1954,69 +1732,16 @@ var TextField2 = import_react16.default.forwardRef(
1954
1732
  flexDirection: "row",
1955
1733
  alignItems: "center"
1956
1734
  },
1957
- errorText: {
1958
- fontSize: 12,
1959
- marginLeft: 10
1735
+ errorText: { fontSize: 12, marginLeft: 10 },
1736
+ placeholder: {
1737
+ fontSize: "14@ms",
1738
+ color: colors2.textSecondary.light,
1739
+ paddingLeft: inputPadding
1960
1740
  }
1961
1741
  });
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(
1742
+ const selectedOption = options?.find((cur) => cur.value === value);
1743
+ const showPasswordToggle = type === "password" && !end && !options && !isDate;
1744
+ 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
1745
  Typography_default,
2021
1746
  {
2022
1747
  variant: "body2",
@@ -2025,22 +1750,61 @@ var TextField2 = import_react16.default.forwardRef(
2025
1750
  ...labelProps
2026
1751
  },
2027
1752
  label
2028
- ), /* @__PURE__ */ import_react16.default.createElement(
1753
+ ) : null, /* @__PURE__ */ import_react16.default.createElement(
2029
1754
  import_react_native16.TouchableOpacity,
2030
1755
  {
2031
1756
  onPress: handleContainerPress,
2032
- style: styles.container
1757
+ style: styles.container,
1758
+ activeOpacity: 1
2033
1759
  },
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(
2036
- import_vector_icons8.Ionicons,
1760
+ isFloating && label != null && label !== "" ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Animated.Text, { style: { ...styles.label, top: labelAnim } }, label) : null,
1761
+ /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginTop: multiline && !isFloating ? 5 : 0 } }, start),
1762
+ options ? /* @__PURE__ */ import_react16.default.createElement(
1763
+ import_react_native16.View,
2037
1764
  {
2038
- name: "chevron-down",
2039
- size: 24,
2040
- style: { marginLeft: "auto", marginRight: 15 },
2041
- color: colors2.dark.light
2042
- }
2043
- )) : isDate ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.dateContent }, /* @__PURE__ */ import_react16.default.createElement(
1765
+ style: isFloating ? {
1766
+ flex: 1,
1767
+ alignItems: "center",
1768
+ flexDirection: "row"
1769
+ } : void 0
1770
+ },
1771
+ isFloating && selectedOption?.start ? /* @__PURE__ */ import_react16.default.createElement(
1772
+ import_react_native16.View,
1773
+ {
1774
+ style: {
1775
+ paddingTop: variant !== "outlined" ? (0, import_react_native_size_matters13.ms)(13) : 0,
1776
+ paddingRight: 10
1777
+ }
1778
+ },
1779
+ selectedOption.start
1780
+ ) : null,
1781
+ 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),
1782
+ isFloating ? /* @__PURE__ */ import_react16.default.createElement(
1783
+ import_react_native16.View,
1784
+ {
1785
+ style: {
1786
+ marginRight: variant === "text" ? 0 : 20,
1787
+ paddingTop: variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : 0
1788
+ }
1789
+ },
1790
+ /* @__PURE__ */ import_react16.default.createElement(
1791
+ import_vector_icons8.Ionicons,
1792
+ {
1793
+ name: "chevron-down",
1794
+ color: colors2.textSecondary.main,
1795
+ size: 24
1796
+ }
1797
+ )
1798
+ ) : /* @__PURE__ */ import_react16.default.createElement(
1799
+ import_vector_icons8.Ionicons,
1800
+ {
1801
+ name: "chevron-down",
1802
+ size: 24,
1803
+ style: { marginLeft: "auto", marginRight: 15 },
1804
+ color: colors2.dark.light
1805
+ }
1806
+ )
1807
+ ) : isDate ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.dateContent }, /* @__PURE__ */ import_react16.default.createElement(
2044
1808
  Typography_default,
2045
1809
  {
2046
1810
  style: [
@@ -2071,21 +1835,30 @@ var TextField2 = import_react16.default.forwardRef(
2071
1835
  },
2072
1836
  value,
2073
1837
  onChangeText,
2074
- key: showPassword ? "show" : "hide",
1838
+ key: type === "password" ? showPassword ? "show" : "hide" : void 0,
2075
1839
  keyboardType,
2076
- placeholderTextColor: colors2.textSecondary.light,
1840
+ placeholderTextColor: isFloating ? colors2.textSecondary.main : colors2.textSecondary.light,
2077
1841
  editable: !disabled,
2078
1842
  placeholder,
2079
1843
  selectTextOnFocus: !disabled,
2080
1844
  onSubmitEditing,
2081
1845
  multiline,
2082
- extAlignVertical: multiline ? "top" : "center",
1846
+ textAlignVertical: multiline ? "top" : "center",
2083
1847
  ...formProps,
2084
1848
  ...props,
2085
1849
  style: styles.input
2086
1850
  }
2087
1851
  ),
2088
- end ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginRight: 20 } }, end) : type === "password" && /* @__PURE__ */ import_react16.default.createElement(
1852
+ end && !options ? /* @__PURE__ */ import_react16.default.createElement(
1853
+ import_react_native16.View,
1854
+ {
1855
+ style: {
1856
+ marginRight: 20,
1857
+ paddingTop: isFloating && variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : 0
1858
+ }
1859
+ },
1860
+ end
1861
+ ) : showPasswordToggle ? /* @__PURE__ */ import_react16.default.createElement(
2089
1862
  import_react_native16.TouchableOpacity,
2090
1863
  {
2091
1864
  style: { marginRight: 20 },
@@ -2099,8 +1872,8 @@ var TextField2 = import_react16.default.forwardRef(
2099
1872
  color: colors2.textSecondary.main
2100
1873
  }
2101
1874
  )
2102
- )
2103
- ), helperText && /* @__PURE__ */ import_react16.default.createElement(
1875
+ ) : null
1876
+ ), helperText ? /* @__PURE__ */ import_react16.default.createElement(
2104
1877
  Typography_default,
2105
1878
  {
2106
1879
  color: "textSecondary",
@@ -2108,7 +1881,7 @@ var TextField2 = import_react16.default.forwardRef(
2108
1881
  variant: "caption"
2109
1882
  },
2110
1883
  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(
1884
+ ) : 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
1885
  SelectMenu_default,
2113
1886
  {
2114
1887
  options,
@@ -2120,21 +1893,45 @@ var TextField2 = import_react16.default.forwardRef(
2120
1893
  onChange: onChangeText,
2121
1894
  ...selectMenuProps
2122
1895
  }
2123
- ), isDate && /* @__PURE__ */ import_react16.default.createElement(
1896
+ ) : null, isDate ? /* @__PURE__ */ import_react16.default.createElement(
2124
1897
  import_react_native_modal_datetime_picker.default,
2125
1898
  {
2126
1899
  isVisible: datePickerVisible,
2127
1900
  mode: "date",
2128
- date: parseDateValue(),
1901
+ date: parseDateValue(value),
2129
1902
  onConfirm: handleDateConfirm,
2130
1903
  onCancel: () => {
2131
1904
  setDatePickerVisible(false);
2132
1905
  setFocused(false);
2133
1906
  }
2134
1907
  }
2135
- ));
1908
+ ) : null);
2136
1909
  }
2137
1910
  );
1911
+ TextFieldBase.displayName = "TextFieldBase";
1912
+ var TextField = import_react16.default.forwardRef((props, ref) => /* @__PURE__ */ import_react16.default.createElement(
1913
+ TextFieldBase,
1914
+ {
1915
+ ...props,
1916
+ ref,
1917
+ labelVariant: "floating",
1918
+ gutterBottom: props.gutterBottom ?? 0,
1919
+ placeholder: props.placeholder ?? ""
1920
+ }
1921
+ ));
1922
+ TextField.displayName = "TextField";
1923
+ var TextField2 = import_react16.default.forwardRef(
1924
+ (props, ref) => /* @__PURE__ */ import_react16.default.createElement(
1925
+ TextFieldBase,
1926
+ {
1927
+ ...props,
1928
+ ref,
1929
+ labelVariant: "external",
1930
+ gutterBottom: props.gutterBottom ?? 8
1931
+ }
1932
+ )
1933
+ );
1934
+ TextField2.displayName = "TextField2";
2138
1935
  var TextField_default = TextField;
2139
1936
 
2140
1937
  // ../src/Components/Locator.tsx
@@ -3053,6 +2850,7 @@ var next_default = HoddyUI;
3053
2850
  Spinner,
3054
2851
  TextField,
3055
2852
  TextField2,
2853
+ TextFieldBase,
3056
2854
  Typography,
3057
2855
  UIThemeContext,
3058
2856
  UIThemeProvider,