@hoddy-ui/next 2.5.86 → 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.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +226 -428
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -428
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1498,325 +1498,54 @@ var SelectMenu = ({
|
|
|
1498
1498
|
var SelectMenu_default = SelectMenu;
|
|
1499
1499
|
|
|
1500
1500
|
// ../src/Components/TextField.tsx
|
|
1501
|
-
var
|
|
1502
|
-
|
|
1503
|
-
keyboardType,
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
const
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
if (focused || value) {
|
|
1540
|
-
Animated3.timing(labelAnim, {
|
|
1541
|
-
toValue: verticalScale(variant === "text" ? 2 : 4),
|
|
1542
|
-
duration: 300,
|
|
1543
|
-
useNativeDriver: false
|
|
1544
|
-
}).start();
|
|
1545
|
-
} else {
|
|
1546
|
-
Animated3.timing(labelAnim, {
|
|
1547
|
-
toValue: height2 / moderateScale2(variant === "text" ? 2.5 : 3.2),
|
|
1548
|
-
duration: 300,
|
|
1549
|
-
useNativeDriver: false
|
|
1550
|
-
}).start();
|
|
1551
|
-
}
|
|
1552
|
-
}, [focused, value]);
|
|
1553
|
-
const styles = ScaledSheet12.create({
|
|
1554
|
-
root: {
|
|
1555
|
-
marginBottom: ms7(gutterBottom),
|
|
1556
|
-
width: "100%",
|
|
1557
|
-
...style
|
|
1558
|
-
},
|
|
1559
|
-
container: {
|
|
1560
|
-
height: height2,
|
|
1561
|
-
overflow: "hidden",
|
|
1562
|
-
backgroundColor: variant === "outlined" || variant === "text" ? "#fff0" : focused ? colors2.white[3] : colors2.white[4],
|
|
1563
|
-
flexDirection: "row",
|
|
1564
|
-
borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.textSecondary.main,
|
|
1565
|
-
borderWidth: error ? 1 : variant === "outlined" ? focused ? 2 : 0.5 : 0,
|
|
1566
|
-
borderBottomWidth: variant === "text" ? 0.5 : void 0,
|
|
1567
|
-
width: "100%",
|
|
1568
|
-
borderRadius: variant === "text" ? 0 : rounded ? 30 : 7,
|
|
1569
|
-
alignItems: "center",
|
|
1570
|
-
...inputStyles
|
|
1571
|
-
},
|
|
1572
|
-
input: {
|
|
1573
|
-
fontSize: "14@s",
|
|
1574
|
-
flex: 1,
|
|
1575
|
-
alignSelf: "stretch",
|
|
1576
|
-
paddingLeft: variant === "text" ? 0 : moderateScale2(15),
|
|
1577
|
-
paddingRight: moderateScale2(10),
|
|
1578
|
-
paddingTop: "11@vs",
|
|
1579
|
-
fontFamily: getFontFamily(400),
|
|
1580
|
-
color: disabled ? colors2.textSecondary.main : colors2.dark.main,
|
|
1581
|
-
zIndex: 10
|
|
1582
|
-
// backgroundColor: "#284",
|
|
1583
|
-
},
|
|
1584
|
-
inputText: {
|
|
1585
|
-
fontSize: "14@ms",
|
|
1586
|
-
flex: 1,
|
|
1587
|
-
paddingLeft: variant === "text" ? 0 : moderateScale2(15),
|
|
1588
|
-
paddingTop: "13@ms"
|
|
1589
|
-
},
|
|
1590
|
-
dateContent: {
|
|
1591
|
-
flexDirection: "row",
|
|
1592
|
-
alignItems: "center",
|
|
1593
|
-
flex: 1,
|
|
1594
|
-
paddingLeft: variant === "text" ? 0 : moderateScale2(15),
|
|
1595
|
-
paddingRight: moderateScale2(10),
|
|
1596
|
-
paddingTop: variant === "text" ? ms7(13) : ms7(12)
|
|
1597
|
-
},
|
|
1598
|
-
dateText: {
|
|
1599
|
-
fontSize: "14@ms",
|
|
1600
|
-
flex: 1
|
|
1601
|
-
},
|
|
1602
|
-
datePlaceholder: {
|
|
1603
|
-
color: colors2.textSecondary.main
|
|
1604
|
-
},
|
|
1605
|
-
label: {
|
|
1606
|
-
fontFamily: getFontFamily(400),
|
|
1607
|
-
position: "absolute",
|
|
1608
|
-
left: variant === "text" ? 0 : moderateScale2(15),
|
|
1609
|
-
fontSize: focused || value ? "10@s" : "13@s",
|
|
1610
|
-
color: focused ? colors2[color].main : colors2.textSecondary.main
|
|
1611
|
-
},
|
|
1612
|
-
helperText: {
|
|
1613
|
-
paddingHorizontal: "15@s",
|
|
1614
|
-
flex: 1,
|
|
1615
|
-
color: focused ? colors2[color].dark : colors2.textSecondary.main,
|
|
1616
|
-
paddingTop: "4@ms"
|
|
1617
|
-
},
|
|
1618
|
-
error: {
|
|
1619
|
-
paddingLeft: 10,
|
|
1620
|
-
paddingRight: 10,
|
|
1621
|
-
paddingTop: 5,
|
|
1622
|
-
flexDirection: "row",
|
|
1623
|
-
alignItems: "center"
|
|
1624
|
-
},
|
|
1625
|
-
errorText: {
|
|
1626
|
-
fontSize: 12,
|
|
1627
|
-
marginLeft: 10
|
|
1628
|
-
}
|
|
1629
|
-
});
|
|
1630
|
-
const formProps = type === "email" ? {
|
|
1631
|
-
textContentType: "emailAddress",
|
|
1632
|
-
keyboardType: "email-address",
|
|
1633
|
-
autoCapitalize: "none",
|
|
1634
|
-
autoCompleteType: "email"
|
|
1635
|
-
} : type === "number" ? {
|
|
1636
|
-
keyboardType: "numeric"
|
|
1637
|
-
} : type === "tel" ? {
|
|
1638
|
-
textContentType: "telephoneNumber",
|
|
1639
|
-
keyboardType: "phone-pad"
|
|
1640
|
-
} : type === "search" ? {
|
|
1641
|
-
keyboardType: "web-search",
|
|
1642
|
-
returnKeyType: "search",
|
|
1643
|
-
autoCapitalize: "none"
|
|
1644
|
-
} : type === "password" ? {
|
|
1645
|
-
secureTextEntry: true,
|
|
1646
|
-
autoCompleteType: "password",
|
|
1647
|
-
autoCapitalize: "none",
|
|
1648
|
-
textContentType: "password"
|
|
1649
|
-
} : {};
|
|
1650
|
-
const parseDateValue = () => {
|
|
1651
|
-
if (!value)
|
|
1652
|
-
return /* @__PURE__ */ new Date();
|
|
1653
|
-
if (value instanceof Date)
|
|
1654
|
-
return value;
|
|
1655
|
-
const isoParts = `${value}`.split("-");
|
|
1656
|
-
if (isoParts.length === 3) {
|
|
1657
|
-
const [year, month, day] = isoParts;
|
|
1658
|
-
const parsed = new Date(
|
|
1659
|
-
parseInt(year, 10),
|
|
1660
|
-
parseInt(month, 10) - 1,
|
|
1661
|
-
parseInt(day, 10)
|
|
1662
|
-
);
|
|
1663
|
-
if (!isNaN(parsed.getTime()))
|
|
1664
|
-
return parsed;
|
|
1665
|
-
}
|
|
1666
|
-
const fallback = new Date(value);
|
|
1667
|
-
return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
|
|
1668
|
-
};
|
|
1669
|
-
const handleDateConfirm = (date) => {
|
|
1670
|
-
const year = date.getFullYear();
|
|
1671
|
-
const month = `${date.getMonth() + 1}`.padStart(2, "0");
|
|
1672
|
-
const day = `${date.getDate()}`.padStart(2, "0");
|
|
1673
|
-
const dateString = `${year}-${month}-${day}`;
|
|
1674
|
-
onChangeText?.(dateString);
|
|
1675
|
-
setDatePickerVisible(false);
|
|
1676
|
-
};
|
|
1677
|
-
const handleContainerPress = () => {
|
|
1678
|
-
if (disabled)
|
|
1679
|
-
return;
|
|
1680
|
-
setFocused(true);
|
|
1681
|
-
if (isDate) {
|
|
1682
|
-
onFocus();
|
|
1683
|
-
setDatePickerVisible(true);
|
|
1684
|
-
}
|
|
1685
|
-
};
|
|
1686
|
-
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(View10, { style: styles.root }, /* @__PURE__ */ React15.createElement(
|
|
1687
|
-
TouchableOpacity7,
|
|
1688
|
-
{
|
|
1689
|
-
onPress: handleContainerPress,
|
|
1690
|
-
style: styles.container
|
|
1691
|
-
},
|
|
1692
|
-
/* @__PURE__ */ React15.createElement(Animated3.Text, { style: { ...styles.label, top: labelAnim } }, label),
|
|
1693
|
-
start,
|
|
1694
|
-
options ? /* @__PURE__ */ React15.createElement(
|
|
1695
|
-
View10,
|
|
1696
|
-
{
|
|
1697
|
-
style: { flex: 1, alignItems: "center", flexDirection: "row" }
|
|
1698
|
-
},
|
|
1699
|
-
options.find((cur) => cur.value === value)?.start && /* @__PURE__ */ React15.createElement(
|
|
1700
|
-
View10,
|
|
1701
|
-
{
|
|
1702
|
-
style: {
|
|
1703
|
-
paddingTop: variant !== "outlined" ? ms7(13) : 0,
|
|
1704
|
-
paddingRight: 10
|
|
1705
|
-
}
|
|
1706
|
-
},
|
|
1707
|
-
options.find((cur) => cur.value === value)?.start
|
|
1708
|
-
),
|
|
1709
|
-
/* @__PURE__ */ React15.createElement(Typography_default, { style: styles.inputText }, options.find((cur) => cur.value === value)?.label)
|
|
1710
|
-
) : isDate ? /* @__PURE__ */ React15.createElement(View10, { style: styles.dateContent }, /* @__PURE__ */ React15.createElement(
|
|
1711
|
-
Typography_default,
|
|
1712
|
-
{
|
|
1713
|
-
style: [
|
|
1714
|
-
styles.dateText,
|
|
1715
|
-
!value ? styles.datePlaceholder : void 0
|
|
1716
|
-
],
|
|
1717
|
-
color: value ? "dark" : "textSecondary"
|
|
1718
|
-
},
|
|
1719
|
-
value || placeholder
|
|
1720
|
-
), /* @__PURE__ */ React15.createElement(View10, { style: { marginLeft: 8 } }, end ?? /* @__PURE__ */ React15.createElement(
|
|
1721
|
-
Ionicons4,
|
|
1722
|
-
{
|
|
1723
|
-
name: "calendar-outline",
|
|
1724
|
-
size: 22,
|
|
1725
|
-
color: colors2.textSecondary.main
|
|
1726
|
-
}
|
|
1727
|
-
))) : /* @__PURE__ */ React15.createElement(
|
|
1728
|
-
TextInput2,
|
|
1729
|
-
{
|
|
1730
|
-
onFocus: () => {
|
|
1731
|
-
onFocus();
|
|
1732
|
-
setFocused(true);
|
|
1733
|
-
},
|
|
1734
|
-
onBlur: () => {
|
|
1735
|
-
onBlur();
|
|
1736
|
-
setFocused(false);
|
|
1737
|
-
},
|
|
1738
|
-
value,
|
|
1739
|
-
onChangeText,
|
|
1740
|
-
keyboardType,
|
|
1741
|
-
editable: !disabled,
|
|
1742
|
-
selectTextOnFocus: !disabled,
|
|
1743
|
-
onSubmitEditing,
|
|
1744
|
-
placeholderTextColor: colors2.textSecondary.main,
|
|
1745
|
-
...formProps,
|
|
1746
|
-
...props,
|
|
1747
|
-
style: styles.input
|
|
1748
|
-
}
|
|
1749
|
-
),
|
|
1750
|
-
end && /* @__PURE__ */ React15.createElement(
|
|
1751
|
-
View10,
|
|
1752
|
-
{
|
|
1753
|
-
style: {
|
|
1754
|
-
marginRight: 20,
|
|
1755
|
-
paddingTop: variant === "text" ? ms7(13) : 0
|
|
1756
|
-
}
|
|
1757
|
-
},
|
|
1758
|
-
end
|
|
1759
|
-
),
|
|
1760
|
-
options && /* @__PURE__ */ React15.createElement(
|
|
1761
|
-
View10,
|
|
1762
|
-
{
|
|
1763
|
-
style: {
|
|
1764
|
-
marginRight: variant === "text" ? 0 : 20,
|
|
1765
|
-
paddingTop: variant === "text" ? ms7(13) : 0
|
|
1766
|
-
}
|
|
1767
|
-
},
|
|
1768
|
-
/* @__PURE__ */ React15.createElement(
|
|
1769
|
-
Ionicons4,
|
|
1770
|
-
{
|
|
1771
|
-
name: "chevron-down",
|
|
1772
|
-
color: colors2.textSecondary.main,
|
|
1773
|
-
size: 24
|
|
1774
|
-
}
|
|
1775
|
-
)
|
|
1776
|
-
)
|
|
1777
|
-
), helperText && /* @__PURE__ */ React15.createElement(
|
|
1778
|
-
Typography_default,
|
|
1779
|
-
{
|
|
1780
|
-
color: "textSecondary",
|
|
1781
|
-
style: styles.helperText,
|
|
1782
|
-
variant: "caption"
|
|
1783
|
-
},
|
|
1784
|
-
helperText
|
|
1785
|
-
), error && /* @__PURE__ */ React15.createElement(View10, { style: styles.error }, /* @__PURE__ */ React15.createElement(MaterialIcons5, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.errorText, color: "error" }, error))), options && /* @__PURE__ */ React15.createElement(
|
|
1786
|
-
SelectMenu_default,
|
|
1787
|
-
{
|
|
1788
|
-
options,
|
|
1789
|
-
value,
|
|
1790
|
-
open: focused,
|
|
1791
|
-
onClose: () => setFocused(false),
|
|
1792
|
-
label,
|
|
1793
|
-
helperText,
|
|
1794
|
-
onChange: onChangeText,
|
|
1795
|
-
...selectMenuProps
|
|
1796
|
-
}
|
|
1797
|
-
), isDate && /* @__PURE__ */ React15.createElement(
|
|
1798
|
-
DateTimePickerModal,
|
|
1799
|
-
{
|
|
1800
|
-
isVisible: datePickerVisible,
|
|
1801
|
-
mode: "date",
|
|
1802
|
-
date: parseDateValue(),
|
|
1803
|
-
onConfirm: handleDateConfirm,
|
|
1804
|
-
onCancel: () => {
|
|
1805
|
-
setDatePickerVisible(false);
|
|
1806
|
-
setFocused(false);
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
));
|
|
1810
|
-
};
|
|
1811
|
-
var TextField2 = React15.forwardRef(
|
|
1501
|
+
var formPropsFromType = (type, showPassword) => type === "email" ? {
|
|
1502
|
+
textContentType: "emailAddress",
|
|
1503
|
+
keyboardType: "email-address",
|
|
1504
|
+
autoCapitalize: "none",
|
|
1505
|
+
autoCompleteType: "email"
|
|
1506
|
+
} : type === "number" ? { keyboardType: "numeric" } : type === "tel" ? {
|
|
1507
|
+
textContentType: "telephoneNumber",
|
|
1508
|
+
keyboardType: "phone-pad"
|
|
1509
|
+
} : type === "search" ? {
|
|
1510
|
+
keyboardType: "web-search",
|
|
1511
|
+
returnKeyType: "search",
|
|
1512
|
+
autoCapitalize: "none"
|
|
1513
|
+
} : type === "password" ? {
|
|
1514
|
+
secureTextEntry: !showPassword,
|
|
1515
|
+
autoCompleteType: "password",
|
|
1516
|
+
autoCapitalize: "none",
|
|
1517
|
+
textContentType: "password"
|
|
1518
|
+
} : {};
|
|
1519
|
+
function parseDateValue(value) {
|
|
1520
|
+
if (!value)
|
|
1521
|
+
return /* @__PURE__ */ new Date();
|
|
1522
|
+
if (value instanceof Date)
|
|
1523
|
+
return value;
|
|
1524
|
+
const isoParts = `${value}`.split("-");
|
|
1525
|
+
if (isoParts.length === 3) {
|
|
1526
|
+
const [year, month, day] = isoParts;
|
|
1527
|
+
const parsed = new Date(
|
|
1528
|
+
parseInt(year, 10),
|
|
1529
|
+
parseInt(month, 10) - 1,
|
|
1530
|
+
parseInt(day, 10)
|
|
1531
|
+
);
|
|
1532
|
+
if (!isNaN(parsed.getTime()))
|
|
1533
|
+
return parsed;
|
|
1534
|
+
}
|
|
1535
|
+
const fallback = new Date(value);
|
|
1536
|
+
return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
|
|
1537
|
+
}
|
|
1538
|
+
var TextFieldBase = React15.forwardRef(
|
|
1812
1539
|
({
|
|
1813
1540
|
label,
|
|
1814
1541
|
labelProps,
|
|
1542
|
+
labelVariant,
|
|
1815
1543
|
keyboardType,
|
|
1544
|
+
variant = "outlined",
|
|
1816
1545
|
color = "primary",
|
|
1817
1546
|
value,
|
|
1818
1547
|
type,
|
|
1819
|
-
placeholder,
|
|
1548
|
+
placeholder = "",
|
|
1820
1549
|
helperText,
|
|
1821
1550
|
onChangeText,
|
|
1822
1551
|
onSubmitEditing = () => {
|
|
@@ -1827,11 +1556,12 @@ var TextField2 = React15.forwardRef(
|
|
|
1827
1556
|
},
|
|
1828
1557
|
error,
|
|
1829
1558
|
start,
|
|
1559
|
+
size = "normal",
|
|
1830
1560
|
rounded,
|
|
1831
1561
|
disabled = false,
|
|
1832
1562
|
style = {},
|
|
1833
1563
|
inputStyles = {},
|
|
1834
|
-
gutterBottom
|
|
1564
|
+
gutterBottom,
|
|
1835
1565
|
end,
|
|
1836
1566
|
options,
|
|
1837
1567
|
multiline,
|
|
@@ -1843,32 +1573,78 @@ var TextField2 = React15.forwardRef(
|
|
|
1843
1573
|
const [showPassword, setShowPassword] = useState7(false);
|
|
1844
1574
|
const [datePickerVisible, setDatePickerVisible] = useState7(false);
|
|
1845
1575
|
const isDate = type === "date";
|
|
1846
|
-
const
|
|
1847
|
-
|
|
1848
|
-
);
|
|
1849
|
-
const setFocused = (value2) => {
|
|
1850
|
-
if (options && value2) {
|
|
1576
|
+
const setFocused = (next) => {
|
|
1577
|
+
if (options && next) {
|
|
1851
1578
|
Keyboard3.dismiss();
|
|
1852
|
-
setTimeout(() =>
|
|
1853
|
-
_setFocused(value2);
|
|
1854
|
-
}, 100);
|
|
1579
|
+
setTimeout(() => _setFocused(next), 100);
|
|
1855
1580
|
} else {
|
|
1856
|
-
_setFocused(
|
|
1581
|
+
_setFocused(next);
|
|
1857
1582
|
}
|
|
1858
1583
|
};
|
|
1584
|
+
const isFloating = labelVariant === "floating";
|
|
1585
|
+
const hasPlaceholder = placeholder != null && String(placeholder).trim() !== "";
|
|
1586
|
+
const labelOpen = focused || value || isFloating && hasPlaceholder;
|
|
1587
|
+
const height2 = isFloating ? moderateScale2(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1) : moderateScale2(multiline ? 50 + (props.numberOfLines || 1) * 18 : 50);
|
|
1588
|
+
const labelAnim = useRef2(
|
|
1589
|
+
new Animated3.Value(
|
|
1590
|
+
height2 / moderateScale2(variant === "text" ? 2.5 : 3.2)
|
|
1591
|
+
)
|
|
1592
|
+
).current;
|
|
1593
|
+
React15.useEffect(() => {
|
|
1594
|
+
if (!isFloating)
|
|
1595
|
+
return;
|
|
1596
|
+
if (labelOpen) {
|
|
1597
|
+
Animated3.timing(labelAnim, {
|
|
1598
|
+
toValue: verticalScale(variant === "text" ? 2 : 4),
|
|
1599
|
+
duration: 300,
|
|
1600
|
+
useNativeDriver: false
|
|
1601
|
+
}).start();
|
|
1602
|
+
} else {
|
|
1603
|
+
Animated3.timing(labelAnim, {
|
|
1604
|
+
toValue: height2 / moderateScale2(variant === "text" ? 2.5 : 3.2),
|
|
1605
|
+
duration: 300,
|
|
1606
|
+
useNativeDriver: false
|
|
1607
|
+
}).start();
|
|
1608
|
+
}
|
|
1609
|
+
}, [isFloating, labelOpen, variant, height2]);
|
|
1610
|
+
const formProps = formPropsFromType(type, showPassword);
|
|
1611
|
+
const handleDateConfirm = (date) => {
|
|
1612
|
+
const year = date.getFullYear();
|
|
1613
|
+
const month = `${date.getMonth() + 1}`.padStart(2, "0");
|
|
1614
|
+
const day = `${date.getDate()}`.padStart(2, "0");
|
|
1615
|
+
onChangeText?.(`${year}-${month}-${day}`);
|
|
1616
|
+
setDatePickerVisible(false);
|
|
1617
|
+
setFocused(false);
|
|
1618
|
+
};
|
|
1619
|
+
const handleContainerPress = () => {
|
|
1620
|
+
if (disabled)
|
|
1621
|
+
return;
|
|
1622
|
+
setFocused(true);
|
|
1623
|
+
if (isDate) {
|
|
1624
|
+
onFocus();
|
|
1625
|
+
setDatePickerVisible(true);
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
const inputPadding = variant === "text" ? 0 : moderateScale2(isFloating ? 15 : 10);
|
|
1629
|
+
const containerBorderRadius = variant === "text" ? 0 : rounded ? 30 : isFloating ? 7 : 10;
|
|
1630
|
+
const datePlaceholderColor = isFloating ? colors2.textSecondary.main : colors2.textSecondary.light;
|
|
1631
|
+
const helperTextUnfocusedColor = isFloating ? colors2.textSecondary.main : "#fffa";
|
|
1859
1632
|
const styles = ScaledSheet12.create({
|
|
1860
1633
|
root: {
|
|
1861
|
-
marginBottom: ms7(gutterBottom),
|
|
1634
|
+
marginBottom: ms7(gutterBottom ?? (isFloating ? 0 : 8)),
|
|
1635
|
+
width: "100%",
|
|
1862
1636
|
...style
|
|
1863
1637
|
},
|
|
1864
1638
|
container: {
|
|
1865
1639
|
height: height2,
|
|
1866
1640
|
overflow: "hidden",
|
|
1867
1641
|
flexDirection: "row",
|
|
1868
|
-
|
|
1869
|
-
|
|
1642
|
+
backgroundColor: variant === "outlined" || variant === "text" ? "#fff0" : focused ? colors2.white[3] : colors2.white[2],
|
|
1643
|
+
borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.textSecondary.main,
|
|
1644
|
+
borderWidth: error ? 1 : variant === "outlined" ? focused ? 2 : 0.5 : 0,
|
|
1645
|
+
borderBottomWidth: variant === "text" ? 0.5 : void 0,
|
|
1870
1646
|
width: "100%",
|
|
1871
|
-
borderRadius:
|
|
1647
|
+
borderRadius: containerBorderRadius,
|
|
1872
1648
|
alignItems: multiline ? "flex-start" : "center",
|
|
1873
1649
|
paddingVertical: multiline ? 10 : 0,
|
|
1874
1650
|
...inputStyles
|
|
@@ -1877,40 +1653,41 @@ var TextField2 = React15.forwardRef(
|
|
|
1877
1653
|
fontSize: "14@s",
|
|
1878
1654
|
flex: 1,
|
|
1879
1655
|
alignSelf: "stretch",
|
|
1880
|
-
paddingLeft:
|
|
1656
|
+
paddingLeft: inputPadding,
|
|
1881
1657
|
paddingRight: moderateScale2(10),
|
|
1658
|
+
...isFloating ? { paddingTop: "11@vs", fontFamily: getFontFamily(400) } : {},
|
|
1882
1659
|
color: disabled ? colors2.textSecondary.main : colors2.dark.main,
|
|
1883
1660
|
zIndex: 10
|
|
1884
|
-
// backgroundColor: "#284",
|
|
1885
1661
|
},
|
|
1886
1662
|
inputText: {
|
|
1887
1663
|
fontSize: "14@ms",
|
|
1888
|
-
|
|
1889
|
-
paddingLeft:
|
|
1890
|
-
|
|
1891
|
-
placeholder: {
|
|
1892
|
-
fontSize: "14@ms",
|
|
1893
|
-
color: colors2.textSecondary.light,
|
|
1894
|
-
paddingLeft: moderateScale2(10)
|
|
1664
|
+
flex: 1,
|
|
1665
|
+
paddingLeft: inputPadding,
|
|
1666
|
+
...isFloating ? { paddingTop: "13@ms" } : {}
|
|
1895
1667
|
},
|
|
1896
1668
|
dateContent: {
|
|
1897
1669
|
flexDirection: "row",
|
|
1898
1670
|
alignItems: "center",
|
|
1899
1671
|
flex: 1,
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
dateText: {
|
|
1904
|
-
fontSize: "14@ms",
|
|
1905
|
-
flex: 1
|
|
1906
|
-
},
|
|
1907
|
-
datePlaceholder: {
|
|
1908
|
-
color: colors2.textSecondary.light
|
|
1672
|
+
paddingLeft: inputPadding,
|
|
1673
|
+
paddingRight: moderateScale2(10),
|
|
1674
|
+
paddingTop: isFloating ? variant === "text" ? ms7(13) : ms7(12) : multiline ? 4 : 0
|
|
1909
1675
|
},
|
|
1910
|
-
|
|
1676
|
+
dateText: { fontSize: "14@ms", flex: 1 },
|
|
1677
|
+
datePlaceholder: { color: datePlaceholderColor },
|
|
1678
|
+
...isFloating ? {
|
|
1679
|
+
label: {
|
|
1680
|
+
fontFamily: getFontFamily(400),
|
|
1681
|
+
position: "absolute",
|
|
1682
|
+
left: variant === "text" ? 0 : moderateScale2(15),
|
|
1683
|
+
fontSize: labelOpen ? "10@s" : "13@s",
|
|
1684
|
+
color: focused ? colors2[color].main : colors2.textSecondary.main
|
|
1685
|
+
}
|
|
1686
|
+
} : {},
|
|
1911
1687
|
helperText: {
|
|
1912
1688
|
paddingHorizontal: "15@s",
|
|
1913
|
-
|
|
1689
|
+
flex: 1,
|
|
1690
|
+
color: focused ? colors2[color].dark : helperTextUnfocusedColor,
|
|
1914
1691
|
paddingTop: "4@ms"
|
|
1915
1692
|
},
|
|
1916
1693
|
error: {
|
|
@@ -1920,69 +1697,16 @@ var TextField2 = React15.forwardRef(
|
|
|
1920
1697
|
flexDirection: "row",
|
|
1921
1698
|
alignItems: "center"
|
|
1922
1699
|
},
|
|
1923
|
-
errorText: {
|
|
1924
|
-
|
|
1925
|
-
|
|
1700
|
+
errorText: { fontSize: 12, marginLeft: 10 },
|
|
1701
|
+
placeholder: {
|
|
1702
|
+
fontSize: "14@ms",
|
|
1703
|
+
color: colors2.textSecondary.light,
|
|
1704
|
+
paddingLeft: inputPadding
|
|
1926
1705
|
}
|
|
1927
1706
|
});
|
|
1928
|
-
const
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
autoCapitalize: "none",
|
|
1932
|
-
autoCompleteType: "email"
|
|
1933
|
-
} : type === "number" ? {
|
|
1934
|
-
keyboardType: "numeric"
|
|
1935
|
-
} : type === "tel" ? {
|
|
1936
|
-
textContentType: "telephoneNumber",
|
|
1937
|
-
keyboardType: "phone-pad"
|
|
1938
|
-
} : type === "search" ? {
|
|
1939
|
-
keyboardType: "web-search",
|
|
1940
|
-
returnKeyType: "search",
|
|
1941
|
-
autoCapitalize: "none"
|
|
1942
|
-
} : type === "password" ? {
|
|
1943
|
-
secureTextEntry: !showPassword,
|
|
1944
|
-
autoCompleteType: "password",
|
|
1945
|
-
autoCapitalize: "none",
|
|
1946
|
-
textContentType: "password"
|
|
1947
|
-
} : {};
|
|
1948
|
-
const parseDateValue = () => {
|
|
1949
|
-
if (!value)
|
|
1950
|
-
return /* @__PURE__ */ new Date();
|
|
1951
|
-
if (value instanceof Date)
|
|
1952
|
-
return value;
|
|
1953
|
-
const isoParts = `${value}`.split("-");
|
|
1954
|
-
if (isoParts.length === 3) {
|
|
1955
|
-
const [year, month, day] = isoParts;
|
|
1956
|
-
const parsed = new Date(
|
|
1957
|
-
parseInt(year, 10),
|
|
1958
|
-
parseInt(month, 10) - 1,
|
|
1959
|
-
parseInt(day, 10)
|
|
1960
|
-
);
|
|
1961
|
-
if (!isNaN(parsed.getTime()))
|
|
1962
|
-
return parsed;
|
|
1963
|
-
}
|
|
1964
|
-
const fallback = new Date(value);
|
|
1965
|
-
return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
|
|
1966
|
-
};
|
|
1967
|
-
const handleDateConfirm = (date) => {
|
|
1968
|
-
const year = date.getFullYear();
|
|
1969
|
-
const month = `${date.getMonth() + 1}`.padStart(2, "0");
|
|
1970
|
-
const day = `${date.getDate()}`.padStart(2, "0");
|
|
1971
|
-
const dateString = `${year}-${month}-${day}`;
|
|
1972
|
-
onChangeText?.(dateString);
|
|
1973
|
-
setDatePickerVisible(false);
|
|
1974
|
-
setFocused(false);
|
|
1975
|
-
};
|
|
1976
|
-
const handleContainerPress = () => {
|
|
1977
|
-
if (disabled)
|
|
1978
|
-
return;
|
|
1979
|
-
setFocused(true);
|
|
1980
|
-
if (isDate) {
|
|
1981
|
-
onFocus();
|
|
1982
|
-
setDatePickerVisible(true);
|
|
1983
|
-
}
|
|
1984
|
-
};
|
|
1985
|
-
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(View10, { style: styles.root }, label && /* @__PURE__ */ React15.createElement(
|
|
1707
|
+
const selectedOption = options?.find((cur) => cur.value === value);
|
|
1708
|
+
const showPasswordToggle = type === "password" && !end && !options && !isDate;
|
|
1709
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(View10, { style: styles.root }, isFloating ? null : label != null && label !== "" ? /* @__PURE__ */ React15.createElement(
|
|
1986
1710
|
Typography_default,
|
|
1987
1711
|
{
|
|
1988
1712
|
variant: "body2",
|
|
@@ -1991,22 +1715,61 @@ var TextField2 = React15.forwardRef(
|
|
|
1991
1715
|
...labelProps
|
|
1992
1716
|
},
|
|
1993
1717
|
label
|
|
1994
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1718
|
+
) : null, /* @__PURE__ */ React15.createElement(
|
|
1995
1719
|
TouchableOpacity7,
|
|
1996
1720
|
{
|
|
1997
1721
|
onPress: handleContainerPress,
|
|
1998
|
-
style: styles.container
|
|
1722
|
+
style: styles.container,
|
|
1723
|
+
activeOpacity: 1
|
|
1999
1724
|
},
|
|
2000
|
-
/* @__PURE__ */ React15.createElement(
|
|
2001
|
-
|
|
2002
|
-
|
|
1725
|
+
isFloating && label != null && label !== "" ? /* @__PURE__ */ React15.createElement(Animated3.Text, { style: { ...styles.label, top: labelAnim } }, label) : null,
|
|
1726
|
+
/* @__PURE__ */ React15.createElement(View10, { style: { marginTop: multiline && !isFloating ? 5 : 0 } }, start),
|
|
1727
|
+
options ? /* @__PURE__ */ React15.createElement(
|
|
1728
|
+
View10,
|
|
2003
1729
|
{
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
1730
|
+
style: isFloating ? {
|
|
1731
|
+
flex: 1,
|
|
1732
|
+
alignItems: "center",
|
|
1733
|
+
flexDirection: "row"
|
|
1734
|
+
} : void 0
|
|
1735
|
+
},
|
|
1736
|
+
isFloating && selectedOption?.start ? /* @__PURE__ */ React15.createElement(
|
|
1737
|
+
View10,
|
|
1738
|
+
{
|
|
1739
|
+
style: {
|
|
1740
|
+
paddingTop: variant !== "outlined" ? ms7(13) : 0,
|
|
1741
|
+
paddingRight: 10
|
|
1742
|
+
}
|
|
1743
|
+
},
|
|
1744
|
+
selectedOption.start
|
|
1745
|
+
) : null,
|
|
1746
|
+
selectedOption ? /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.inputText }, selectedOption.label) : !isFloating && /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.placeholder }, placeholder),
|
|
1747
|
+
isFloating ? /* @__PURE__ */ React15.createElement(
|
|
1748
|
+
View10,
|
|
1749
|
+
{
|
|
1750
|
+
style: {
|
|
1751
|
+
marginRight: variant === "text" ? 0 : 20,
|
|
1752
|
+
paddingTop: variant === "text" ? ms7(13) : 0
|
|
1753
|
+
}
|
|
1754
|
+
},
|
|
1755
|
+
/* @__PURE__ */ React15.createElement(
|
|
1756
|
+
Ionicons4,
|
|
1757
|
+
{
|
|
1758
|
+
name: "chevron-down",
|
|
1759
|
+
color: colors2.textSecondary.main,
|
|
1760
|
+
size: 24
|
|
1761
|
+
}
|
|
1762
|
+
)
|
|
1763
|
+
) : /* @__PURE__ */ React15.createElement(
|
|
1764
|
+
Ionicons4,
|
|
1765
|
+
{
|
|
1766
|
+
name: "chevron-down",
|
|
1767
|
+
size: 24,
|
|
1768
|
+
style: { marginLeft: "auto", marginRight: 15 },
|
|
1769
|
+
color: colors2.dark.light
|
|
1770
|
+
}
|
|
1771
|
+
)
|
|
1772
|
+
) : isDate ? /* @__PURE__ */ React15.createElement(View10, { style: styles.dateContent }, /* @__PURE__ */ React15.createElement(
|
|
2010
1773
|
Typography_default,
|
|
2011
1774
|
{
|
|
2012
1775
|
style: [
|
|
@@ -2037,21 +1800,30 @@ var TextField2 = React15.forwardRef(
|
|
|
2037
1800
|
},
|
|
2038
1801
|
value,
|
|
2039
1802
|
onChangeText,
|
|
2040
|
-
key: showPassword ? "show" : "hide",
|
|
1803
|
+
key: type === "password" ? showPassword ? "show" : "hide" : void 0,
|
|
2041
1804
|
keyboardType,
|
|
2042
|
-
placeholderTextColor: colors2.textSecondary.light,
|
|
1805
|
+
placeholderTextColor: isFloating ? colors2.textSecondary.main : colors2.textSecondary.light,
|
|
2043
1806
|
editable: !disabled,
|
|
2044
1807
|
placeholder,
|
|
2045
1808
|
selectTextOnFocus: !disabled,
|
|
2046
1809
|
onSubmitEditing,
|
|
2047
1810
|
multiline,
|
|
2048
|
-
|
|
1811
|
+
textAlignVertical: multiline ? "top" : "center",
|
|
2049
1812
|
...formProps,
|
|
2050
1813
|
...props,
|
|
2051
1814
|
style: styles.input
|
|
2052
1815
|
}
|
|
2053
1816
|
),
|
|
2054
|
-
end
|
|
1817
|
+
end && !options ? /* @__PURE__ */ React15.createElement(
|
|
1818
|
+
View10,
|
|
1819
|
+
{
|
|
1820
|
+
style: {
|
|
1821
|
+
marginRight: 20,
|
|
1822
|
+
paddingTop: isFloating && variant === "text" ? ms7(13) : 0
|
|
1823
|
+
}
|
|
1824
|
+
},
|
|
1825
|
+
end
|
|
1826
|
+
) : showPasswordToggle ? /* @__PURE__ */ React15.createElement(
|
|
2055
1827
|
TouchableOpacity7,
|
|
2056
1828
|
{
|
|
2057
1829
|
style: { marginRight: 20 },
|
|
@@ -2065,8 +1837,8 @@ var TextField2 = React15.forwardRef(
|
|
|
2065
1837
|
color: colors2.textSecondary.main
|
|
2066
1838
|
}
|
|
2067
1839
|
)
|
|
2068
|
-
)
|
|
2069
|
-
), helperText
|
|
1840
|
+
) : null
|
|
1841
|
+
), helperText ? /* @__PURE__ */ React15.createElement(
|
|
2070
1842
|
Typography_default,
|
|
2071
1843
|
{
|
|
2072
1844
|
color: "textSecondary",
|
|
@@ -2074,7 +1846,7 @@ var TextField2 = React15.forwardRef(
|
|
|
2074
1846
|
variant: "caption"
|
|
2075
1847
|
},
|
|
2076
1848
|
helperText
|
|
2077
|
-
), error
|
|
1849
|
+
) : null, error ? /* @__PURE__ */ React15.createElement(View10, { style: styles.error }, /* @__PURE__ */ React15.createElement(MaterialIcons5, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.errorText, color: "error" }, error)) : null), options ? /* @__PURE__ */ React15.createElement(
|
|
2078
1850
|
SelectMenu_default,
|
|
2079
1851
|
{
|
|
2080
1852
|
options,
|
|
@@ -2086,21 +1858,45 @@ var TextField2 = React15.forwardRef(
|
|
|
2086
1858
|
onChange: onChangeText,
|
|
2087
1859
|
...selectMenuProps
|
|
2088
1860
|
}
|
|
2089
|
-
), isDate
|
|
1861
|
+
) : null, isDate ? /* @__PURE__ */ React15.createElement(
|
|
2090
1862
|
DateTimePickerModal,
|
|
2091
1863
|
{
|
|
2092
1864
|
isVisible: datePickerVisible,
|
|
2093
1865
|
mode: "date",
|
|
2094
|
-
date: parseDateValue(),
|
|
1866
|
+
date: parseDateValue(value),
|
|
2095
1867
|
onConfirm: handleDateConfirm,
|
|
2096
1868
|
onCancel: () => {
|
|
2097
1869
|
setDatePickerVisible(false);
|
|
2098
1870
|
setFocused(false);
|
|
2099
1871
|
}
|
|
2100
1872
|
}
|
|
2101
|
-
));
|
|
1873
|
+
) : null);
|
|
1874
|
+
}
|
|
1875
|
+
);
|
|
1876
|
+
TextFieldBase.displayName = "TextFieldBase";
|
|
1877
|
+
var TextField = React15.forwardRef((props, ref) => /* @__PURE__ */ React15.createElement(
|
|
1878
|
+
TextFieldBase,
|
|
1879
|
+
{
|
|
1880
|
+
...props,
|
|
1881
|
+
ref,
|
|
1882
|
+
labelVariant: "floating",
|
|
1883
|
+
gutterBottom: props.gutterBottom ?? 0,
|
|
1884
|
+
placeholder: props.placeholder ?? ""
|
|
2102
1885
|
}
|
|
1886
|
+
));
|
|
1887
|
+
TextField.displayName = "TextField";
|
|
1888
|
+
var TextField2 = React15.forwardRef(
|
|
1889
|
+
(props, ref) => /* @__PURE__ */ React15.createElement(
|
|
1890
|
+
TextFieldBase,
|
|
1891
|
+
{
|
|
1892
|
+
...props,
|
|
1893
|
+
ref,
|
|
1894
|
+
labelVariant: "external",
|
|
1895
|
+
gutterBottom: props.gutterBottom ?? 8
|
|
1896
|
+
}
|
|
1897
|
+
)
|
|
2103
1898
|
);
|
|
1899
|
+
TextField2.displayName = "TextField2";
|
|
2104
1900
|
var TextField_default = TextField;
|
|
2105
1901
|
|
|
2106
1902
|
// ../src/Components/Locator.tsx
|
|
@@ -3067,6 +2863,7 @@ export {
|
|
|
3067
2863
|
Spinner_default as Spinner,
|
|
3068
2864
|
TextField_default as TextField,
|
|
3069
2865
|
TextField2,
|
|
2866
|
+
TextFieldBase,
|
|
3070
2867
|
Typography_default as Typography,
|
|
3071
2868
|
UIThemeContext,
|
|
3072
2869
|
UIThemeProvider,
|