@hoddy-ui/core 2.5.49 → 2.5.53

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.
@@ -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,
@@ -142,6 +143,30 @@ function colors(theme) {
142
143
  text: "#ffffff",
143
144
  ...extraColors?.light?.primary,
144
145
  ...extraColors?.dark?.primary
146
+ },
147
+ error: {
148
+ ...extraColors?.light?.error,
149
+ ...extraColors?.dark?.error
150
+ },
151
+ secondary: {
152
+ ...extraColors?.light?.secondary,
153
+ ...extraColors?.dark?.secondary
154
+ },
155
+ warning: {
156
+ ...extraColors?.light?.warning,
157
+ ...extraColors?.dark?.warning
158
+ },
159
+ success: {
160
+ ...extraColors?.light?.success,
161
+ ...extraColors?.dark?.success
162
+ },
163
+ info: {
164
+ ...extraColors?.light?.info,
165
+ ...extraColors?.dark?.info
166
+ },
167
+ blue: {
168
+ ...extraColors?.light?.blue,
169
+ ...extraColors?.dark?.blue
145
170
  }
146
171
  };
147
172
  const dynamicColors = theme === "dark" ? darkColors : lightColors;
@@ -494,7 +519,6 @@ var ConfigureSystemUI = () => {
494
519
  NavigationBar.setStyle("dark");
495
520
  }
496
521
  } else {
497
- NavigationBar.setBackgroundColorAsync(colors2.white[1]);
498
522
  if (theme === "dark") {
499
523
  NavigationBar.setButtonStyleAsync("light");
500
524
  } else {
@@ -626,15 +650,11 @@ var useNavScreenOptions = (type) => {
626
650
 
627
651
  // components/AdaptiveStatusBarNext.tsx
628
652
  var AdaptiveStatusBar = ({ translucent = false }) => {
629
- const [focused, setFocused] = (0, import_react5.useState)(false);
630
653
  const colors2 = useColors();
631
654
  const theme = useTheme();
632
655
  const statusbarHandler = () => {
633
656
  import_react_native5.StatusBar.setBarStyle(theme === "dark" ? "light-content" : "dark-content");
634
657
  if (import_react_native5.Platform.OS === "android") {
635
- import_react_native5.StatusBar.setBackgroundColor(
636
- translucent ? "transparent" : colors2.white[1]
637
- );
638
658
  import_react_native5.StatusBar.setTranslucent(true);
639
659
  }
640
660
  };
@@ -1291,7 +1311,8 @@ var RatingInput = ({
1291
1311
  var RatingStars = ({
1292
1312
  rating = 0,
1293
1313
  size = 16,
1294
- color = "#FFD700"
1314
+ color = "#FFD700",
1315
+ inactiveColor = "textSecondary"
1295
1316
  }) => {
1296
1317
  const colors2 = useColors();
1297
1318
  const styles = import_react_native_size_matters9.ScaledSheet.create({
@@ -1314,7 +1335,7 @@ var RatingStars = ({
1314
1335
  key: index,
1315
1336
  name: "star",
1316
1337
  size,
1317
- color: colors2.textSecondary.light
1338
+ color: colors2[inactiveColor]?.main || inactiveColor
1318
1339
  }
1319
1340
  )));
1320
1341
  };
@@ -1402,8 +1423,8 @@ var ListItem = ({
1402
1423
  var import_vector_icons8 = require("@expo/vector-icons");
1403
1424
  var import_react16 = __toESM(require("react"));
1404
1425
  var import_react_native16 = require("react-native");
1405
- var import_react_native_size_matters13 = require("react-native-size-matters");
1406
1426
  var import_react_native_modal_datetime_picker = __toESM(require("react-native-modal-datetime-picker"));
1427
+ var import_react_native_size_matters13 = require("react-native-size-matters");
1407
1428
 
1408
1429
  // ../src/Components/SelectMenu.tsx
1409
1430
  var import_vector_icons7 = require("@expo/vector-icons");
@@ -1531,325 +1552,54 @@ var SelectMenu = ({
1531
1552
  var SelectMenu_default = SelectMenu;
1532
1553
 
1533
1554
  // ../src/Components/TextField.tsx
1534
- var TextField = ({
1535
- label,
1536
- keyboardType,
1537
- variant,
1538
- color = "primary",
1539
- value,
1540
- type,
1541
- placeholder = "",
1542
- helperText,
1543
- onChangeText,
1544
- onSubmitEditing = () => {
1545
- },
1546
- onFocus = () => {
1547
- },
1548
- onBlur = () => {
1549
- },
1550
- error,
1551
- start,
1552
- size = "normal",
1553
- rounded,
1554
- disabled = false,
1555
- style = {},
1556
- inputStyles = {},
1557
- gutterBottom = 0,
1558
- end,
1559
- options,
1560
- selectMenuProps,
1561
- ...props
1562
- }) => {
1563
- const colors2 = useColors();
1564
- const [focused, setFocused] = (0, import_react16.useState)(false);
1565
- const [datePickerVisible, setDatePickerVisible] = (0, import_react16.useState)(false);
1566
- const isDate = type === "date";
1567
- const height2 = (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1);
1568
- const labelAnim = (0, import_react16.useRef)(
1569
- new import_react_native16.Animated.Value(height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2))
1570
- ).current;
1571
- import_react16.default.useEffect(() => {
1572
- if (focused || value) {
1573
- import_react_native16.Animated.timing(labelAnim, {
1574
- toValue: (0, import_react_native_size_matters13.verticalScale)(variant === "text" ? 2 : 4),
1575
- duration: 300,
1576
- useNativeDriver: false
1577
- }).start();
1578
- } else {
1579
- import_react_native16.Animated.timing(labelAnim, {
1580
- toValue: height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2),
1581
- duration: 300,
1582
- useNativeDriver: false
1583
- }).start();
1584
- }
1585
- }, [focused, value]);
1586
- const styles = import_react_native_size_matters13.ScaledSheet.create({
1587
- root: {
1588
- marginBottom: (0, import_react_native_size_matters13.ms)(gutterBottom),
1589
- width: "100%",
1590
- ...style
1591
- },
1592
- container: {
1593
- height: height2,
1594
- overflow: "hidden",
1595
- backgroundColor: variant === "outlined" || variant === "text" ? "#fff0" : focused ? colors2.white[3] : colors2.white[4],
1596
- flexDirection: "row",
1597
- borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.textSecondary.main,
1598
- borderWidth: error ? 1 : variant === "outlined" ? focused ? 2 : 0.5 : 0,
1599
- borderBottomWidth: variant === "text" ? 0.5 : void 0,
1600
- width: "100%",
1601
- borderRadius: variant === "text" ? 0 : rounded ? 30 : 7,
1602
- alignItems: "center",
1603
- ...inputStyles
1604
- },
1605
- input: {
1606
- fontSize: "14@s",
1607
- flex: 1,
1608
- alignSelf: "stretch",
1609
- paddingLeft: variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(15),
1610
- paddingRight: (0, import_react_native_size_matters13.moderateScale)(10),
1611
- paddingTop: "11@vs",
1612
- fontFamily: getFontFamily(400),
1613
- color: colors2.black[1],
1614
- zIndex: 10
1615
- // backgroundColor: "#284",
1616
- },
1617
- inputText: {
1618
- fontSize: "14@ms",
1619
- flex: 1,
1620
- paddingLeft: variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(15),
1621
- paddingTop: "13@ms"
1622
- },
1623
- dateContent: {
1624
- flexDirection: "row",
1625
- alignItems: "center",
1626
- flex: 1,
1627
- paddingLeft: variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(15),
1628
- paddingRight: (0, import_react_native_size_matters13.moderateScale)(10),
1629
- paddingTop: variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : (0, import_react_native_size_matters13.ms)(12)
1630
- },
1631
- dateText: {
1632
- fontSize: "14@ms",
1633
- flex: 1
1634
- },
1635
- datePlaceholder: {
1636
- color: colors2.textSecondary.main
1637
- },
1638
- label: {
1639
- fontFamily: getFontFamily(400),
1640
- position: "absolute",
1641
- left: variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(15),
1642
- fontSize: focused || value ? "10@s" : "13@s",
1643
- color: focused ? colors2[color].main : colors2.textSecondary.main
1644
- },
1645
- helperText: {
1646
- paddingHorizontal: "15@s",
1647
- flex: 1,
1648
- color: focused ? colors2[color].dark : colors2.textSecondary.main,
1649
- paddingTop: "4@ms"
1650
- },
1651
- error: {
1652
- paddingLeft: 10,
1653
- paddingRight: 10,
1654
- paddingTop: 5,
1655
- flexDirection: "row",
1656
- alignItems: "center"
1657
- },
1658
- errorText: {
1659
- fontSize: 12,
1660
- marginLeft: 10
1661
- }
1662
- });
1663
- const formProps = type === "email" ? {
1664
- textContentType: "emailAddress",
1665
- keyboardType: "email-address",
1666
- autoCapitalize: "none",
1667
- autoCompleteType: "email"
1668
- } : type === "number" ? {
1669
- keyboardType: "numeric"
1670
- } : type === "tel" ? {
1671
- textContentType: "telephoneNumber",
1672
- keyboardType: "phone-pad"
1673
- } : type === "search" ? {
1674
- keyboardType: "web-search",
1675
- returnKeyType: "search",
1676
- autoCapitalize: "none"
1677
- } : type === "password" ? {
1678
- secureTextEntry: true,
1679
- autoCompleteType: "password",
1680
- autoCapitalize: "none",
1681
- textContentType: "password"
1682
- } : {};
1683
- const parseDateValue = () => {
1684
- if (!value)
1685
- return /* @__PURE__ */ new Date();
1686
- if (value instanceof Date)
1687
- return value;
1688
- const parts = `${value}`.split("/");
1689
- if (parts.length === 3) {
1690
- const [day, month, year] = parts;
1691
- const parsed = new Date(
1692
- parseInt(year, 10),
1693
- parseInt(month, 10) - 1,
1694
- parseInt(day, 10)
1695
- );
1696
- if (!isNaN(parsed.getTime()))
1697
- return parsed;
1698
- }
1699
- const fallback = new Date(value);
1700
- return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
1701
- };
1702
- const handleDateConfirm = (date) => {
1703
- const day = date.getDate();
1704
- const month = date.getMonth() + 1;
1705
- const year = date.getFullYear();
1706
- const dateString = `${day}/${month}/${year}`;
1707
- onChangeText?.(dateString);
1708
- setDatePickerVisible(false);
1709
- };
1710
- const handleContainerPress = () => {
1711
- if (disabled)
1712
- return;
1713
- setFocused(true);
1714
- if (isDate) {
1715
- onFocus();
1716
- setDatePickerVisible(true);
1717
- }
1718
- };
1719
- 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(
1720
- import_react_native16.TouchableOpacity,
1721
- {
1722
- onPress: handleContainerPress,
1723
- style: styles.container
1724
- },
1725
- /* @__PURE__ */ import_react16.default.createElement(import_react_native16.Animated.Text, { style: { ...styles.label, top: labelAnim } }, label),
1726
- start,
1727
- options ? /* @__PURE__ */ import_react16.default.createElement(
1728
- import_react_native16.View,
1729
- {
1730
- style: { flex: 1, alignItems: "center", flexDirection: "row" }
1731
- },
1732
- options.find((cur) => cur.value === value)?.start && /* @__PURE__ */ import_react16.default.createElement(
1733
- import_react_native16.View,
1734
- {
1735
- style: {
1736
- paddingTop: variant !== "outlined" ? (0, import_react_native_size_matters13.ms)(13) : 0,
1737
- paddingRight: 10
1738
- }
1739
- },
1740
- options.find((cur) => cur.value === value)?.start
1741
- ),
1742
- /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles.inputText }, options.find((cur) => cur.value === value)?.label)
1743
- ) : isDate ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.dateContent }, /* @__PURE__ */ import_react16.default.createElement(
1744
- Typography_default,
1745
- {
1746
- style: [
1747
- styles.dateText,
1748
- !value ? styles.datePlaceholder : void 0
1749
- ],
1750
- color: value ? "dark" : "textSecondary"
1751
- },
1752
- value || placeholder
1753
- ), /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginLeft: 8 } }, end ?? /* @__PURE__ */ import_react16.default.createElement(
1754
- import_vector_icons8.Ionicons,
1755
- {
1756
- name: "calendar-outline",
1757
- size: 22,
1758
- color: colors2.textSecondary.main
1759
- }
1760
- ))) : /* @__PURE__ */ import_react16.default.createElement(
1761
- import_react_native16.TextInput,
1762
- {
1763
- onFocus: () => {
1764
- onFocus();
1765
- setFocused(true);
1766
- },
1767
- onBlur: () => {
1768
- onBlur();
1769
- setFocused(false);
1770
- },
1771
- value,
1772
- onChangeText,
1773
- keyboardType,
1774
- editable: !disabled,
1775
- selectTextOnFocus: !disabled,
1776
- onSubmitEditing,
1777
- placeholderTextColor: colors2.textSecondary.main,
1778
- ...formProps,
1779
- ...props,
1780
- style: styles.input
1781
- }
1782
- ),
1783
- end && /* @__PURE__ */ import_react16.default.createElement(
1784
- import_react_native16.View,
1785
- {
1786
- style: {
1787
- marginRight: 20,
1788
- paddingTop: variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : 0
1789
- }
1790
- },
1791
- end
1792
- ),
1793
- options && /* @__PURE__ */ import_react16.default.createElement(
1794
- import_react_native16.View,
1795
- {
1796
- style: {
1797
- marginRight: variant === "text" ? 0 : 20,
1798
- paddingTop: variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : 0
1799
- }
1800
- },
1801
- /* @__PURE__ */ import_react16.default.createElement(
1802
- import_vector_icons8.Ionicons,
1803
- {
1804
- name: "chevron-down",
1805
- color: colors2.textSecondary.main,
1806
- size: 24
1807
- }
1808
- )
1809
- )
1810
- ), helperText && /* @__PURE__ */ import_react16.default.createElement(
1811
- Typography_default,
1812
- {
1813
- color: "textSecondary",
1814
- style: styles.helperText,
1815
- variant: "caption"
1816
- },
1817
- helperText
1818
- ), 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(
1819
- SelectMenu_default,
1820
- {
1821
- options,
1822
- value,
1823
- open: focused,
1824
- onClose: () => setFocused(false),
1825
- label,
1826
- helperText,
1827
- onChange: onChangeText,
1828
- ...selectMenuProps
1829
- }
1830
- ), isDate && /* @__PURE__ */ import_react16.default.createElement(
1831
- import_react_native_modal_datetime_picker.default,
1832
- {
1833
- isVisible: datePickerVisible,
1834
- mode: "date",
1835
- date: parseDateValue(),
1836
- onConfirm: handleDateConfirm,
1837
- onCancel: () => {
1838
- setDatePickerVisible(false);
1839
- setFocused(false);
1840
- }
1841
- }
1842
- ));
1843
- };
1844
- var TextField2 = import_react16.default.forwardRef(
1555
+ var formPropsFromType = (type, showPassword) => type === "email" ? {
1556
+ textContentType: "emailAddress",
1557
+ keyboardType: "email-address",
1558
+ autoCapitalize: "none",
1559
+ autoCompleteType: "email"
1560
+ } : type === "number" ? { keyboardType: "numeric" } : type === "tel" ? {
1561
+ textContentType: "telephoneNumber",
1562
+ keyboardType: "phone-pad"
1563
+ } : type === "search" ? {
1564
+ keyboardType: "web-search",
1565
+ returnKeyType: "search",
1566
+ autoCapitalize: "none"
1567
+ } : type === "password" ? {
1568
+ secureTextEntry: !showPassword,
1569
+ autoCompleteType: "password",
1570
+ autoCapitalize: "none",
1571
+ textContentType: "password"
1572
+ } : {};
1573
+ function parseDateValue(value) {
1574
+ if (!value)
1575
+ return /* @__PURE__ */ new Date();
1576
+ if (value instanceof Date)
1577
+ return value;
1578
+ const isoParts = `${value}`.split("-");
1579
+ if (isoParts.length === 3) {
1580
+ const [year, month, day] = isoParts;
1581
+ const parsed = new Date(
1582
+ parseInt(year, 10),
1583
+ parseInt(month, 10) - 1,
1584
+ parseInt(day, 10)
1585
+ );
1586
+ if (!isNaN(parsed.getTime()))
1587
+ return parsed;
1588
+ }
1589
+ const fallback = new Date(value);
1590
+ return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
1591
+ }
1592
+ var TextFieldBase = import_react16.default.forwardRef(
1845
1593
  ({
1846
1594
  label,
1847
1595
  labelProps,
1596
+ labelVariant,
1848
1597
  keyboardType,
1598
+ variant = "outlined",
1849
1599
  color = "primary",
1850
1600
  value,
1851
1601
  type,
1852
- placeholder,
1602
+ placeholder = "",
1853
1603
  helperText,
1854
1604
  onChangeText,
1855
1605
  onSubmitEditing = () => {
@@ -1860,90 +1610,145 @@ var TextField2 = import_react16.default.forwardRef(
1860
1610
  },
1861
1611
  error,
1862
1612
  start,
1613
+ size = "normal",
1863
1614
  rounded,
1864
1615
  disabled = false,
1865
1616
  style = {},
1866
1617
  inputStyles = {},
1867
- gutterBottom = 8,
1618
+ gutterBottom,
1868
1619
  end,
1869
1620
  options,
1870
1621
  multiline,
1871
1622
  selectMenuProps,
1623
+ labelAlwaysOpen,
1872
1624
  ...props
1873
1625
  }, ref) => {
1874
1626
  const colors2 = useColors();
1627
+ const theme = useTheme();
1875
1628
  const [focused, _setFocused] = (0, import_react16.useState)(false);
1876
1629
  const [showPassword, setShowPassword] = (0, import_react16.useState)(false);
1877
1630
  const [datePickerVisible, setDatePickerVisible] = (0, import_react16.useState)(false);
1878
1631
  const isDate = type === "date";
1879
- const height2 = (0, import_react_native_size_matters13.moderateScale)(
1632
+ const setFocused = (next) => {
1633
+ if (options && next) {
1634
+ import_react_native16.Keyboard.dismiss();
1635
+ setTimeout(() => _setFocused(next), 100);
1636
+ } else {
1637
+ _setFocused(next);
1638
+ }
1639
+ };
1640
+ const isFloating = labelVariant === "floating";
1641
+ const labelOpen = labelAlwaysOpen || focused || value;
1642
+ const baseHeight = (0, import_react_native_size_matters13.moderateScale)(
1880
1643
  multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
1881
1644
  );
1882
- const setFocused = (value2) => {
1883
- if (options && value2) {
1884
- import_react_native16.Keyboard.dismiss();
1885
- setTimeout(() => {
1886
- _setFocused(value2);
1887
- }, 100);
1645
+ const sizeMultiplier = isFloating ? size === "large" ? 1.2 : size === "small" ? 0.8 : 1 : 1;
1646
+ const height2 = baseHeight * sizeMultiplier;
1647
+ const labelAnim = (0, import_react16.useRef)(
1648
+ new import_react_native16.Animated.Value(
1649
+ height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2)
1650
+ )
1651
+ ).current;
1652
+ import_react16.default.useEffect(() => {
1653
+ if (!isFloating)
1654
+ return;
1655
+ if (labelOpen) {
1656
+ import_react_native16.Animated.timing(labelAnim, {
1657
+ toValue: (0, import_react_native_size_matters13.verticalScale)(variant === "text" ? 2 : 4),
1658
+ duration: 300,
1659
+ useNativeDriver: false
1660
+ }).start();
1888
1661
  } else {
1889
- _setFocused(value2);
1662
+ import_react_native16.Animated.timing(labelAnim, {
1663
+ toValue: height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2),
1664
+ duration: 300,
1665
+ useNativeDriver: false
1666
+ }).start();
1667
+ }
1668
+ }, [isFloating, labelOpen, variant, height2]);
1669
+ const formProps = formPropsFromType(type, showPassword);
1670
+ const handleDateConfirm = (date) => {
1671
+ const year = date.getFullYear();
1672
+ const month = `${date.getMonth() + 1}`.padStart(2, "0");
1673
+ const day = `${date.getDate()}`.padStart(2, "0");
1674
+ onChangeText?.(`${year}-${month}-${day}`);
1675
+ setDatePickerVisible(false);
1676
+ setFocused(false);
1677
+ };
1678
+ const handleContainerPress = () => {
1679
+ if (disabled)
1680
+ return;
1681
+ setFocused(true);
1682
+ if (isDate) {
1683
+ onFocus();
1684
+ setDatePickerVisible(true);
1890
1685
  }
1891
1686
  };
1687
+ const inputPadding = variant === "text" ? 0 : (0, import_react_native_size_matters13.moderateScale)(isFloating ? 15 : 10);
1688
+ const containerBorderRadius = variant === "text" ? 0 : rounded ? 30 : isFloating ? 7 : 10;
1689
+ const datePlaceholderColor = colors2.textSecondary.light;
1892
1690
  const styles = import_react_native_size_matters13.ScaledSheet.create({
1893
1691
  root: {
1894
- marginBottom: (0, import_react_native_size_matters13.ms)(gutterBottom),
1692
+ marginBottom: (0, import_react_native_size_matters13.ms)(gutterBottom ?? (isFloating ? 0 : 8)),
1693
+ width: "100%",
1895
1694
  ...style
1896
1695
  },
1897
1696
  container: {
1898
1697
  height: height2,
1899
1698
  overflow: "hidden",
1900
1699
  flexDirection: "row",
1901
- borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.white[4],
1902
- borderWidth: error ? 1 : focused ? 2 : 1,
1700
+ backgroundColor: variant === "outlined" || variant === "text" ? "#fff0" : focused ? colors2.white[2] + "dd" : colors2.white[2],
1701
+ borderColor: error ? colors2.error.main : isFloating && focused && variant === "contained" ? colors2[color].light : focused ? colors2[color].main : colors2.textSecondary.main,
1702
+ borderWidth: error ? 1 : isFloating && focused && variant === "contained" ? 1 : variant === "outlined" ? focused ? 2 : 0.5 : 0,
1703
+ borderBottomWidth: variant === "text" ? 0.5 : void 0,
1903
1704
  width: "100%",
1904
- borderRadius: rounded ? 30 : 10,
1705
+ borderRadius: containerBorderRadius,
1905
1706
  alignItems: multiline ? "flex-start" : "center",
1906
1707
  paddingVertical: multiline ? 10 : 0,
1907
1708
  ...inputStyles
1908
1709
  },
1909
1710
  input: {
1910
- fontSize: "14@s",
1711
+ fontSize: "14@ms",
1911
1712
  flex: 1,
1912
1713
  alignSelf: "stretch",
1913
- paddingLeft: (0, import_react_native_size_matters13.moderateScale)(10),
1714
+ padding: 0,
1715
+ paddingLeft: inputPadding,
1716
+ lineHeight: "18@ms",
1914
1717
  paddingRight: (0, import_react_native_size_matters13.moderateScale)(10),
1915
- color: colors2.dark.main,
1718
+ ...isFloating ? { marginTop: "13@ms", fontFamily: getFontFamily(400) } : {},
1719
+ color: disabled ? colors2.textSecondary.main : colors2.dark.main,
1916
1720
  zIndex: 10
1917
- // backgroundColor: "#284",
1918
1721
  },
1919
1722
  inputText: {
1920
1723
  fontSize: "14@ms",
1921
- color: colors2.dark.main,
1922
- paddingLeft: (0, import_react_native_size_matters13.moderateScale)(10)
1923
- },
1924
- placeholder: {
1925
- fontSize: "14@ms",
1926
- color: colors2.textSecondary.light,
1927
- paddingLeft: (0, import_react_native_size_matters13.moderateScale)(10)
1724
+ flex: 1,
1725
+ paddingLeft: inputPadding,
1726
+ ...isFloating ? { paddingTop: "13@ms" } : {}
1928
1727
  },
1929
1728
  dateContent: {
1930
1729
  flexDirection: "row",
1931
1730
  alignItems: "center",
1932
1731
  flex: 1,
1933
- paddingHorizontal: (0, import_react_native_size_matters13.moderateScale)(10),
1934
- paddingTop: multiline ? 4 : 0
1935
- },
1936
- dateText: {
1937
- fontSize: "14@ms",
1938
- flex: 1
1939
- },
1940
- datePlaceholder: {
1941
- color: colors2.textSecondary.light
1732
+ paddingLeft: inputPadding,
1733
+ paddingRight: (0, import_react_native_size_matters13.moderateScale)(10),
1734
+ paddingTop: isFloating ? variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : (0, import_react_native_size_matters13.ms)(12) : multiline ? 4 : 0
1942
1735
  },
1943
- label: {},
1736
+ dateText: { fontSize: "14@ms", flex: 1 },
1737
+ datePlaceholder: { color: datePlaceholderColor },
1738
+ ...isFloating ? {
1739
+ contentWrapper: { flex: 1, position: "relative" },
1740
+ label: {
1741
+ fontFamily: getFontFamily(400),
1742
+ position: "absolute",
1743
+ left: inputPadding,
1744
+ fontSize: labelOpen ? "10@ms" : "13@ms",
1745
+ color: error ? colors2.error.main : focused ? theme === "dark" ? colors2[color].light : colors2[color].main : colors2.textSecondary.main
1746
+ }
1747
+ } : {},
1944
1748
  helperText: {
1945
- paddingHorizontal: "15@s",
1946
- color: focused ? colors2[color].dark : "#fffa",
1749
+ paddingHorizontal: "15@ms",
1750
+ flex: 1,
1751
+ color: error ? colors2.error.main : focused ? theme === "dark" ? colors2[color].light : colors2[color].main : colors2.textSecondary.main,
1947
1752
  paddingTop: "4@ms"
1948
1753
  },
1949
1754
  error: {
@@ -1953,84 +1758,129 @@ var TextField2 = import_react16.default.forwardRef(
1953
1758
  flexDirection: "row",
1954
1759
  alignItems: "center"
1955
1760
  },
1956
- errorText: {
1957
- fontSize: 12,
1958
- marginLeft: 10
1761
+ errorText: { fontSize: 12, marginLeft: 10, fontWeight: "400" },
1762
+ placeholder: {
1763
+ fontSize: "14@ms",
1764
+ color: colors2.textSecondary.light,
1765
+ paddingLeft: inputPadding
1959
1766
  }
1960
1767
  });
1961
- const formProps = type === "email" ? {
1962
- textContentType: "emailAddress",
1963
- keyboardType: "email-address",
1964
- autoCapitalize: "none",
1965
- autoCompleteType: "email"
1966
- } : type === "number" ? {
1967
- keyboardType: "numeric"
1968
- } : type === "tel" ? {
1969
- textContentType: "telephoneNumber",
1970
- keyboardType: "phone-pad"
1971
- } : type === "search" ? {
1972
- keyboardType: "web-search",
1973
- returnKeyType: "search",
1974
- autoCapitalize: "none"
1975
- } : type === "password" ? {
1976
- secureTextEntry: !showPassword,
1977
- autoCompleteType: "password",
1978
- autoCapitalize: "none",
1979
- textContentType: "password"
1980
- } : {};
1981
- const parseDateValue = () => {
1982
- if (!value)
1983
- return /* @__PURE__ */ new Date();
1984
- if (value instanceof Date)
1985
- return value;
1986
- const parts = `${value}`.split("/");
1987
- if (parts.length === 3) {
1988
- const [day, month, year] = parts;
1989
- const parsed = new Date(
1990
- parseInt(year, 10),
1991
- parseInt(month, 10) - 1,
1992
- parseInt(day, 10)
1993
- );
1994
- if (!isNaN(parsed.getTime()))
1995
- return parsed;
1996
- }
1997
- const fallback = new Date(value);
1998
- return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
1999
- };
2000
- const handleDateConfirm = (date) => {
2001
- const day = date.getDate();
2002
- const month = date.getMonth() + 1;
2003
- const year = date.getFullYear();
2004
- const dateString = `${day}/${month}/${year}`;
2005
- onChangeText?.(dateString);
2006
- setDatePickerVisible(false);
2007
- };
2008
- const handleContainerPress = () => {
2009
- if (disabled)
2010
- return;
2011
- setFocused(true);
2012
- if (isDate) {
2013
- onFocus();
2014
- setDatePickerVisible(true);
2015
- }
2016
- };
2017
- 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(
1768
+ const selectedOption = options?.find((cur) => cur.value === value);
1769
+ const showPasswordToggle = type === "password" && !end && !options && !isDate;
1770
+ 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(
2018
1771
  Typography_default,
2019
1772
  {
2020
1773
  variant: "body2",
2021
- color: "textSecondary",
1774
+ color: error ? "error" : "textSecondary",
2022
1775
  gutterBottom: 7,
2023
1776
  ...labelProps
2024
1777
  },
2025
1778
  label
2026
- ), /* @__PURE__ */ import_react16.default.createElement(
1779
+ ) : null, /* @__PURE__ */ import_react16.default.createElement(
2027
1780
  import_react_native16.TouchableOpacity,
2028
1781
  {
2029
1782
  onPress: handleContainerPress,
2030
- style: styles.container
1783
+ style: styles.container,
1784
+ activeOpacity: 1
2031
1785
  },
2032
- /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginTop: multiline ? 5 : 0 } }, start),
2033
- 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(
1786
+ /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginTop: multiline && !isFloating ? 5 : 0 } }, start),
1787
+ isFloating ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.contentWrapper }, label != null && label !== "" ? /* @__PURE__ */ import_react16.default.createElement(
1788
+ import_react_native16.Animated.Text,
1789
+ {
1790
+ style: { ...styles.label, top: labelAnim },
1791
+ pointerEvents: "none"
1792
+ },
1793
+ label
1794
+ ) : null, options ? /* @__PURE__ */ import_react16.default.createElement(
1795
+ import_react_native16.View,
1796
+ {
1797
+ style: {
1798
+ flex: 1,
1799
+ alignItems: "center",
1800
+ flexDirection: "row"
1801
+ }
1802
+ },
1803
+ isFloating && selectedOption?.start ? /* @__PURE__ */ import_react16.default.createElement(
1804
+ import_react_native16.View,
1805
+ {
1806
+ style: {
1807
+ paddingTop: variant !== "outlined" ? (0, import_react_native_size_matters13.ms)(13) : 0,
1808
+ paddingRight: 10
1809
+ }
1810
+ },
1811
+ selectedOption.start
1812
+ ) : null,
1813
+ 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),
1814
+ isFloating ? /* @__PURE__ */ import_react16.default.createElement(
1815
+ import_react_native16.View,
1816
+ {
1817
+ style: {
1818
+ marginRight: variant === "text" ? 0 : 20,
1819
+ paddingTop: variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : 0
1820
+ }
1821
+ },
1822
+ /* @__PURE__ */ import_react16.default.createElement(
1823
+ import_vector_icons8.Ionicons,
1824
+ {
1825
+ name: "chevron-down",
1826
+ color: colors2.textSecondary.main,
1827
+ size: 24
1828
+ }
1829
+ )
1830
+ ) : /* @__PURE__ */ import_react16.default.createElement(
1831
+ import_vector_icons8.Ionicons,
1832
+ {
1833
+ name: "chevron-down",
1834
+ size: 24,
1835
+ style: { marginLeft: "auto", marginRight: 15 },
1836
+ color: colors2.dark.light
1837
+ }
1838
+ )
1839
+ ) : isDate ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles.dateContent }, /* @__PURE__ */ import_react16.default.createElement(
1840
+ Typography_default,
1841
+ {
1842
+ style: [
1843
+ styles.dateText,
1844
+ !value ? styles.datePlaceholder : void 0
1845
+ ],
1846
+ color: value ? "dark" : "textSecondary"
1847
+ },
1848
+ value || placeholder
1849
+ ), /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginLeft: 8 } }, end ?? /* @__PURE__ */ import_react16.default.createElement(
1850
+ import_vector_icons8.Ionicons,
1851
+ {
1852
+ name: "calendar-outline",
1853
+ size: 22,
1854
+ color: colors2.textSecondary.main
1855
+ }
1856
+ ))) : /* @__PURE__ */ import_react16.default.createElement(
1857
+ import_react_native16.TextInput,
1858
+ {
1859
+ ref,
1860
+ onFocus: () => {
1861
+ onFocus();
1862
+ setFocused(true);
1863
+ },
1864
+ onBlur: () => {
1865
+ onBlur();
1866
+ setFocused(false);
1867
+ },
1868
+ value,
1869
+ onChangeText,
1870
+ key: type === "password" ? showPassword ? "show" : "hide" : void 0,
1871
+ keyboardType,
1872
+ placeholderTextColor: colors2.textSecondary.light,
1873
+ editable: !disabled,
1874
+ placeholder: labelOpen ? placeholder : "",
1875
+ selectTextOnFocus: !disabled,
1876
+ onSubmitEditing,
1877
+ multiline,
1878
+ textAlignVertical: multiline ? "top" : "center",
1879
+ ...formProps,
1880
+ ...props,
1881
+ style: styles.input
1882
+ }
1883
+ )) : 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(
2034
1884
  import_vector_icons8.Ionicons,
2035
1885
  {
2036
1886
  name: "chevron-down",
@@ -2069,7 +1919,7 @@ var TextField2 = import_react16.default.forwardRef(
2069
1919
  },
2070
1920
  value,
2071
1921
  onChangeText,
2072
- key: showPassword ? "show" : "hide",
1922
+ key: type === "password" ? showPassword ? "show" : "hide" : void 0,
2073
1923
  keyboardType,
2074
1924
  placeholderTextColor: colors2.textSecondary.light,
2075
1925
  editable: !disabled,
@@ -2077,13 +1927,22 @@ var TextField2 = import_react16.default.forwardRef(
2077
1927
  selectTextOnFocus: !disabled,
2078
1928
  onSubmitEditing,
2079
1929
  multiline,
2080
- extAlignVertical: multiline ? "top" : "center",
1930
+ textAlignVertical: multiline ? "top" : "center",
2081
1931
  ...formProps,
2082
1932
  ...props,
2083
1933
  style: styles.input
2084
1934
  }
2085
1935
  ),
2086
- end ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginRight: 20 } }, end) : type === "password" && /* @__PURE__ */ import_react16.default.createElement(
1936
+ end && !options ? /* @__PURE__ */ import_react16.default.createElement(
1937
+ import_react_native16.View,
1938
+ {
1939
+ style: {
1940
+ marginRight: 20,
1941
+ paddingTop: isFloating && variant === "text" ? (0, import_react_native_size_matters13.ms)(13) : 0
1942
+ }
1943
+ },
1944
+ end
1945
+ ) : showPasswordToggle ? /* @__PURE__ */ import_react16.default.createElement(
2087
1946
  import_react_native16.TouchableOpacity,
2088
1947
  {
2089
1948
  style: { marginRight: 20 },
@@ -2097,16 +1956,16 @@ var TextField2 = import_react16.default.forwardRef(
2097
1956
  color: colors2.textSecondary.main
2098
1957
  }
2099
1958
  )
2100
- )
2101
- ), helperText && /* @__PURE__ */ import_react16.default.createElement(
1959
+ ) : null
1960
+ ), 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(
2102
1961
  Typography_default,
2103
1962
  {
2104
- color: "textSecondary",
2105
- style: styles.helperText,
2106
- variant: "caption"
1963
+ style: styles.errorText,
1964
+ color: "error",
1965
+ fontWeight: 400
2107
1966
  },
2108
- helperText
2109
- ), 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(
1967
+ error
1968
+ )) : null), options ? /* @__PURE__ */ import_react16.default.createElement(
2110
1969
  SelectMenu_default,
2111
1970
  {
2112
1971
  options,
@@ -2118,9 +1977,45 @@ var TextField2 = import_react16.default.forwardRef(
2118
1977
  onChange: onChangeText,
2119
1978
  ...selectMenuProps
2120
1979
  }
2121
- ));
1980
+ ) : null, isDate ? /* @__PURE__ */ import_react16.default.createElement(
1981
+ import_react_native_modal_datetime_picker.default,
1982
+ {
1983
+ isVisible: datePickerVisible,
1984
+ mode: "date",
1985
+ date: parseDateValue(value),
1986
+ onConfirm: handleDateConfirm,
1987
+ onCancel: () => {
1988
+ setDatePickerVisible(false);
1989
+ setFocused(false);
1990
+ }
1991
+ }
1992
+ ) : null);
1993
+ }
1994
+ );
1995
+ TextFieldBase.displayName = "TextFieldBase";
1996
+ var TextField = import_react16.default.forwardRef((props, ref) => /* @__PURE__ */ import_react16.default.createElement(
1997
+ TextFieldBase,
1998
+ {
1999
+ ...props,
2000
+ ref,
2001
+ labelVariant: "floating",
2002
+ gutterBottom: props.gutterBottom ?? 0,
2003
+ placeholder: props.placeholder ?? ""
2122
2004
  }
2005
+ ));
2006
+ TextField.displayName = "TextField";
2007
+ var TextField2 = import_react16.default.forwardRef(
2008
+ (props, ref) => /* @__PURE__ */ import_react16.default.createElement(
2009
+ TextFieldBase,
2010
+ {
2011
+ ...props,
2012
+ ref,
2013
+ labelVariant: "external",
2014
+ gutterBottom: props.gutterBottom ?? 8
2015
+ }
2016
+ )
2123
2017
  );
2018
+ TextField2.displayName = "TextField2";
2124
2019
  var TextField_default = TextField;
2125
2020
 
2126
2021
  // ../src/Components/Locator.tsx
@@ -3039,6 +2934,7 @@ var next_default = HoddyUI;
3039
2934
  Spinner,
3040
2935
  TextField,
3041
2936
  TextField2,
2937
+ TextFieldBase,
3042
2938
  Typography,
3043
2939
  UIThemeContext,
3044
2940
  UIThemeProvider,