react-native-better-html 1.0.25 → 1.0.27
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 +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +207 -138
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +155 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import {
|
|
3
|
-
useTheme as
|
|
3
|
+
useTheme as useTheme17,
|
|
4
4
|
useLoader as useLoader2,
|
|
5
5
|
useLoaderControls,
|
|
6
6
|
countries,
|
|
@@ -460,13 +460,15 @@ function useForm(options) {
|
|
|
460
460
|
setFieldValue(field, value);
|
|
461
461
|
}
|
|
462
462
|
} : {
|
|
463
|
+
required: requiredFields?.includes(field),
|
|
463
464
|
isChecked: values[field],
|
|
465
|
+
errorMessage: errors[field],
|
|
464
466
|
onChange: (value) => {
|
|
465
467
|
setFieldValue(field, value);
|
|
466
468
|
}
|
|
467
469
|
};
|
|
468
470
|
},
|
|
469
|
-
[values, setFieldValue]
|
|
471
|
+
[values, setFieldValue, errors, requiredFields]
|
|
470
472
|
);
|
|
471
473
|
const reset = useCallback(() => {
|
|
472
474
|
setValues(defaultValues);
|
|
@@ -481,7 +483,9 @@ function useForm(options) {
|
|
|
481
483
|
return Object.keys(validationErrors).length === 0;
|
|
482
484
|
}, [validate, values]);
|
|
483
485
|
const canSubmit = useMemo(() => {
|
|
484
|
-
const requiredFieldsHaveValues = requiredFields?.every(
|
|
486
|
+
const requiredFieldsHaveValues = requiredFields?.every(
|
|
487
|
+
(field) => values[field] !== void 0 && values[field] !== "" && values[field] !== false
|
|
488
|
+
) ?? true;
|
|
485
489
|
return isValid && requiredFieldsHaveValues;
|
|
486
490
|
}, [isValid, requiredFields]);
|
|
487
491
|
return {
|
|
@@ -1602,11 +1606,24 @@ function generateAsyncStorage() {
|
|
|
1602
1606
|
};
|
|
1603
1607
|
}
|
|
1604
1608
|
|
|
1609
|
+
// src/components/Label.tsx
|
|
1610
|
+
import { memo as memo11 } from "react";
|
|
1611
|
+
import { useTheme as useTheme10 } from "react-better-core";
|
|
1612
|
+
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1613
|
+
function Label({ text, required, isError }) {
|
|
1614
|
+
const theme2 = useTheme10();
|
|
1615
|
+
return /* @__PURE__ */ jsxs5(View_default, { isRow: true, alignItems: "center", gap: 2, children: [
|
|
1616
|
+
text && /* @__PURE__ */ jsx11(Text_default, { fontSize: 14, color: isError ? theme2.colors.error : theme2.colors.textSecondary, children: text }),
|
|
1617
|
+
required && /* @__PURE__ */ jsx11(Text_default, { color: theme2.colors.error, children: "*" })
|
|
1618
|
+
] });
|
|
1619
|
+
}
|
|
1620
|
+
var Label_default = memo11(Label);
|
|
1621
|
+
|
|
1605
1622
|
// src/components/ScreenHolder.tsx
|
|
1606
|
-
import { memo as
|
|
1623
|
+
import { memo as memo12, useCallback as useCallback5, useMemo as useMemo8 } from "react";
|
|
1607
1624
|
import { KeyboardAvoidingView, Platform as Platform4, RefreshControl, ScrollView } from "react-native";
|
|
1608
|
-
import { useBooleanState as useBooleanState3, useTheme as
|
|
1609
|
-
import { jsx as
|
|
1625
|
+
import { useBooleanState as useBooleanState3, useTheme as useTheme11 } from "react-better-core";
|
|
1626
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1610
1627
|
var ScreenHolderComponent = ({
|
|
1611
1628
|
noScroll,
|
|
1612
1629
|
noSideSpace,
|
|
@@ -1624,7 +1641,7 @@ var ScreenHolderComponent = ({
|
|
|
1624
1641
|
withNoHeader,
|
|
1625
1642
|
children
|
|
1626
1643
|
}) => {
|
|
1627
|
-
const theme2 =
|
|
1644
|
+
const theme2 = useTheme11();
|
|
1628
1645
|
const device = useDevice();
|
|
1629
1646
|
const keyboard = useKeyboard();
|
|
1630
1647
|
const [isRefreshing, setIsRefreshing] = useBooleanState3();
|
|
@@ -1642,7 +1659,7 @@ var ScreenHolderComponent = ({
|
|
|
1642
1659
|
onRefreshEnd?.();
|
|
1643
1660
|
}, refreshTimeout * 1e3);
|
|
1644
1661
|
}, [onRefresh, onRefreshEnd, refreshTimeout]);
|
|
1645
|
-
const content = /* @__PURE__ */
|
|
1662
|
+
const content = /* @__PURE__ */ jsx12(
|
|
1646
1663
|
View_default,
|
|
1647
1664
|
{
|
|
1648
1665
|
flex: 1,
|
|
@@ -1653,21 +1670,21 @@ var ScreenHolderComponent = ({
|
|
|
1653
1670
|
}
|
|
1654
1671
|
);
|
|
1655
1672
|
const withRefresh = onRefresh || onRefreshEnd;
|
|
1656
|
-
return /* @__PURE__ */
|
|
1673
|
+
return /* @__PURE__ */ jsx12(View_default, { flex: 1, backgroundColor: backgroundColor ?? theme2.colors.backgroundBase, children: /* @__PURE__ */ jsxs6(
|
|
1657
1674
|
KeyboardAvoidingView,
|
|
1658
1675
|
{
|
|
1659
1676
|
style: keyboardAvoidingViewStyle,
|
|
1660
1677
|
keyboardVerticalOffset: keyboardVerticalOffset ?? (withNoHeader ? Platform4.OS === "ios" ? 0 : theme2.styles.gap : keepFooterOnKeyboardOpened ? Platform4.OS === "ios" ? device.safeArea.afterCalculations.bottom : theme2.styles.gap : void 0),
|
|
1661
1678
|
behavior: Platform4.OS === "ios" ? "padding" : "height",
|
|
1662
1679
|
children: [
|
|
1663
|
-
/* @__PURE__ */
|
|
1680
|
+
/* @__PURE__ */ jsx12(View_default, { flex: 1, children: noScroll ? content : /* @__PURE__ */ jsx12(
|
|
1664
1681
|
ScrollView,
|
|
1665
1682
|
{
|
|
1666
|
-
refreshControl: withRefresh ? /* @__PURE__ */
|
|
1683
|
+
refreshControl: withRefresh ? /* @__PURE__ */ jsx12(RefreshControl, { refreshing: isRefreshing, onRefresh: onRefreshElement }) : void 0,
|
|
1667
1684
|
children: content
|
|
1668
1685
|
}
|
|
1669
1686
|
) }),
|
|
1670
|
-
keepFooterOnKeyboardOpened || (Platform4.OS === "ios" ? !keyboard.willOpen : !keyboard.isOpened) ? footer && /* @__PURE__ */
|
|
1687
|
+
keepFooterOnKeyboardOpened || (Platform4.OS === "ios" ? !keyboard.willOpen : !keyboard.isOpened) ? footer && /* @__PURE__ */ jsx12(View_default, { children: footer }) : !withNoHeader && /* @__PURE__ */ jsx12(
|
|
1671
1688
|
View_default,
|
|
1672
1689
|
{
|
|
1673
1690
|
width: "100%",
|
|
@@ -1685,10 +1702,10 @@ ScreenHolderComponent.footer = function Footer({
|
|
|
1685
1702
|
withNoHeader,
|
|
1686
1703
|
children
|
|
1687
1704
|
}) {
|
|
1688
|
-
const theme2 =
|
|
1705
|
+
const theme2 = useTheme11();
|
|
1689
1706
|
const device = useDevice();
|
|
1690
1707
|
const keyboard = useKeyboard();
|
|
1691
|
-
return /* @__PURE__ */
|
|
1708
|
+
return /* @__PURE__ */ jsx12(
|
|
1692
1709
|
View_default,
|
|
1693
1710
|
{
|
|
1694
1711
|
backgroundColor: backgroundColor ?? theme2.colors.backgroundBase,
|
|
@@ -1699,14 +1716,14 @@ ScreenHolderComponent.footer = function Footer({
|
|
|
1699
1716
|
}
|
|
1700
1717
|
);
|
|
1701
1718
|
};
|
|
1702
|
-
var ScreenHolder =
|
|
1719
|
+
var ScreenHolder = memo12(ScreenHolderComponent);
|
|
1703
1720
|
ScreenHolder.footer = ScreenHolderComponent.footer;
|
|
1704
1721
|
var ScreenHolder_default = ScreenHolder;
|
|
1705
1722
|
|
|
1706
1723
|
// src/components/InputField.tsx
|
|
1707
1724
|
import {
|
|
1708
1725
|
forwardRef,
|
|
1709
|
-
memo as
|
|
1726
|
+
memo as memo13,
|
|
1710
1727
|
useCallback as useCallback6,
|
|
1711
1728
|
useEffect as useEffect6,
|
|
1712
1729
|
useImperativeHandle,
|
|
@@ -1726,9 +1743,9 @@ import {
|
|
|
1726
1743
|
lightenColor,
|
|
1727
1744
|
useBetterCoreContext as useBetterCoreContext4,
|
|
1728
1745
|
useBooleanState as useBooleanState4,
|
|
1729
|
-
useTheme as
|
|
1746
|
+
useTheme as useTheme12
|
|
1730
1747
|
} from "react-better-core";
|
|
1731
|
-
import { Fragment as Fragment4, jsx as
|
|
1748
|
+
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1732
1749
|
var InputFieldComponent = forwardRef(
|
|
1733
1750
|
({
|
|
1734
1751
|
flex,
|
|
@@ -1780,7 +1797,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1780
1797
|
onPressEnter,
|
|
1781
1798
|
...props
|
|
1782
1799
|
}, ref) => {
|
|
1783
|
-
const theme2 =
|
|
1800
|
+
const theme2 = useTheme12();
|
|
1784
1801
|
const { colorTheme } = useBetterCoreContext4();
|
|
1785
1802
|
const textInputRef = useRef3(null);
|
|
1786
1803
|
const [internalValue, setInternalValue] = useState3(value?.toString() || defaultValue || "");
|
|
@@ -1898,12 +1915,9 @@ var InputFieldComponent = forwardRef(
|
|
|
1898
1915
|
}, []);
|
|
1899
1916
|
const withPressInputField = !!onPress || type === "date" || type === "time";
|
|
1900
1917
|
const prefixSuffixBackgroundColor = colorTheme === "light" ? darkenColor(theme2.colors.backgroundContent, 0.03) : lightenColor(theme2.colors.backgroundContent, 0.1);
|
|
1901
|
-
const labelComponent = label
|
|
1902
|
-
/* @__PURE__ */ jsx12(Text_default, { fontSize: 14, color: isError ? theme2.colors.error : theme2.colors.textSecondary, children: label }),
|
|
1903
|
-
required && /* @__PURE__ */ jsx12(Text_default, { color: theme2.colors.error, children: "*" })
|
|
1904
|
-
] });
|
|
1918
|
+
const labelComponent = label ? /* @__PURE__ */ jsx13(Label_default, { text: label, isError, required }) : void 0;
|
|
1905
1919
|
const borderColor = isFocused ? theme2.colors.primary : isError ? theme2.colors.error : theme2.colors.border;
|
|
1906
|
-
return /* @__PURE__ */
|
|
1920
|
+
return /* @__PURE__ */ jsxs7(
|
|
1907
1921
|
Animate_default.View,
|
|
1908
1922
|
{
|
|
1909
1923
|
flex,
|
|
@@ -1913,8 +1927,8 @@ var InputFieldComponent = forwardRef(
|
|
|
1913
1927
|
...props,
|
|
1914
1928
|
children: [
|
|
1915
1929
|
isIOSDateTime && !iOSDateTimeFullSize ? void 0 : labelComponent,
|
|
1916
|
-
/* @__PURE__ */
|
|
1917
|
-
prefix && /* @__PURE__ */
|
|
1930
|
+
/* @__PURE__ */ jsxs7(View_default, { isRow: true, position: "relative", alignItems: "center", height: readyHeight, children: [
|
|
1931
|
+
prefix && /* @__PURE__ */ jsxs7(
|
|
1918
1932
|
View_default,
|
|
1919
1933
|
{
|
|
1920
1934
|
isRow: true,
|
|
@@ -1932,8 +1946,8 @@ var InputFieldComponent = forwardRef(
|
|
|
1932
1946
|
zIndex: 1,
|
|
1933
1947
|
onPress: onPressPrefix,
|
|
1934
1948
|
children: [
|
|
1935
|
-
typeof prefix === "string" ? /* @__PURE__ */
|
|
1936
|
-
/* @__PURE__ */
|
|
1949
|
+
typeof prefix === "string" ? /* @__PURE__ */ jsx13(Text_default, { fontWeight: 700, lineHeight, children: prefix }) : prefix,
|
|
1950
|
+
/* @__PURE__ */ jsx13(
|
|
1937
1951
|
Animate_default.View,
|
|
1938
1952
|
{
|
|
1939
1953
|
position: "absolute",
|
|
@@ -1948,9 +1962,9 @@ var InputFieldComponent = forwardRef(
|
|
|
1948
1962
|
]
|
|
1949
1963
|
}
|
|
1950
1964
|
),
|
|
1951
|
-
isIOSDateTime ? /* @__PURE__ */
|
|
1965
|
+
isIOSDateTime ? /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
1952
1966
|
!iOSDateTimeFullSize ? labelComponent : void 0,
|
|
1953
|
-
/* @__PURE__ */
|
|
1967
|
+
/* @__PURE__ */ jsx13(
|
|
1954
1968
|
RNDateTimePicker,
|
|
1955
1969
|
{
|
|
1956
1970
|
value: internalDateValue ?? /* @__PURE__ */ new Date(),
|
|
@@ -1962,7 +1976,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1962
1976
|
onValueChange: onValueChangeRNDateTimePicker
|
|
1963
1977
|
}
|
|
1964
1978
|
)
|
|
1965
|
-
] }) : /* @__PURE__ */
|
|
1979
|
+
] }) : /* @__PURE__ */ jsx13(
|
|
1966
1980
|
View_default,
|
|
1967
1981
|
{
|
|
1968
1982
|
flex: 1,
|
|
@@ -1973,7 +1987,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1973
1987
|
borderBottomRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1974
1988
|
pressStrength: 1,
|
|
1975
1989
|
onPress: Platform5.OS === "android" ? editable === false || withPressInputField ? onPressInputField : void 0 : void 0,
|
|
1976
|
-
children: /* @__PURE__ */
|
|
1990
|
+
children: /* @__PURE__ */ jsxs7(
|
|
1977
1991
|
Animate_default.View,
|
|
1978
1992
|
{
|
|
1979
1993
|
position: "relative",
|
|
@@ -1991,7 +2005,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1991
2005
|
animateBorderColor: borderColor,
|
|
1992
2006
|
overflow: "hidden",
|
|
1993
2007
|
children: [
|
|
1994
|
-
leftIcon && /* @__PURE__ */
|
|
2008
|
+
leftIcon && /* @__PURE__ */ jsx13(
|
|
1995
2009
|
Icon_default,
|
|
1996
2010
|
{
|
|
1997
2011
|
position: "absolute",
|
|
@@ -2004,7 +2018,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2004
2018
|
onPress: onPressLeftIcon
|
|
2005
2019
|
}
|
|
2006
2020
|
),
|
|
2007
|
-
/* @__PURE__ */
|
|
2021
|
+
/* @__PURE__ */ jsx13(
|
|
2008
2022
|
TextInput2,
|
|
2009
2023
|
{
|
|
2010
2024
|
style: textInputStyle,
|
|
@@ -2037,7 +2051,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2037
2051
|
ref: textInputRef
|
|
2038
2052
|
}
|
|
2039
2053
|
),
|
|
2040
|
-
rightIcon && /* @__PURE__ */
|
|
2054
|
+
rightIcon && /* @__PURE__ */ jsx13(
|
|
2041
2055
|
Icon_default,
|
|
2042
2056
|
{
|
|
2043
2057
|
position: "absolute",
|
|
@@ -2055,7 +2069,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2055
2069
|
)
|
|
2056
2070
|
}
|
|
2057
2071
|
),
|
|
2058
|
-
suffix && /* @__PURE__ */
|
|
2072
|
+
suffix && /* @__PURE__ */ jsxs7(
|
|
2059
2073
|
View_default,
|
|
2060
2074
|
{
|
|
2061
2075
|
isRow: true,
|
|
@@ -2073,8 +2087,8 @@ var InputFieldComponent = forwardRef(
|
|
|
2073
2087
|
zIndex: 1,
|
|
2074
2088
|
onPress: onPressSuffix,
|
|
2075
2089
|
children: [
|
|
2076
|
-
typeof suffix === "string" ? /* @__PURE__ */
|
|
2077
|
-
/* @__PURE__ */
|
|
2090
|
+
typeof suffix === "string" ? /* @__PURE__ */ jsx13(Text_default, { fontWeight: 700, lineHeight, children: suffix }) : suffix,
|
|
2091
|
+
/* @__PURE__ */ jsx13(
|
|
2078
2092
|
Animate_default.View,
|
|
2079
2093
|
{
|
|
2080
2094
|
position: "absolute",
|
|
@@ -2090,7 +2104,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2090
2104
|
}
|
|
2091
2105
|
)
|
|
2092
2106
|
] }),
|
|
2093
|
-
infoMessage && /* @__PURE__ */
|
|
2107
|
+
infoMessage && /* @__PURE__ */ jsx13(
|
|
2094
2108
|
Animate_default.Text,
|
|
2095
2109
|
{
|
|
2096
2110
|
fontSize: 14,
|
|
@@ -2102,7 +2116,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2102
2116
|
children: infoMessage
|
|
2103
2117
|
}
|
|
2104
2118
|
),
|
|
2105
|
-
errorMessage && /* @__PURE__ */
|
|
2119
|
+
errorMessage && /* @__PURE__ */ jsx13(
|
|
2106
2120
|
Animate_default.Text,
|
|
2107
2121
|
{
|
|
2108
2122
|
fontSize: 14,
|
|
@@ -2120,7 +2134,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2120
2134
|
}
|
|
2121
2135
|
);
|
|
2122
2136
|
InputFieldComponent.email = forwardRef(function Email(props, ref) {
|
|
2123
|
-
return /* @__PURE__ */
|
|
2137
|
+
return /* @__PURE__ */ jsx13(
|
|
2124
2138
|
InputFieldComponent,
|
|
2125
2139
|
{
|
|
2126
2140
|
placeholder: "your@email.here",
|
|
@@ -2143,7 +2157,7 @@ InputFieldComponent.password = forwardRef(function Password(props, ref) {
|
|
|
2143
2157
|
useImperativeHandle(ref, () => {
|
|
2144
2158
|
return inputFieldRef.current;
|
|
2145
2159
|
}, []);
|
|
2146
|
-
return /* @__PURE__ */
|
|
2160
|
+
return /* @__PURE__ */ jsx13(
|
|
2147
2161
|
InputFieldComponent,
|
|
2148
2162
|
{
|
|
2149
2163
|
secureTextEntry: !showPassword,
|
|
@@ -2159,11 +2173,11 @@ InputFieldComponent.password = forwardRef(function Password(props, ref) {
|
|
|
2159
2173
|
);
|
|
2160
2174
|
});
|
|
2161
2175
|
InputFieldComponent.search = forwardRef(function Search(props, ref) {
|
|
2162
|
-
return /* @__PURE__ */
|
|
2176
|
+
return /* @__PURE__ */ jsx13(InputFieldComponent, { placeholder: "Search...", leftIcon: "magnifyingGlass", ...props, ref });
|
|
2163
2177
|
});
|
|
2164
2178
|
InputFieldComponent.code = forwardRef(function Password2({ isSmall, ...props }, ref) {
|
|
2165
|
-
const theme2 =
|
|
2166
|
-
return /* @__PURE__ */
|
|
2179
|
+
const theme2 = useTheme12();
|
|
2180
|
+
return /* @__PURE__ */ jsx13(
|
|
2167
2181
|
InputFieldComponent,
|
|
2168
2182
|
{
|
|
2169
2183
|
flex: 1,
|
|
@@ -2178,7 +2192,7 @@ InputFieldComponent.code = forwardRef(function Password2({ isSmall, ...props },
|
|
|
2178
2192
|
}
|
|
2179
2193
|
);
|
|
2180
2194
|
});
|
|
2181
|
-
var InputField =
|
|
2195
|
+
var InputField = memo13(InputFieldComponent);
|
|
2182
2196
|
InputField.email = InputFieldComponent.email;
|
|
2183
2197
|
InputField.password = InputFieldComponent.password;
|
|
2184
2198
|
InputField.search = InputFieldComponent.search;
|
|
@@ -2186,12 +2200,12 @@ InputField.code = InputFieldComponent.code;
|
|
|
2186
2200
|
var InputField_default = InputField;
|
|
2187
2201
|
|
|
2188
2202
|
// src/components/Switch.tsx
|
|
2189
|
-
import { memo as
|
|
2203
|
+
import { memo as memo14, useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo10 } from "react";
|
|
2190
2204
|
import { Switch as NativeSwitch, Platform as Platform6 } from "react-native";
|
|
2191
|
-
import { useBooleanState as useBooleanState5, useTheme as
|
|
2192
|
-
import { jsx as
|
|
2205
|
+
import { useBooleanState as useBooleanState5, useTheme as useTheme13 } from "react-better-core";
|
|
2206
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2193
2207
|
function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
2194
|
-
const theme2 =
|
|
2208
|
+
const theme2 = useTheme13();
|
|
2195
2209
|
const [enabled, setEnabled] = useBooleanState5(isEnabled ?? defaultIsEnabled);
|
|
2196
2210
|
const onPressElement = useCallback7(() => {
|
|
2197
2211
|
onChange?.(!enabled);
|
|
@@ -2211,7 +2225,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
2211
2225
|
const ballSize = 26;
|
|
2212
2226
|
const ballGap = 3;
|
|
2213
2227
|
const holderWidth = ballSize * 2.1;
|
|
2214
|
-
return Platform6.OS === "ios" ? /* @__PURE__ */
|
|
2228
|
+
return Platform6.OS === "ios" ? /* @__PURE__ */ jsx14(
|
|
2215
2229
|
NativeSwitch,
|
|
2216
2230
|
{
|
|
2217
2231
|
trackColor,
|
|
@@ -2220,7 +2234,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
2220
2234
|
value: enabled,
|
|
2221
2235
|
disabled
|
|
2222
2236
|
}
|
|
2223
|
-
) : /* @__PURE__ */
|
|
2237
|
+
) : /* @__PURE__ */ jsx14(
|
|
2224
2238
|
View_default,
|
|
2225
2239
|
{
|
|
2226
2240
|
width: holderWidth,
|
|
@@ -2228,7 +2242,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
2228
2242
|
pressStrength: pressStrength().p05,
|
|
2229
2243
|
disabled,
|
|
2230
2244
|
onPress: !disabled ? onPressElement : void 0,
|
|
2231
|
-
children: /* @__PURE__ */
|
|
2245
|
+
children: /* @__PURE__ */ jsx14(
|
|
2232
2246
|
Animate_default.View,
|
|
2233
2247
|
{
|
|
2234
2248
|
width: "100%",
|
|
@@ -2238,7 +2252,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
2238
2252
|
animateBackgroundColor: enabled ? theme2.colors.primary : theme2.colors.border,
|
|
2239
2253
|
initialOpacity: 1,
|
|
2240
2254
|
animateOpacity: disabled ? 0.6 : 1,
|
|
2241
|
-
children: /* @__PURE__ */
|
|
2255
|
+
children: /* @__PURE__ */ jsx14(
|
|
2242
2256
|
Animate_default.View,
|
|
2243
2257
|
{
|
|
2244
2258
|
width: ballSize,
|
|
@@ -2258,15 +2272,25 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
2258
2272
|
}
|
|
2259
2273
|
);
|
|
2260
2274
|
}
|
|
2261
|
-
var Switch_default =
|
|
2275
|
+
var Switch_default = memo14(Switch);
|
|
2262
2276
|
|
|
2263
2277
|
// src/components/CheckBox.tsx
|
|
2264
|
-
import { memo as
|
|
2278
|
+
import { memo as memo15, useCallback as useCallback8, useEffect as useEffect8 } from "react";
|
|
2265
2279
|
import { Platform as Platform7 } from "react-native";
|
|
2266
|
-
import { useBooleanState as useBooleanState6, useTheme as
|
|
2267
|
-
import { jsx as
|
|
2268
|
-
function CheckBox({
|
|
2269
|
-
|
|
2280
|
+
import { useBooleanState as useBooleanState6, useTheme as useTheme14 } from "react-better-core";
|
|
2281
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2282
|
+
function CheckBox({
|
|
2283
|
+
isChecked,
|
|
2284
|
+
defaultIsChecked,
|
|
2285
|
+
size = 36,
|
|
2286
|
+
text,
|
|
2287
|
+
required,
|
|
2288
|
+
disabled,
|
|
2289
|
+
infoMessage,
|
|
2290
|
+
errorMessage,
|
|
2291
|
+
onChange
|
|
2292
|
+
}) {
|
|
2293
|
+
const theme2 = useTheme14();
|
|
2270
2294
|
const [checked, setChecked] = useBooleanState6(isChecked ?? defaultIsChecked);
|
|
2271
2295
|
const onPressElement = useCallback8(() => {
|
|
2272
2296
|
onChange?.(!checked);
|
|
@@ -2276,7 +2300,7 @@ function CheckBox({ isChecked, defaultIsChecked, size = 36, disabled, onChange }
|
|
|
2276
2300
|
if (isChecked === void 0) return;
|
|
2277
2301
|
setChecked.setState(isChecked);
|
|
2278
2302
|
}, [isChecked]);
|
|
2279
|
-
|
|
2303
|
+
const checkBox = /* @__PURE__ */ jsx15(
|
|
2280
2304
|
View_default,
|
|
2281
2305
|
{
|
|
2282
2306
|
width: size,
|
|
@@ -2284,7 +2308,7 @@ function CheckBox({ isChecked, defaultIsChecked, size = 36, disabled, onChange }
|
|
|
2284
2308
|
pressStrength: pressStrength().p05,
|
|
2285
2309
|
disabled,
|
|
2286
2310
|
onPress: !disabled ? onPressElement : void 0,
|
|
2287
|
-
children: /* @__PURE__ */
|
|
2311
|
+
children: /* @__PURE__ */ jsx15(
|
|
2288
2312
|
Animate_default.View,
|
|
2289
2313
|
{
|
|
2290
2314
|
width: "100%",
|
|
@@ -2297,7 +2321,7 @@ function CheckBox({ isChecked, defaultIsChecked, size = 36, disabled, onChange }
|
|
|
2297
2321
|
animateBorderColor: checked ? theme2.colors.primary : theme2.colors.border,
|
|
2298
2322
|
initialOpacity: 1,
|
|
2299
2323
|
animateOpacity: disabled ? 0.6 : 1,
|
|
2300
|
-
children: /* @__PURE__ */
|
|
2324
|
+
children: /* @__PURE__ */ jsx15(
|
|
2301
2325
|
Animate_default.View,
|
|
2302
2326
|
{
|
|
2303
2327
|
width: "100%",
|
|
@@ -2309,7 +2333,7 @@ function CheckBox({ isChecked, defaultIsChecked, size = 36, disabled, onChange }
|
|
|
2309
2333
|
transitionStiffness: 230,
|
|
2310
2334
|
initialScale: 0,
|
|
2311
2335
|
animateScale: checked ? 1 : 0,
|
|
2312
|
-
children: /* @__PURE__ */
|
|
2336
|
+
children: /* @__PURE__ */ jsx15(
|
|
2313
2337
|
Icon_default,
|
|
2314
2338
|
{
|
|
2315
2339
|
name: "check",
|
|
@@ -2324,17 +2348,60 @@ function CheckBox({ isChecked, defaultIsChecked, size = 36, disabled, onChange }
|
|
|
2324
2348
|
)
|
|
2325
2349
|
}
|
|
2326
2350
|
);
|
|
2351
|
+
return text ? /* @__PURE__ */ jsxs8(View_default, { gap: theme2.styles.gap / 3, children: [
|
|
2352
|
+
/* @__PURE__ */ jsxs8(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.gap, children: [
|
|
2353
|
+
checkBox,
|
|
2354
|
+
/* @__PURE__ */ jsx15(
|
|
2355
|
+
View_default,
|
|
2356
|
+
{
|
|
2357
|
+
width: "100%",
|
|
2358
|
+
flexShrink: 1,
|
|
2359
|
+
pressType: "opacity",
|
|
2360
|
+
pressStrength: pressStrength().p3,
|
|
2361
|
+
onPress: !disabled ? onPressElement : void 0,
|
|
2362
|
+
children: /* @__PURE__ */ jsx15(Animate_default.View, { initialOpacity: 1, animateOpacity: disabled ? 0.6 : 1, children: /* @__PURE__ */ jsxs8(View_default, { isRow: true, alignItems: "flex-start", gap: 2, children: [
|
|
2363
|
+
/* @__PURE__ */ jsx15(View_default, { flexShrink: 1, children: typeof text === "string" ? /* @__PURE__ */ jsx15(Text_default, { children: text }) : text }),
|
|
2364
|
+
required && /* @__PURE__ */ jsx15(Label_default, { required: true })
|
|
2365
|
+
] }) })
|
|
2366
|
+
}
|
|
2367
|
+
)
|
|
2368
|
+
] }),
|
|
2369
|
+
infoMessage && /* @__PURE__ */ jsx15(
|
|
2370
|
+
Animate_default.Text,
|
|
2371
|
+
{
|
|
2372
|
+
fontSize: 14,
|
|
2373
|
+
color: theme2.colors.textSecondary,
|
|
2374
|
+
initialHeight: 0,
|
|
2375
|
+
initialOpacity: 0,
|
|
2376
|
+
animateHeight: 17,
|
|
2377
|
+
animateOpacity: 1,
|
|
2378
|
+
children: infoMessage
|
|
2379
|
+
}
|
|
2380
|
+
),
|
|
2381
|
+
errorMessage && /* @__PURE__ */ jsx15(
|
|
2382
|
+
Animate_default.Text,
|
|
2383
|
+
{
|
|
2384
|
+
fontSize: 14,
|
|
2385
|
+
color: theme2.colors.error,
|
|
2386
|
+
initialHeight: 0,
|
|
2387
|
+
initialOpacity: 0,
|
|
2388
|
+
animateHeight: 17,
|
|
2389
|
+
animateOpacity: 1,
|
|
2390
|
+
children: errorMessage
|
|
2391
|
+
}
|
|
2392
|
+
)
|
|
2393
|
+
] }) : checkBox;
|
|
2327
2394
|
}
|
|
2328
|
-
var CheckBox_default =
|
|
2395
|
+
var CheckBox_default = memo15(CheckBox);
|
|
2329
2396
|
|
|
2330
2397
|
// src/components/StatusBar.tsx
|
|
2331
|
-
import { memo as
|
|
2332
|
-
import { useTheme as
|
|
2398
|
+
import { memo as memo16 } from "react";
|
|
2399
|
+
import { useTheme as useTheme15 } from "react-better-core";
|
|
2333
2400
|
import { StatusBar as NativeStatusBar, Platform as Platform8 } from "react-native";
|
|
2334
|
-
import { jsx as
|
|
2401
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2335
2402
|
function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }) {
|
|
2336
|
-
const theme2 =
|
|
2337
|
-
return /* @__PURE__ */
|
|
2403
|
+
const theme2 = useTheme15();
|
|
2404
|
+
return /* @__PURE__ */ jsx16(
|
|
2338
2405
|
NativeStatusBar,
|
|
2339
2406
|
{
|
|
2340
2407
|
backgroundColor: darkStatusBar ? theme2.colors.backgroundSecondary : void 0,
|
|
@@ -2343,12 +2410,12 @@ function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarSty
|
|
|
2343
2410
|
}
|
|
2344
2411
|
);
|
|
2345
2412
|
}
|
|
2346
|
-
var StatusBar_default =
|
|
2413
|
+
var StatusBar_default = memo16(StatusBar);
|
|
2347
2414
|
|
|
2348
2415
|
// src/components/ListItem.tsx
|
|
2349
|
-
import { memo as
|
|
2350
|
-
import { useTheme as
|
|
2351
|
-
import { Fragment as Fragment5, jsx as
|
|
2416
|
+
import { memo as memo17 } from "react";
|
|
2417
|
+
import { useTheme as useTheme16 } from "react-better-core";
|
|
2418
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2352
2419
|
function ListItem({
|
|
2353
2420
|
icon,
|
|
2354
2421
|
iconIOS,
|
|
@@ -2366,10 +2433,10 @@ function ListItem({
|
|
|
2366
2433
|
checkBoxIsChecked,
|
|
2367
2434
|
checkBoxOnChange
|
|
2368
2435
|
}) {
|
|
2369
|
-
const theme2 =
|
|
2436
|
+
const theme2 = useTheme16();
|
|
2370
2437
|
const device = useDevice();
|
|
2371
2438
|
const sideSpace = theme2.styles.space;
|
|
2372
|
-
return /* @__PURE__ */
|
|
2439
|
+
return /* @__PURE__ */ jsx17(
|
|
2373
2440
|
View_default,
|
|
2374
2441
|
{
|
|
2375
2442
|
width: insideScreenHolder ? device.windowDimensions.width : "100%",
|
|
@@ -2379,15 +2446,15 @@ function ListItem({
|
|
|
2379
2446
|
paddingHorizontal: sideSpace,
|
|
2380
2447
|
pressStrength: pressStrength().p05,
|
|
2381
2448
|
onPress,
|
|
2382
|
-
children: /* @__PURE__ */
|
|
2383
|
-
icon && /* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
title && /* @__PURE__ */
|
|
2386
|
-
description && /* @__PURE__ */
|
|
2449
|
+
children: /* @__PURE__ */ jsxs9(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.space, children: [
|
|
2450
|
+
icon && /* @__PURE__ */ jsx17(Icon_default, { name: icon, nameIOS: iconIOS, size: 22, color: theme2.colors.primary }),
|
|
2451
|
+
/* @__PURE__ */ jsx17(View_default, { flex: 1, flexDirection: "row", alignItems: "center", gap: theme2.styles.gap, children: /* @__PURE__ */ jsxs9(View_default, { flex: 1, children: [
|
|
2452
|
+
title && /* @__PURE__ */ jsx17(Text_default, { fontSize: 20, fontWeight: 700, children: title }),
|
|
2453
|
+
description && /* @__PURE__ */ jsx17(Text_default.body, { selectable: descriptionSelectable, children: description })
|
|
2387
2454
|
] }) }),
|
|
2388
|
-
rightElement ? /* @__PURE__ */
|
|
2389
|
-
rightValue !== void 0 && /* @__PURE__ */
|
|
2390
|
-
rightElement === "arrow" && /* @__PURE__ */
|
|
2455
|
+
rightElement ? /* @__PURE__ */ jsx17(Fragment5, { children: rightValue !== void 0 || rightElement === "arrow" ? /* @__PURE__ */ jsxs9(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
2456
|
+
rightValue !== void 0 && /* @__PURE__ */ jsx17(Text_default, { fontSize: 14, fontWeight: 700, selectable: rightValueSelectable, children: rightValue }),
|
|
2457
|
+
rightElement === "arrow" && /* @__PURE__ */ jsx17(
|
|
2391
2458
|
Icon_default,
|
|
2392
2459
|
{
|
|
2393
2460
|
name: "chevronRight",
|
|
@@ -2395,12 +2462,12 @@ function ListItem({
|
|
|
2395
2462
|
color: rightValue !== void 0 ? theme2.colors.textPrimary : theme2.colors.textSecondary
|
|
2396
2463
|
}
|
|
2397
2464
|
)
|
|
2398
|
-
] }) : rightElement === "switch" ? /* @__PURE__ */
|
|
2465
|
+
] }) : rightElement === "switch" ? /* @__PURE__ */ jsx17(Switch_default, { isEnabled: switchIsEnabled, onChange: switchOnChange }) : rightElement === "checkBox" ? /* @__PURE__ */ jsx17(CheckBox_default, { isChecked: checkBoxIsChecked, onChange: checkBoxOnChange }) : void 0 }) : void 0
|
|
2399
2466
|
] })
|
|
2400
2467
|
}
|
|
2401
2468
|
);
|
|
2402
2469
|
}
|
|
2403
|
-
var ListItem_default =
|
|
2470
|
+
var ListItem_default = memo17(ListItem);
|
|
2404
2471
|
export {
|
|
2405
2472
|
Animate_default as Animate,
|
|
2406
2473
|
BetterComponentsProvider_default as BetterComponentsProvider,
|
|
@@ -2409,6 +2476,7 @@ export {
|
|
|
2409
2476
|
Icon_default as Icon,
|
|
2410
2477
|
Image_default as Image,
|
|
2411
2478
|
InputField_default as InputField,
|
|
2479
|
+
Label_default as Label,
|
|
2412
2480
|
ListItem_default as ListItem,
|
|
2413
2481
|
Loader_default as Loader,
|
|
2414
2482
|
ScreenHolder_default as ScreenHolder,
|
|
@@ -2447,6 +2515,6 @@ export {
|
|
|
2447
2515
|
useKeyboard,
|
|
2448
2516
|
useLoader2 as useLoader,
|
|
2449
2517
|
useLoaderControls,
|
|
2450
|
-
|
|
2518
|
+
useTheme17 as useTheme
|
|
2451
2519
|
};
|
|
2452
2520
|
//# sourceMappingURL=index.mjs.map
|