@hoddy-ui/core 1.1.0 → 1.1.2
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/README.md +972 -190
- package/index.ts +7 -3
- package/next/dist/index.d.mts +62 -7
- package/next/dist/index.d.ts +62 -7
- package/next/dist/index.js +225 -200
- package/next/dist/index.js.map +1 -1
- package/next/dist/index.mjs +223 -200
- package/next/dist/index.mjs.map +1 -1
- package/next/index.ts +1 -0
- package/next/package.json +1 -1
- package/package.json +1 -1
- package/src/Components/Animators/Animator.tsx +117 -0
- package/src/Components/Animators/README.md +137 -0
- package/src/Components/Animators/hooks/index.ts +8 -0
- package/src/Components/Animators/hooks/useAppState.ts +37 -0
- package/src/Components/Animators/hooks/useBlinkAnimation.ts +71 -0
- package/src/Components/Animators/hooks/useFadeAnimation.ts +50 -0
- package/src/Components/Animators/hooks/useFloatAnimation.ts +103 -0
- package/src/Components/Animators/hooks/useGrowAnimation.ts +54 -0
- package/src/Components/Animators/hooks/useRollAnimation.ts +86 -0
- package/src/Components/Animators/hooks/useSlideAnimation.ts +88 -0
- package/src/Components/Animators/hooks/useThrownUpAnimation.ts +82 -0
- package/src/Components/Locator.tsx +50 -22
- package/src/Components/Popup.tsx +16 -13
- package/src/Components/TextField.tsx +230 -220
- package/src/Components/Typography.tsx +0 -2
- package/src/config/KeyManager.ts +2 -0
- package/src/config/index.ts +2 -0
- package/src/theme/index.tsx +3 -1
- package/src/types.ts +57 -9
- package/src/Components/Animator.tsx +0 -43
package/next/dist/index.js
CHANGED
|
@@ -55,7 +55,9 @@ __export(next_exports, {
|
|
|
55
55
|
UIThemeContext: () => UIThemeContext,
|
|
56
56
|
UIThemeProvider: () => UIThemeProvider,
|
|
57
57
|
default: () => next_default,
|
|
58
|
+
getLocationFromPlaceId: () => getLocationFromPlaceId,
|
|
58
59
|
getPredictionsFromCoords: () => getPredictionsFromCoords,
|
|
60
|
+
getPredictionsFromQuery: () => getPredictionsFromQuery,
|
|
59
61
|
showFlashMessage: () => showFlashMessage,
|
|
60
62
|
useColors: () => useColors,
|
|
61
63
|
useNavScreenOptions: () => useNavScreenOptions,
|
|
@@ -211,7 +213,8 @@ function colors(theme) {
|
|
|
211
213
|
|
|
212
214
|
// ../src/config/KeyManager.ts
|
|
213
215
|
var config = {
|
|
214
|
-
GOOGLE_MAP_API_KEY: ""
|
|
216
|
+
GOOGLE_MAP_API_KEY: "",
|
|
217
|
+
EDGE_TO_EDGE: false
|
|
215
218
|
};
|
|
216
219
|
function setConfig(key) {
|
|
217
220
|
config = key;
|
|
@@ -225,7 +228,8 @@ function initialize(config2) {
|
|
|
225
228
|
try {
|
|
226
229
|
setConfig({
|
|
227
230
|
GOOGLE_MAP_API_KEY: config2.googleMapApiKey,
|
|
228
|
-
DEFAULT_FONT_FAMILY: config2.fontFamily
|
|
231
|
+
DEFAULT_FONT_FAMILY: config2.fontFamily,
|
|
232
|
+
EDGE_TO_EDGE: config2.edgeToEdge ?? false
|
|
229
233
|
});
|
|
230
234
|
if (config2.colors)
|
|
231
235
|
setExtraColors(config2.colors);
|
|
@@ -271,7 +275,6 @@ var Typography = (0, import_react.forwardRef)(
|
|
|
271
275
|
variant = "body1",
|
|
272
276
|
align = "left",
|
|
273
277
|
gutterBottom = 0,
|
|
274
|
-
numberOfLines,
|
|
275
278
|
adjustsFontSizeToFit,
|
|
276
279
|
fontWeight = 400,
|
|
277
280
|
fontFamily,
|
|
@@ -307,7 +310,6 @@ var Typography = (0, import_react.forwardRef)(
|
|
|
307
310
|
import_react_native.Text,
|
|
308
311
|
{
|
|
309
312
|
ref,
|
|
310
|
-
numberOfLines,
|
|
311
313
|
adjustsFontSizeToFit,
|
|
312
314
|
style: [styles2.text, style],
|
|
313
315
|
...props
|
|
@@ -399,9 +401,10 @@ var ConfigureSystemUI = () => {
|
|
|
399
401
|
const theme = useTheme();
|
|
400
402
|
const colors2 = useColors();
|
|
401
403
|
(0, import_react3.useEffect)(() => {
|
|
404
|
+
const config2 = getConfig();
|
|
402
405
|
if (colors2) {
|
|
403
406
|
SystemUI.setBackgroundColorAsync(colors2.white[1]);
|
|
404
|
-
if (import_react_native3.Platform.OS === "android") {
|
|
407
|
+
if (import_react_native3.Platform.OS === "android" && !config2.EDGE_TO_EDGE) {
|
|
405
408
|
NavigationBar.setBackgroundColorAsync(colors2.white[1]);
|
|
406
409
|
if (theme === "dark") {
|
|
407
410
|
NavigationBar.setButtonStyleAsync("light");
|
|
@@ -917,15 +920,18 @@ var Popup = ({
|
|
|
917
920
|
...style
|
|
918
921
|
},
|
|
919
922
|
content: {
|
|
920
|
-
paddingHorizontal: bare ? void 0 : "
|
|
923
|
+
paddingHorizontal: bare ? void 0 : "15@ms"
|
|
921
924
|
// flex: 1,
|
|
922
925
|
},
|
|
923
926
|
title: {
|
|
924
927
|
flexDirection: "row",
|
|
925
928
|
alignItems: "center",
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
+
justifyContent: "center",
|
|
930
|
+
height: "50@ms"
|
|
931
|
+
},
|
|
932
|
+
titleIcon: {
|
|
933
|
+
position: "absolute",
|
|
934
|
+
left: "15@ms"
|
|
929
935
|
},
|
|
930
936
|
backdrop: {
|
|
931
937
|
position: "absolute",
|
|
@@ -984,14 +990,14 @@ var Popup = ({
|
|
|
984
990
|
keyboardVerticalOffset,
|
|
985
991
|
behavior: import_react_native11.Platform.OS === "ios" ? "position" : "padding"
|
|
986
992
|
},
|
|
987
|
-
/* @__PURE__ */ import_react11.default.createElement(import_react_native11.View, { style: styles2.container }, !bare && /* @__PURE__ */ import_react11.default.createElement(import_react_native11.View, { style: styles2.title }, /* @__PURE__ */ import_react11.default.createElement(
|
|
993
|
+
/* @__PURE__ */ import_react11.default.createElement(import_react_native11.View, { style: styles2.container }, !bare && /* @__PURE__ */ import_react11.default.createElement(import_react_native11.View, { style: styles2.title }, /* @__PURE__ */ import_react11.default.createElement(import_react_native11.View, { style: styles2.titleIcon }, /* @__PURE__ */ import_react11.default.createElement(
|
|
988
994
|
IconButton,
|
|
989
995
|
{
|
|
990
996
|
size: 20,
|
|
991
997
|
icon: "close",
|
|
992
998
|
onPress: closeAction
|
|
993
999
|
}
|
|
994
|
-
), /* @__PURE__ */ import_react11.default.createElement(
|
|
1000
|
+
)), /* @__PURE__ */ import_react11.default.createElement(Typography_default, { align: "center", fontWeight: 500 }, title)), /* @__PURE__ */ import_react11.default.createElement(import_react_native11.View, { style: styles2.content }, children))
|
|
995
1001
|
)))
|
|
996
1002
|
))
|
|
997
1003
|
));
|
|
@@ -1571,191 +1577,198 @@ var TextField = ({
|
|
|
1571
1577
|
}
|
|
1572
1578
|
));
|
|
1573
1579
|
};
|
|
1574
|
-
var TextField2 = (
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
onFocus = () => {
|
|
1585
|
-
},
|
|
1586
|
-
onBlur = () => {
|
|
1587
|
-
},
|
|
1588
|
-
error,
|
|
1589
|
-
start,
|
|
1590
|
-
rounded,
|
|
1591
|
-
disabled = false,
|
|
1592
|
-
style = {},
|
|
1593
|
-
inputStyles = {},
|
|
1594
|
-
gutterBottom = 8,
|
|
1595
|
-
placeholder,
|
|
1596
|
-
end,
|
|
1597
|
-
options,
|
|
1598
|
-
...props
|
|
1599
|
-
}) => {
|
|
1600
|
-
const colors2 = useColors();
|
|
1601
|
-
const [focused, _setFocused] = (0, import_react16.useState)(false);
|
|
1602
|
-
const [showPassword, setShowPassword] = (0, import_react16.useState)(false);
|
|
1603
|
-
const height = (0, import_react_native_size_matters14.moderateScale)(
|
|
1604
|
-
props.multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
|
|
1605
|
-
);
|
|
1606
|
-
const setFocused = (value2) => {
|
|
1607
|
-
_setFocused(value2);
|
|
1608
|
-
};
|
|
1609
|
-
const styles2 = import_react_native_size_matters14.ScaledSheet.create({
|
|
1610
|
-
root: {
|
|
1611
|
-
marginBottom: gutterBottom + "@vs",
|
|
1612
|
-
...style
|
|
1613
|
-
},
|
|
1614
|
-
container: {
|
|
1615
|
-
height,
|
|
1616
|
-
overflow: "hidden",
|
|
1617
|
-
flexDirection: "row",
|
|
1618
|
-
borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.white[5],
|
|
1619
|
-
borderWidth: error ? 1 : focused ? 2 : 1,
|
|
1620
|
-
width: "100%",
|
|
1621
|
-
borderRadius: rounded ? 30 : 10,
|
|
1622
|
-
alignItems: "center",
|
|
1623
|
-
...inputStyles
|
|
1624
|
-
},
|
|
1625
|
-
input: {
|
|
1626
|
-
fontSize: "14@s",
|
|
1627
|
-
flex: 1,
|
|
1628
|
-
alignSelf: "stretch",
|
|
1629
|
-
paddingLeft: (0, import_react_native_size_matters14.moderateScale)(10),
|
|
1630
|
-
paddingRight: (0, import_react_native_size_matters14.moderateScale)(10),
|
|
1631
|
-
color: colors2.dark.main,
|
|
1632
|
-
zIndex: 10
|
|
1633
|
-
// backgroundColor: "#284",
|
|
1634
|
-
},
|
|
1635
|
-
inputText: {
|
|
1636
|
-
fontSize: "14@ms",
|
|
1637
|
-
color: colors2.dark.main,
|
|
1638
|
-
paddingLeft: (0, import_react_native_size_matters14.moderateScale)(10)
|
|
1639
|
-
},
|
|
1640
|
-
placeholder: {
|
|
1641
|
-
fontSize: "14@ms",
|
|
1642
|
-
color: colors2.textSecondary.main,
|
|
1643
|
-
paddingLeft: (0, import_react_native_size_matters14.moderateScale)(10)
|
|
1644
|
-
},
|
|
1645
|
-
label: {},
|
|
1646
|
-
helperText: {
|
|
1647
|
-
paddingHorizontal: "15@s",
|
|
1648
|
-
color: focused ? colors2[color].dark : "#fffa",
|
|
1649
|
-
paddingTop: "4@ms"
|
|
1580
|
+
var TextField2 = import_react16.default.forwardRef(
|
|
1581
|
+
({
|
|
1582
|
+
label,
|
|
1583
|
+
keyboardType,
|
|
1584
|
+
color = "primary",
|
|
1585
|
+
value,
|
|
1586
|
+
type,
|
|
1587
|
+
helperText,
|
|
1588
|
+
onChangeText,
|
|
1589
|
+
onSubmitEditing = () => {
|
|
1650
1590
|
},
|
|
1651
|
-
|
|
1652
|
-
paddingLeft: 10,
|
|
1653
|
-
paddingRight: 10,
|
|
1654
|
-
paddingTop: 5,
|
|
1655
|
-
flexDirection: "row",
|
|
1656
|
-
alignItems: "center"
|
|
1591
|
+
onFocus = () => {
|
|
1657
1592
|
},
|
|
1658
|
-
|
|
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: !showPassword,
|
|
1679
|
-
autoCompleteType: "password",
|
|
1680
|
-
autoCapitalize: "none",
|
|
1681
|
-
textContentType: "password"
|
|
1682
|
-
} : {};
|
|
1683
|
-
return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles2.root }, label && /* @__PURE__ */ import_react16.default.createElement(Typography_default, { variant: "body1", color: "textSecondary", gutterBottom: 7 }, label), /* @__PURE__ */ import_react16.default.createElement(
|
|
1684
|
-
import_react_native16.TouchableOpacity,
|
|
1685
|
-
{
|
|
1686
|
-
onPress: () => setFocused(true),
|
|
1687
|
-
style: styles2.container
|
|
1593
|
+
onBlur = () => {
|
|
1688
1594
|
},
|
|
1595
|
+
error,
|
|
1689
1596
|
start,
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1597
|
+
rounded,
|
|
1598
|
+
disabled = false,
|
|
1599
|
+
style = {},
|
|
1600
|
+
inputStyles = {},
|
|
1601
|
+
gutterBottom = 8,
|
|
1602
|
+
placeholder,
|
|
1603
|
+
end,
|
|
1604
|
+
options,
|
|
1605
|
+
multiline,
|
|
1606
|
+
...props
|
|
1607
|
+
}, ref) => {
|
|
1608
|
+
const colors2 = useColors();
|
|
1609
|
+
const [focused, _setFocused] = (0, import_react16.useState)(false);
|
|
1610
|
+
const [showPassword, setShowPassword] = (0, import_react16.useState)(false);
|
|
1611
|
+
const height = (0, import_react_native_size_matters14.moderateScale)(
|
|
1612
|
+
multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
|
|
1613
|
+
);
|
|
1614
|
+
const setFocused = (value2) => {
|
|
1615
|
+
_setFocused(value2);
|
|
1616
|
+
};
|
|
1617
|
+
const styles2 = import_react_native_size_matters14.ScaledSheet.create({
|
|
1618
|
+
root: {
|
|
1619
|
+
marginBottom: gutterBottom + "@vs",
|
|
1620
|
+
...style
|
|
1621
|
+
},
|
|
1622
|
+
container: {
|
|
1623
|
+
height,
|
|
1624
|
+
overflow: "hidden",
|
|
1625
|
+
flexDirection: "row",
|
|
1626
|
+
borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.white[4],
|
|
1627
|
+
borderWidth: error ? 1 : focused ? 2 : 1,
|
|
1628
|
+
width: "100%",
|
|
1629
|
+
borderRadius: rounded ? 30 : 10,
|
|
1630
|
+
alignItems: multiline ? "flex-start" : "center",
|
|
1631
|
+
paddingVertical: multiline ? 10 : 0,
|
|
1632
|
+
...inputStyles
|
|
1633
|
+
},
|
|
1634
|
+
input: {
|
|
1635
|
+
fontSize: "14@s",
|
|
1636
|
+
flex: 1,
|
|
1637
|
+
alignSelf: "stretch",
|
|
1638
|
+
paddingLeft: (0, import_react_native_size_matters14.moderateScale)(10),
|
|
1639
|
+
paddingRight: (0, import_react_native_size_matters14.moderateScale)(10),
|
|
1640
|
+
color: colors2.dark.main,
|
|
1641
|
+
zIndex: 10
|
|
1642
|
+
// backgroundColor: "#284",
|
|
1643
|
+
},
|
|
1644
|
+
inputText: {
|
|
1645
|
+
fontSize: "14@ms",
|
|
1646
|
+
color: colors2.dark.main,
|
|
1647
|
+
paddingLeft: (0, import_react_native_size_matters14.moderateScale)(10)
|
|
1648
|
+
},
|
|
1649
|
+
placeholder: {
|
|
1650
|
+
fontSize: "14@ms",
|
|
1651
|
+
color: colors2.textSecondary.light,
|
|
1652
|
+
paddingLeft: (0, import_react_native_size_matters14.moderateScale)(10)
|
|
1653
|
+
},
|
|
1654
|
+
label: {},
|
|
1655
|
+
helperText: {
|
|
1656
|
+
paddingHorizontal: "15@s",
|
|
1657
|
+
color: focused ? colors2[color].dark : "#fffa",
|
|
1658
|
+
paddingTop: "4@ms"
|
|
1659
|
+
},
|
|
1660
|
+
error: {
|
|
1661
|
+
paddingLeft: 10,
|
|
1662
|
+
paddingRight: 10,
|
|
1663
|
+
paddingTop: 5,
|
|
1664
|
+
flexDirection: "row",
|
|
1665
|
+
alignItems: "center"
|
|
1666
|
+
},
|
|
1667
|
+
errorText: {
|
|
1668
|
+
fontSize: 12,
|
|
1669
|
+
marginLeft: 10
|
|
1721
1670
|
}
|
|
1722
|
-
)
|
|
1723
|
-
|
|
1671
|
+
});
|
|
1672
|
+
const formProps = type === "email" ? {
|
|
1673
|
+
textContentType: "emailAddress",
|
|
1674
|
+
keyboardType: "email-address",
|
|
1675
|
+
autoCapitalize: "none",
|
|
1676
|
+
autoCompleteType: "email"
|
|
1677
|
+
} : type === "number" ? {
|
|
1678
|
+
keyboardType: "numeric"
|
|
1679
|
+
} : type === "tel" ? {
|
|
1680
|
+
textContentType: "telephoneNumber",
|
|
1681
|
+
keyboardType: "phone-pad"
|
|
1682
|
+
} : type === "search" ? {
|
|
1683
|
+
keyboardType: "web-search",
|
|
1684
|
+
returnKeyType: "search",
|
|
1685
|
+
autoCapitalize: "none"
|
|
1686
|
+
} : type === "password" ? {
|
|
1687
|
+
secureTextEntry: !showPassword,
|
|
1688
|
+
autoCompleteType: "password",
|
|
1689
|
+
autoCapitalize: "none",
|
|
1690
|
+
textContentType: "password"
|
|
1691
|
+
} : {};
|
|
1692
|
+
return /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles2.root }, label && /* @__PURE__ */ import_react16.default.createElement(Typography_default, { variant: "body1", color: "textSecondary", gutterBottom: 7 }, label), /* @__PURE__ */ import_react16.default.createElement(
|
|
1724
1693
|
import_react_native16.TouchableOpacity,
|
|
1725
1694
|
{
|
|
1726
|
-
|
|
1727
|
-
|
|
1695
|
+
onPress: () => setFocused(true),
|
|
1696
|
+
style: styles2.container
|
|
1728
1697
|
},
|
|
1729
|
-
/* @__PURE__ */ import_react16.default.createElement(
|
|
1698
|
+
/* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginTop: multiline ? 5 : 0 } }, start),
|
|
1699
|
+
options ? /* @__PURE__ */ import_react16.default.createElement(import_react16.default.Fragment, null, value ? /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles2.inputText }, options.find((cur) => cur.value === value)?.label) : /* @__PURE__ */ import_react16.default.createElement(Typography_default, { style: styles2.placeholder }, placeholder), /* @__PURE__ */ import_react16.default.createElement(
|
|
1730
1700
|
import_vector_icons8.Ionicons,
|
|
1731
1701
|
{
|
|
1732
|
-
name:
|
|
1702
|
+
name: "chevron-down",
|
|
1733
1703
|
size: 24,
|
|
1734
|
-
|
|
1704
|
+
style: { marginLeft: "auto", marginRight: 15 },
|
|
1705
|
+
color: colors2.dark.light
|
|
1735
1706
|
}
|
|
1707
|
+
)) : /* @__PURE__ */ import_react16.default.createElement(
|
|
1708
|
+
import_react_native16.TextInput,
|
|
1709
|
+
{
|
|
1710
|
+
ref,
|
|
1711
|
+
onFocus: () => {
|
|
1712
|
+
onFocus();
|
|
1713
|
+
setFocused(true);
|
|
1714
|
+
},
|
|
1715
|
+
onBlur: () => {
|
|
1716
|
+
onBlur();
|
|
1717
|
+
setFocused(false);
|
|
1718
|
+
},
|
|
1719
|
+
value,
|
|
1720
|
+
onChangeText,
|
|
1721
|
+
key: showPassword ? "show" : "hide",
|
|
1722
|
+
keyboardType,
|
|
1723
|
+
placeholderTextColor: colors2.textSecondary.light,
|
|
1724
|
+
editable: !disabled,
|
|
1725
|
+
placeholder,
|
|
1726
|
+
selectTextOnFocus: !disabled,
|
|
1727
|
+
onSubmitEditing,
|
|
1728
|
+
multiline,
|
|
1729
|
+
textAlignVertical: multiline ? "top" : "center",
|
|
1730
|
+
...formProps,
|
|
1731
|
+
...props,
|
|
1732
|
+
style: styles2.input
|
|
1733
|
+
}
|
|
1734
|
+
),
|
|
1735
|
+
end ? /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: { marginRight: 20 } }, end) : type === "password" && /* @__PURE__ */ import_react16.default.createElement(
|
|
1736
|
+
import_react_native16.TouchableOpacity,
|
|
1737
|
+
{
|
|
1738
|
+
style: { marginRight: 20 },
|
|
1739
|
+
onPress: () => setShowPassword(!showPassword)
|
|
1740
|
+
},
|
|
1741
|
+
/* @__PURE__ */ import_react16.default.createElement(
|
|
1742
|
+
import_vector_icons8.Ionicons,
|
|
1743
|
+
{
|
|
1744
|
+
name: showPassword ? "eye-outline" : "eye-off-outline",
|
|
1745
|
+
size: 24,
|
|
1746
|
+
color: colors2.textSecondary.main
|
|
1747
|
+
}
|
|
1748
|
+
)
|
|
1736
1749
|
)
|
|
1737
|
-
)
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1750
|
+
), helperText && /* @__PURE__ */ import_react16.default.createElement(
|
|
1751
|
+
Typography_default,
|
|
1752
|
+
{
|
|
1753
|
+
color: "textSecondary",
|
|
1754
|
+
style: styles2.helperText,
|
|
1755
|
+
variant: "caption"
|
|
1756
|
+
},
|
|
1757
|
+
helperText
|
|
1758
|
+
), error && /* @__PURE__ */ import_react16.default.createElement(import_react_native16.View, { style: styles2.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: styles2.errorText, color: "error" }, error))), options && /* @__PURE__ */ import_react16.default.createElement(
|
|
1759
|
+
SelectMenu_default,
|
|
1760
|
+
{
|
|
1761
|
+
options,
|
|
1762
|
+
value,
|
|
1763
|
+
open: focused,
|
|
1764
|
+
onClose: () => setFocused(false),
|
|
1765
|
+
label,
|
|
1766
|
+
helperText,
|
|
1767
|
+
onChange: onChangeText
|
|
1768
|
+
}
|
|
1769
|
+
));
|
|
1770
|
+
}
|
|
1771
|
+
);
|
|
1759
1772
|
var TextField_default = TextField;
|
|
1760
1773
|
|
|
1761
1774
|
// ../src/Components/Locator.tsx
|
|
@@ -1783,6 +1796,27 @@ var getPredictionsFromCoords = async (coords) => {
|
|
|
1783
1796
|
}
|
|
1784
1797
|
return p;
|
|
1785
1798
|
};
|
|
1799
|
+
var getPredictionsFromQuery = async (query, country) => {
|
|
1800
|
+
const { GOOGLE_MAP_API_KEY } = getConfig();
|
|
1801
|
+
const endpoint = `https://maps.googleapis.com/maps/api/place/autocomplete/json?input=${query}&components=country:${country}&radius=20000&key=${GOOGLE_MAP_API_KEY}`;
|
|
1802
|
+
const res = await (await fetch(endpoint)).json();
|
|
1803
|
+
const p = [];
|
|
1804
|
+
for (let key in res.predictions) {
|
|
1805
|
+
const { description, place_id } = res.predictions[key];
|
|
1806
|
+
p.push({
|
|
1807
|
+
description,
|
|
1808
|
+
id: place_id
|
|
1809
|
+
});
|
|
1810
|
+
}
|
|
1811
|
+
return p;
|
|
1812
|
+
};
|
|
1813
|
+
var getLocationFromPlaceId = async (place_id) => {
|
|
1814
|
+
const { GOOGLE_MAP_API_KEY } = getConfig();
|
|
1815
|
+
const res = await (await fetch(
|
|
1816
|
+
`https://maps.googleapis.com/maps/api/place/details/json?place_id=${place_id}&fields=formatted_address%2Cgeometry&key=${GOOGLE_MAP_API_KEY}`
|
|
1817
|
+
)).json();
|
|
1818
|
+
return res.result;
|
|
1819
|
+
};
|
|
1786
1820
|
var Locator = ({
|
|
1787
1821
|
variant = "contained",
|
|
1788
1822
|
onLocationSelected,
|
|
@@ -1822,17 +1856,8 @@ var Locator = ({
|
|
|
1822
1856
|
}
|
|
1823
1857
|
});
|
|
1824
1858
|
const search = async (query) => {
|
|
1825
|
-
const
|
|
1826
|
-
|
|
1827
|
-
const p = [];
|
|
1828
|
-
for (let key in res.predictions) {
|
|
1829
|
-
const { description, place_id } = res.predictions[key];
|
|
1830
|
-
p.push({
|
|
1831
|
-
description,
|
|
1832
|
-
id: place_id
|
|
1833
|
-
});
|
|
1834
|
-
}
|
|
1835
|
-
setPrediction(p);
|
|
1859
|
+
const predictions = await getPredictionsFromQuery(query, country);
|
|
1860
|
+
setPrediction(predictions);
|
|
1836
1861
|
};
|
|
1837
1862
|
const locateMe = () => {
|
|
1838
1863
|
const getLoc = async () => {
|
|
@@ -1866,16 +1891,14 @@ var Locator = ({
|
|
|
1866
1891
|
};
|
|
1867
1892
|
const locationPressed = async (loc) => {
|
|
1868
1893
|
setValue(loc.description);
|
|
1869
|
-
const res = await (
|
|
1870
|
-
`https://maps.googleapis.com/maps/api/place/details/json?place_id=${loc.id}&fields=formatted_address%2Cgeometry&key=${GOOGLE_MAP_API_KEY}`
|
|
1871
|
-
)).json();
|
|
1894
|
+
const res = await getLocationFromPlaceId(loc.id);
|
|
1872
1895
|
onLocationSelected(
|
|
1873
1896
|
{
|
|
1874
|
-
latitude: res.
|
|
1875
|
-
longitude: res.
|
|
1897
|
+
latitude: res.geometry.location.lat,
|
|
1898
|
+
longitude: res.geometry.location.lng,
|
|
1876
1899
|
description: loc.description
|
|
1877
1900
|
},
|
|
1878
|
-
res
|
|
1901
|
+
res?.formatted_address
|
|
1879
1902
|
);
|
|
1880
1903
|
setChanged(false);
|
|
1881
1904
|
setPrediction([]);
|
|
@@ -2140,7 +2163,9 @@ var next_default = HoddyUI;
|
|
|
2140
2163
|
Typography,
|
|
2141
2164
|
UIThemeContext,
|
|
2142
2165
|
UIThemeProvider,
|
|
2166
|
+
getLocationFromPlaceId,
|
|
2143
2167
|
getPredictionsFromCoords,
|
|
2168
|
+
getPredictionsFromQuery,
|
|
2144
2169
|
showFlashMessage,
|
|
2145
2170
|
useColors,
|
|
2146
2171
|
useNavScreenOptions,
|