react-native-better-html 1.0.24 → 1.0.26
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 +32 -6
- package/dist/index.d.ts +32 -6
- package/dist/index.js +257 -129
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +208 -82
- 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,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
eventStopPropagation,
|
|
15
15
|
eventPreventStop,
|
|
16
16
|
getPluralWord,
|
|
17
|
-
useBooleanState as
|
|
17
|
+
useBooleanState as useBooleanState7,
|
|
18
18
|
useDebounceState,
|
|
19
19
|
loaderControls,
|
|
20
20
|
colorThemeControls
|
|
@@ -452,6 +452,22 @@ function useForm(options) {
|
|
|
452
452
|
},
|
|
453
453
|
[values, setFieldValue]
|
|
454
454
|
);
|
|
455
|
+
const getCheckBoxProps = useCallback(
|
|
456
|
+
(field, insideListItem) => {
|
|
457
|
+
return insideListItem ? {
|
|
458
|
+
checkBoxIsChecked: values[field],
|
|
459
|
+
checkBoxOnChange: (value) => {
|
|
460
|
+
setFieldValue(field, value);
|
|
461
|
+
}
|
|
462
|
+
} : {
|
|
463
|
+
isChecked: values[field],
|
|
464
|
+
onChange: (value) => {
|
|
465
|
+
setFieldValue(field, value);
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
},
|
|
469
|
+
[values, setFieldValue]
|
|
470
|
+
);
|
|
455
471
|
const reset = useCallback(() => {
|
|
456
472
|
setValues(defaultValues);
|
|
457
473
|
setErrors({});
|
|
@@ -476,6 +492,7 @@ function useForm(options) {
|
|
|
476
492
|
setFieldsValue,
|
|
477
493
|
getInputFieldProps,
|
|
478
494
|
getSwitchProps,
|
|
495
|
+
getCheckBoxProps,
|
|
479
496
|
focusField,
|
|
480
497
|
inputFieldRefs: inputFieldRefs.current,
|
|
481
498
|
validate: validateForm,
|
|
@@ -1585,11 +1602,24 @@ function generateAsyncStorage() {
|
|
|
1585
1602
|
};
|
|
1586
1603
|
}
|
|
1587
1604
|
|
|
1605
|
+
// src/components/Label.tsx
|
|
1606
|
+
import { memo as memo11 } from "react";
|
|
1607
|
+
import { useTheme as useTheme10 } from "react-better-core";
|
|
1608
|
+
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1609
|
+
function Label({ text, required, isError }) {
|
|
1610
|
+
const theme2 = useTheme10();
|
|
1611
|
+
return /* @__PURE__ */ jsxs5(View_default, { isRow: true, alignItems: "center", gap: 2, children: [
|
|
1612
|
+
text && /* @__PURE__ */ jsx11(Text_default, { fontSize: 14, color: isError ? theme2.colors.error : theme2.colors.textSecondary, children: text }),
|
|
1613
|
+
required && /* @__PURE__ */ jsx11(Text_default, { color: theme2.colors.error, children: "*" })
|
|
1614
|
+
] });
|
|
1615
|
+
}
|
|
1616
|
+
var Label_default = memo11(Label);
|
|
1617
|
+
|
|
1588
1618
|
// src/components/ScreenHolder.tsx
|
|
1589
|
-
import { memo as
|
|
1619
|
+
import { memo as memo12, useCallback as useCallback5, useMemo as useMemo8 } from "react";
|
|
1590
1620
|
import { KeyboardAvoidingView, Platform as Platform4, RefreshControl, ScrollView } from "react-native";
|
|
1591
|
-
import { useBooleanState as useBooleanState3, useTheme as
|
|
1592
|
-
import { jsx as
|
|
1621
|
+
import { useBooleanState as useBooleanState3, useTheme as useTheme11 } from "react-better-core";
|
|
1622
|
+
import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1593
1623
|
var ScreenHolderComponent = ({
|
|
1594
1624
|
noScroll,
|
|
1595
1625
|
noSideSpace,
|
|
@@ -1607,7 +1637,7 @@ var ScreenHolderComponent = ({
|
|
|
1607
1637
|
withNoHeader,
|
|
1608
1638
|
children
|
|
1609
1639
|
}) => {
|
|
1610
|
-
const theme2 =
|
|
1640
|
+
const theme2 = useTheme11();
|
|
1611
1641
|
const device = useDevice();
|
|
1612
1642
|
const keyboard = useKeyboard();
|
|
1613
1643
|
const [isRefreshing, setIsRefreshing] = useBooleanState3();
|
|
@@ -1625,7 +1655,7 @@ var ScreenHolderComponent = ({
|
|
|
1625
1655
|
onRefreshEnd?.();
|
|
1626
1656
|
}, refreshTimeout * 1e3);
|
|
1627
1657
|
}, [onRefresh, onRefreshEnd, refreshTimeout]);
|
|
1628
|
-
const content = /* @__PURE__ */
|
|
1658
|
+
const content = /* @__PURE__ */ jsx12(
|
|
1629
1659
|
View_default,
|
|
1630
1660
|
{
|
|
1631
1661
|
flex: 1,
|
|
@@ -1636,21 +1666,21 @@ var ScreenHolderComponent = ({
|
|
|
1636
1666
|
}
|
|
1637
1667
|
);
|
|
1638
1668
|
const withRefresh = onRefresh || onRefreshEnd;
|
|
1639
|
-
return /* @__PURE__ */
|
|
1669
|
+
return /* @__PURE__ */ jsx12(View_default, { flex: 1, backgroundColor: backgroundColor ?? theme2.colors.backgroundBase, children: /* @__PURE__ */ jsxs6(
|
|
1640
1670
|
KeyboardAvoidingView,
|
|
1641
1671
|
{
|
|
1642
1672
|
style: keyboardAvoidingViewStyle,
|
|
1643
1673
|
keyboardVerticalOffset: keyboardVerticalOffset ?? (withNoHeader ? Platform4.OS === "ios" ? 0 : theme2.styles.gap : keepFooterOnKeyboardOpened ? Platform4.OS === "ios" ? device.safeArea.afterCalculations.bottom : theme2.styles.gap : void 0),
|
|
1644
1674
|
behavior: Platform4.OS === "ios" ? "padding" : "height",
|
|
1645
1675
|
children: [
|
|
1646
|
-
/* @__PURE__ */
|
|
1676
|
+
/* @__PURE__ */ jsx12(View_default, { flex: 1, children: noScroll ? content : /* @__PURE__ */ jsx12(
|
|
1647
1677
|
ScrollView,
|
|
1648
1678
|
{
|
|
1649
|
-
refreshControl: withRefresh ? /* @__PURE__ */
|
|
1679
|
+
refreshControl: withRefresh ? /* @__PURE__ */ jsx12(RefreshControl, { refreshing: isRefreshing, onRefresh: onRefreshElement }) : void 0,
|
|
1650
1680
|
children: content
|
|
1651
1681
|
}
|
|
1652
1682
|
) }),
|
|
1653
|
-
keepFooterOnKeyboardOpened || (Platform4.OS === "ios" ? !keyboard.willOpen : !keyboard.isOpened) ? footer && /* @__PURE__ */
|
|
1683
|
+
keepFooterOnKeyboardOpened || (Platform4.OS === "ios" ? !keyboard.willOpen : !keyboard.isOpened) ? footer && /* @__PURE__ */ jsx12(View_default, { children: footer }) : !withNoHeader && /* @__PURE__ */ jsx12(
|
|
1654
1684
|
View_default,
|
|
1655
1685
|
{
|
|
1656
1686
|
width: "100%",
|
|
@@ -1668,10 +1698,10 @@ ScreenHolderComponent.footer = function Footer({
|
|
|
1668
1698
|
withNoHeader,
|
|
1669
1699
|
children
|
|
1670
1700
|
}) {
|
|
1671
|
-
const theme2 =
|
|
1701
|
+
const theme2 = useTheme11();
|
|
1672
1702
|
const device = useDevice();
|
|
1673
1703
|
const keyboard = useKeyboard();
|
|
1674
|
-
return /* @__PURE__ */
|
|
1704
|
+
return /* @__PURE__ */ jsx12(
|
|
1675
1705
|
View_default,
|
|
1676
1706
|
{
|
|
1677
1707
|
backgroundColor: backgroundColor ?? theme2.colors.backgroundBase,
|
|
@@ -1682,14 +1712,14 @@ ScreenHolderComponent.footer = function Footer({
|
|
|
1682
1712
|
}
|
|
1683
1713
|
);
|
|
1684
1714
|
};
|
|
1685
|
-
var ScreenHolder =
|
|
1715
|
+
var ScreenHolder = memo12(ScreenHolderComponent);
|
|
1686
1716
|
ScreenHolder.footer = ScreenHolderComponent.footer;
|
|
1687
1717
|
var ScreenHolder_default = ScreenHolder;
|
|
1688
1718
|
|
|
1689
1719
|
// src/components/InputField.tsx
|
|
1690
1720
|
import {
|
|
1691
1721
|
forwardRef,
|
|
1692
|
-
memo as
|
|
1722
|
+
memo as memo13,
|
|
1693
1723
|
useCallback as useCallback6,
|
|
1694
1724
|
useEffect as useEffect6,
|
|
1695
1725
|
useImperativeHandle,
|
|
@@ -1709,9 +1739,9 @@ import {
|
|
|
1709
1739
|
lightenColor,
|
|
1710
1740
|
useBetterCoreContext as useBetterCoreContext4,
|
|
1711
1741
|
useBooleanState as useBooleanState4,
|
|
1712
|
-
useTheme as
|
|
1742
|
+
useTheme as useTheme12
|
|
1713
1743
|
} from "react-better-core";
|
|
1714
|
-
import { Fragment as Fragment4, jsx as
|
|
1744
|
+
import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1715
1745
|
var InputFieldComponent = forwardRef(
|
|
1716
1746
|
({
|
|
1717
1747
|
flex,
|
|
@@ -1763,7 +1793,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1763
1793
|
onPressEnter,
|
|
1764
1794
|
...props
|
|
1765
1795
|
}, ref) => {
|
|
1766
|
-
const theme2 =
|
|
1796
|
+
const theme2 = useTheme12();
|
|
1767
1797
|
const { colorTheme } = useBetterCoreContext4();
|
|
1768
1798
|
const textInputRef = useRef3(null);
|
|
1769
1799
|
const [internalValue, setInternalValue] = useState3(value?.toString() || defaultValue || "");
|
|
@@ -1881,12 +1911,9 @@ var InputFieldComponent = forwardRef(
|
|
|
1881
1911
|
}, []);
|
|
1882
1912
|
const withPressInputField = !!onPress || type === "date" || type === "time";
|
|
1883
1913
|
const prefixSuffixBackgroundColor = colorTheme === "light" ? darkenColor(theme2.colors.backgroundContent, 0.03) : lightenColor(theme2.colors.backgroundContent, 0.1);
|
|
1884
|
-
const labelComponent = label
|
|
1885
|
-
/* @__PURE__ */ jsx12(Text_default, { fontSize: 14, color: isError ? theme2.colors.error : theme2.colors.textSecondary, children: label }),
|
|
1886
|
-
required && /* @__PURE__ */ jsx12(Text_default, { color: theme2.colors.error, children: "*" })
|
|
1887
|
-
] });
|
|
1914
|
+
const labelComponent = label ? /* @__PURE__ */ jsx13(Label_default, { text: label, isError, required }) : void 0;
|
|
1888
1915
|
const borderColor = isFocused ? theme2.colors.primary : isError ? theme2.colors.error : theme2.colors.border;
|
|
1889
|
-
return /* @__PURE__ */
|
|
1916
|
+
return /* @__PURE__ */ jsxs7(
|
|
1890
1917
|
Animate_default.View,
|
|
1891
1918
|
{
|
|
1892
1919
|
flex,
|
|
@@ -1896,8 +1923,8 @@ var InputFieldComponent = forwardRef(
|
|
|
1896
1923
|
...props,
|
|
1897
1924
|
children: [
|
|
1898
1925
|
isIOSDateTime && !iOSDateTimeFullSize ? void 0 : labelComponent,
|
|
1899
|
-
/* @__PURE__ */
|
|
1900
|
-
prefix && /* @__PURE__ */
|
|
1926
|
+
/* @__PURE__ */ jsxs7(View_default, { isRow: true, position: "relative", alignItems: "center", height: readyHeight, children: [
|
|
1927
|
+
prefix && /* @__PURE__ */ jsxs7(
|
|
1901
1928
|
View_default,
|
|
1902
1929
|
{
|
|
1903
1930
|
isRow: true,
|
|
@@ -1915,8 +1942,8 @@ var InputFieldComponent = forwardRef(
|
|
|
1915
1942
|
zIndex: 1,
|
|
1916
1943
|
onPress: onPressPrefix,
|
|
1917
1944
|
children: [
|
|
1918
|
-
typeof prefix === "string" ? /* @__PURE__ */
|
|
1919
|
-
/* @__PURE__ */
|
|
1945
|
+
typeof prefix === "string" ? /* @__PURE__ */ jsx13(Text_default, { fontWeight: 700, lineHeight, children: prefix }) : prefix,
|
|
1946
|
+
/* @__PURE__ */ jsx13(
|
|
1920
1947
|
Animate_default.View,
|
|
1921
1948
|
{
|
|
1922
1949
|
position: "absolute",
|
|
@@ -1931,9 +1958,9 @@ var InputFieldComponent = forwardRef(
|
|
|
1931
1958
|
]
|
|
1932
1959
|
}
|
|
1933
1960
|
),
|
|
1934
|
-
isIOSDateTime ? /* @__PURE__ */
|
|
1961
|
+
isIOSDateTime ? /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
1935
1962
|
!iOSDateTimeFullSize ? labelComponent : void 0,
|
|
1936
|
-
/* @__PURE__ */
|
|
1963
|
+
/* @__PURE__ */ jsx13(
|
|
1937
1964
|
RNDateTimePicker,
|
|
1938
1965
|
{
|
|
1939
1966
|
value: internalDateValue ?? /* @__PURE__ */ new Date(),
|
|
@@ -1945,7 +1972,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1945
1972
|
onValueChange: onValueChangeRNDateTimePicker
|
|
1946
1973
|
}
|
|
1947
1974
|
)
|
|
1948
|
-
] }) : /* @__PURE__ */
|
|
1975
|
+
] }) : /* @__PURE__ */ jsx13(
|
|
1949
1976
|
View_default,
|
|
1950
1977
|
{
|
|
1951
1978
|
flex: 1,
|
|
@@ -1956,7 +1983,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1956
1983
|
borderBottomRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1957
1984
|
pressStrength: 1,
|
|
1958
1985
|
onPress: Platform5.OS === "android" ? editable === false || withPressInputField ? onPressInputField : void 0 : void 0,
|
|
1959
|
-
children: /* @__PURE__ */
|
|
1986
|
+
children: /* @__PURE__ */ jsxs7(
|
|
1960
1987
|
Animate_default.View,
|
|
1961
1988
|
{
|
|
1962
1989
|
position: "relative",
|
|
@@ -1974,7 +2001,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1974
2001
|
animateBorderColor: borderColor,
|
|
1975
2002
|
overflow: "hidden",
|
|
1976
2003
|
children: [
|
|
1977
|
-
leftIcon && /* @__PURE__ */
|
|
2004
|
+
leftIcon && /* @__PURE__ */ jsx13(
|
|
1978
2005
|
Icon_default,
|
|
1979
2006
|
{
|
|
1980
2007
|
position: "absolute",
|
|
@@ -1987,7 +2014,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1987
2014
|
onPress: onPressLeftIcon
|
|
1988
2015
|
}
|
|
1989
2016
|
),
|
|
1990
|
-
/* @__PURE__ */
|
|
2017
|
+
/* @__PURE__ */ jsx13(
|
|
1991
2018
|
TextInput2,
|
|
1992
2019
|
{
|
|
1993
2020
|
style: textInputStyle,
|
|
@@ -2020,7 +2047,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2020
2047
|
ref: textInputRef
|
|
2021
2048
|
}
|
|
2022
2049
|
),
|
|
2023
|
-
rightIcon && /* @__PURE__ */
|
|
2050
|
+
rightIcon && /* @__PURE__ */ jsx13(
|
|
2024
2051
|
Icon_default,
|
|
2025
2052
|
{
|
|
2026
2053
|
position: "absolute",
|
|
@@ -2038,7 +2065,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2038
2065
|
)
|
|
2039
2066
|
}
|
|
2040
2067
|
),
|
|
2041
|
-
suffix && /* @__PURE__ */
|
|
2068
|
+
suffix && /* @__PURE__ */ jsxs7(
|
|
2042
2069
|
View_default,
|
|
2043
2070
|
{
|
|
2044
2071
|
isRow: true,
|
|
@@ -2056,8 +2083,8 @@ var InputFieldComponent = forwardRef(
|
|
|
2056
2083
|
zIndex: 1,
|
|
2057
2084
|
onPress: onPressSuffix,
|
|
2058
2085
|
children: [
|
|
2059
|
-
typeof suffix === "string" ? /* @__PURE__ */
|
|
2060
|
-
/* @__PURE__ */
|
|
2086
|
+
typeof suffix === "string" ? /* @__PURE__ */ jsx13(Text_default, { fontWeight: 700, lineHeight, children: suffix }) : suffix,
|
|
2087
|
+
/* @__PURE__ */ jsx13(
|
|
2061
2088
|
Animate_default.View,
|
|
2062
2089
|
{
|
|
2063
2090
|
position: "absolute",
|
|
@@ -2073,7 +2100,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2073
2100
|
}
|
|
2074
2101
|
)
|
|
2075
2102
|
] }),
|
|
2076
|
-
infoMessage && /* @__PURE__ */
|
|
2103
|
+
infoMessage && /* @__PURE__ */ jsx13(
|
|
2077
2104
|
Animate_default.Text,
|
|
2078
2105
|
{
|
|
2079
2106
|
fontSize: 14,
|
|
@@ -2085,7 +2112,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2085
2112
|
children: infoMessage
|
|
2086
2113
|
}
|
|
2087
2114
|
),
|
|
2088
|
-
errorMessage && /* @__PURE__ */
|
|
2115
|
+
errorMessage && /* @__PURE__ */ jsx13(
|
|
2089
2116
|
Animate_default.Text,
|
|
2090
2117
|
{
|
|
2091
2118
|
fontSize: 14,
|
|
@@ -2103,7 +2130,7 @@ var InputFieldComponent = forwardRef(
|
|
|
2103
2130
|
}
|
|
2104
2131
|
);
|
|
2105
2132
|
InputFieldComponent.email = forwardRef(function Email(props, ref) {
|
|
2106
|
-
return /* @__PURE__ */
|
|
2133
|
+
return /* @__PURE__ */ jsx13(
|
|
2107
2134
|
InputFieldComponent,
|
|
2108
2135
|
{
|
|
2109
2136
|
placeholder: "your@email.here",
|
|
@@ -2126,7 +2153,7 @@ InputFieldComponent.password = forwardRef(function Password(props, ref) {
|
|
|
2126
2153
|
useImperativeHandle(ref, () => {
|
|
2127
2154
|
return inputFieldRef.current;
|
|
2128
2155
|
}, []);
|
|
2129
|
-
return /* @__PURE__ */
|
|
2156
|
+
return /* @__PURE__ */ jsx13(
|
|
2130
2157
|
InputFieldComponent,
|
|
2131
2158
|
{
|
|
2132
2159
|
secureTextEntry: !showPassword,
|
|
@@ -2142,11 +2169,11 @@ InputFieldComponent.password = forwardRef(function Password(props, ref) {
|
|
|
2142
2169
|
);
|
|
2143
2170
|
});
|
|
2144
2171
|
InputFieldComponent.search = forwardRef(function Search(props, ref) {
|
|
2145
|
-
return /* @__PURE__ */
|
|
2172
|
+
return /* @__PURE__ */ jsx13(InputFieldComponent, { placeholder: "Search...", leftIcon: "magnifyingGlass", ...props, ref });
|
|
2146
2173
|
});
|
|
2147
2174
|
InputFieldComponent.code = forwardRef(function Password2({ isSmall, ...props }, ref) {
|
|
2148
|
-
const theme2 =
|
|
2149
|
-
return /* @__PURE__ */
|
|
2175
|
+
const theme2 = useTheme12();
|
|
2176
|
+
return /* @__PURE__ */ jsx13(
|
|
2150
2177
|
InputFieldComponent,
|
|
2151
2178
|
{
|
|
2152
2179
|
flex: 1,
|
|
@@ -2161,7 +2188,7 @@ InputFieldComponent.code = forwardRef(function Password2({ isSmall, ...props },
|
|
|
2161
2188
|
}
|
|
2162
2189
|
);
|
|
2163
2190
|
});
|
|
2164
|
-
var InputField =
|
|
2191
|
+
var InputField = memo13(InputFieldComponent);
|
|
2165
2192
|
InputField.email = InputFieldComponent.email;
|
|
2166
2193
|
InputField.password = InputFieldComponent.password;
|
|
2167
2194
|
InputField.search = InputFieldComponent.search;
|
|
@@ -2169,12 +2196,12 @@ InputField.code = InputFieldComponent.code;
|
|
|
2169
2196
|
var InputField_default = InputField;
|
|
2170
2197
|
|
|
2171
2198
|
// src/components/Switch.tsx
|
|
2172
|
-
import { memo as
|
|
2199
|
+
import { memo as memo14, useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo10 } from "react";
|
|
2173
2200
|
import { Switch as NativeSwitch, Platform as Platform6 } from "react-native";
|
|
2174
|
-
import { useBooleanState as useBooleanState5, useTheme as
|
|
2175
|
-
import { jsx as
|
|
2201
|
+
import { useBooleanState as useBooleanState5, useTheme as useTheme13 } from "react-better-core";
|
|
2202
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2176
2203
|
function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
2177
|
-
const theme2 =
|
|
2204
|
+
const theme2 = useTheme13();
|
|
2178
2205
|
const [enabled, setEnabled] = useBooleanState5(isEnabled ?? defaultIsEnabled);
|
|
2179
2206
|
const onPressElement = useCallback7(() => {
|
|
2180
2207
|
onChange?.(!enabled);
|
|
@@ -2194,7 +2221,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
2194
2221
|
const ballSize = 26;
|
|
2195
2222
|
const ballGap = 3;
|
|
2196
2223
|
const holderWidth = ballSize * 2.1;
|
|
2197
|
-
return Platform6.OS === "ios" ? /* @__PURE__ */
|
|
2224
|
+
return Platform6.OS === "ios" ? /* @__PURE__ */ jsx14(
|
|
2198
2225
|
NativeSwitch,
|
|
2199
2226
|
{
|
|
2200
2227
|
trackColor,
|
|
@@ -2203,7 +2230,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
2203
2230
|
value: enabled,
|
|
2204
2231
|
disabled
|
|
2205
2232
|
}
|
|
2206
|
-
) : /* @__PURE__ */
|
|
2233
|
+
) : /* @__PURE__ */ jsx14(
|
|
2207
2234
|
View_default,
|
|
2208
2235
|
{
|
|
2209
2236
|
width: holderWidth,
|
|
@@ -2211,23 +2238,26 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
2211
2238
|
pressStrength: pressStrength().p05,
|
|
2212
2239
|
disabled,
|
|
2213
2240
|
onPress: !disabled ? onPressElement : void 0,
|
|
2214
|
-
children: /* @__PURE__ */
|
|
2241
|
+
children: /* @__PURE__ */ jsx14(
|
|
2215
2242
|
Animate_default.View,
|
|
2216
2243
|
{
|
|
2217
2244
|
width: "100%",
|
|
2218
2245
|
height: ballGap + ballSize + ballGap,
|
|
2219
2246
|
borderRadius: 999,
|
|
2220
|
-
initialOpacity: 1,
|
|
2221
|
-
animateOpacity: disabled ? 0.6 : 1,
|
|
2222
2247
|
initialBackgroundColor: theme2.colors.border,
|
|
2223
2248
|
animateBackgroundColor: enabled ? theme2.colors.primary : theme2.colors.border,
|
|
2224
|
-
|
|
2249
|
+
initialOpacity: 1,
|
|
2250
|
+
animateOpacity: disabled ? 0.6 : 1,
|
|
2251
|
+
children: /* @__PURE__ */ jsx14(
|
|
2225
2252
|
Animate_default.View,
|
|
2226
2253
|
{
|
|
2227
2254
|
width: ballSize,
|
|
2228
2255
|
height: ballSize,
|
|
2229
2256
|
top: ballGap,
|
|
2230
2257
|
borderRadius: 999,
|
|
2258
|
+
transitionType: "spring",
|
|
2259
|
+
transitionDamping: 20,
|
|
2260
|
+
transitionStiffness: 230,
|
|
2231
2261
|
backgroundColor: theme2.colors.backgroundContent,
|
|
2232
2262
|
initialX: ballGap,
|
|
2233
2263
|
animateX: enabled ? holderWidth - ballGap - ballSize : ballGap
|
|
@@ -2238,30 +2268,122 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
2238
2268
|
}
|
|
2239
2269
|
);
|
|
2240
2270
|
}
|
|
2241
|
-
var Switch_default =
|
|
2271
|
+
var Switch_default = memo14(Switch);
|
|
2272
|
+
|
|
2273
|
+
// src/components/CheckBox.tsx
|
|
2274
|
+
import { memo as memo15, useCallback as useCallback8, useEffect as useEffect8 } from "react";
|
|
2275
|
+
import { Platform as Platform7 } from "react-native";
|
|
2276
|
+
import { useBooleanState as useBooleanState6, useTheme as useTheme14 } from "react-better-core";
|
|
2277
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2278
|
+
function CheckBox({
|
|
2279
|
+
isChecked,
|
|
2280
|
+
defaultIsChecked,
|
|
2281
|
+
size = 36,
|
|
2282
|
+
text,
|
|
2283
|
+
required,
|
|
2284
|
+
disabled,
|
|
2285
|
+
onChange
|
|
2286
|
+
}) {
|
|
2287
|
+
const theme2 = useTheme14();
|
|
2288
|
+
const [checked, setChecked] = useBooleanState6(isChecked ?? defaultIsChecked);
|
|
2289
|
+
const onPressElement = useCallback8(() => {
|
|
2290
|
+
onChange?.(!checked);
|
|
2291
|
+
setChecked.toggle();
|
|
2292
|
+
}, [onChange, checked]);
|
|
2293
|
+
useEffect8(() => {
|
|
2294
|
+
if (isChecked === void 0) return;
|
|
2295
|
+
setChecked.setState(isChecked);
|
|
2296
|
+
}, [isChecked]);
|
|
2297
|
+
const checkBox = /* @__PURE__ */ jsx15(
|
|
2298
|
+
View_default,
|
|
2299
|
+
{
|
|
2300
|
+
width: size,
|
|
2301
|
+
borderRadius: theme2.styles.borderRadius,
|
|
2302
|
+
pressStrength: pressStrength().p05,
|
|
2303
|
+
disabled,
|
|
2304
|
+
onPress: !disabled ? onPressElement : void 0,
|
|
2305
|
+
children: /* @__PURE__ */ jsx15(
|
|
2306
|
+
Animate_default.View,
|
|
2307
|
+
{
|
|
2308
|
+
width: "100%",
|
|
2309
|
+
height: size,
|
|
2310
|
+
borderWidth: 1,
|
|
2311
|
+
borderRadius: theme2.styles.borderRadius,
|
|
2312
|
+
initialBackgroundColor: theme2.colors.backgroundContent,
|
|
2313
|
+
animateBackgroundColor: checked ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
2314
|
+
initialBorderColor: theme2.colors.border,
|
|
2315
|
+
animateBorderColor: checked ? theme2.colors.primary : theme2.colors.border,
|
|
2316
|
+
initialOpacity: 1,
|
|
2317
|
+
animateOpacity: disabled ? 0.6 : 1,
|
|
2318
|
+
children: /* @__PURE__ */ jsx15(
|
|
2319
|
+
Animate_default.View,
|
|
2320
|
+
{
|
|
2321
|
+
width: "100%",
|
|
2322
|
+
height: "100%",
|
|
2323
|
+
alignItems: "center",
|
|
2324
|
+
justifyContent: "center",
|
|
2325
|
+
transitionType: "spring",
|
|
2326
|
+
transitionDamping: 20,
|
|
2327
|
+
transitionStiffness: 230,
|
|
2328
|
+
initialScale: 0,
|
|
2329
|
+
animateScale: checked ? 1 : 0,
|
|
2330
|
+
children: /* @__PURE__ */ jsx15(
|
|
2331
|
+
Icon_default,
|
|
2332
|
+
{
|
|
2333
|
+
name: "check",
|
|
2334
|
+
nameIOS: "checkmark",
|
|
2335
|
+
size: size * (Platform7.OS === "ios" ? 0.5 : 0.6),
|
|
2336
|
+
color: theme2.colors.base
|
|
2337
|
+
}
|
|
2338
|
+
)
|
|
2339
|
+
}
|
|
2340
|
+
)
|
|
2341
|
+
}
|
|
2342
|
+
)
|
|
2343
|
+
}
|
|
2344
|
+
);
|
|
2345
|
+
return text ? /* @__PURE__ */ jsx15(Fragment5, { children: /* @__PURE__ */ jsxs8(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.gap, children: [
|
|
2346
|
+
checkBox,
|
|
2347
|
+
/* @__PURE__ */ jsx15(
|
|
2348
|
+
View_default,
|
|
2349
|
+
{
|
|
2350
|
+
width: "100%",
|
|
2351
|
+
flexShrink: 1,
|
|
2352
|
+
pressType: "opacity",
|
|
2353
|
+
pressStrength: pressStrength().p3,
|
|
2354
|
+
onPress: onPressElement,
|
|
2355
|
+
children: /* @__PURE__ */ jsxs8(View_default, { isRow: true, alignItems: "flex-start", gap: 2, children: [
|
|
2356
|
+
/* @__PURE__ */ jsx15(View_default, { flexShrink: 1, children: typeof text === "string" ? /* @__PURE__ */ jsx15(Text_default, { children: text }) : text }),
|
|
2357
|
+
required && /* @__PURE__ */ jsx15(Label_default, { required: true })
|
|
2358
|
+
] })
|
|
2359
|
+
}
|
|
2360
|
+
)
|
|
2361
|
+
] }) }) : checkBox;
|
|
2362
|
+
}
|
|
2363
|
+
var CheckBox_default = memo15(CheckBox);
|
|
2242
2364
|
|
|
2243
2365
|
// src/components/StatusBar.tsx
|
|
2244
|
-
import { memo as
|
|
2245
|
-
import { useTheme as
|
|
2246
|
-
import { StatusBar as NativeStatusBar, Platform as
|
|
2247
|
-
import { jsx as
|
|
2366
|
+
import { memo as memo16 } from "react";
|
|
2367
|
+
import { useTheme as useTheme15 } from "react-better-core";
|
|
2368
|
+
import { StatusBar as NativeStatusBar, Platform as Platform8 } from "react-native";
|
|
2369
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2248
2370
|
function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }) {
|
|
2249
|
-
const theme2 =
|
|
2250
|
-
return /* @__PURE__ */
|
|
2371
|
+
const theme2 = useTheme15();
|
|
2372
|
+
return /* @__PURE__ */ jsx16(
|
|
2251
2373
|
NativeStatusBar,
|
|
2252
2374
|
{
|
|
2253
2375
|
backgroundColor: darkStatusBar ? theme2.colors.backgroundSecondary : void 0,
|
|
2254
|
-
barStyle: barStyle ?? (
|
|
2376
|
+
barStyle: barStyle ?? (Platform8.OS === "android" ? androidBarStyle : iOSBarStyle),
|
|
2255
2377
|
hidden
|
|
2256
2378
|
}
|
|
2257
2379
|
);
|
|
2258
2380
|
}
|
|
2259
|
-
var StatusBar_default =
|
|
2381
|
+
var StatusBar_default = memo16(StatusBar);
|
|
2260
2382
|
|
|
2261
2383
|
// src/components/ListItem.tsx
|
|
2262
|
-
import { memo as
|
|
2263
|
-
import { useTheme as
|
|
2264
|
-
import { Fragment as
|
|
2384
|
+
import { memo as memo17 } from "react";
|
|
2385
|
+
import { useTheme as useTheme16 } from "react-better-core";
|
|
2386
|
+
import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2265
2387
|
function ListItem({
|
|
2266
2388
|
icon,
|
|
2267
2389
|
iconIOS,
|
|
@@ -2275,12 +2397,14 @@ function ListItem({
|
|
|
2275
2397
|
rightValue,
|
|
2276
2398
|
rightValueSelectable,
|
|
2277
2399
|
switchIsEnabled,
|
|
2278
|
-
switchOnChange
|
|
2400
|
+
switchOnChange,
|
|
2401
|
+
checkBoxIsChecked,
|
|
2402
|
+
checkBoxOnChange
|
|
2279
2403
|
}) {
|
|
2280
|
-
const theme2 =
|
|
2404
|
+
const theme2 = useTheme16();
|
|
2281
2405
|
const device = useDevice();
|
|
2282
2406
|
const sideSpace = theme2.styles.space;
|
|
2283
|
-
return /* @__PURE__ */
|
|
2407
|
+
return /* @__PURE__ */ jsx17(
|
|
2284
2408
|
View_default,
|
|
2285
2409
|
{
|
|
2286
2410
|
width: insideScreenHolder ? device.windowDimensions.width : "100%",
|
|
@@ -2290,15 +2414,15 @@ function ListItem({
|
|
|
2290
2414
|
paddingHorizontal: sideSpace,
|
|
2291
2415
|
pressStrength: pressStrength().p05,
|
|
2292
2416
|
onPress,
|
|
2293
|
-
children: /* @__PURE__ */
|
|
2294
|
-
icon && /* @__PURE__ */
|
|
2295
|
-
/* @__PURE__ */
|
|
2296
|
-
title && /* @__PURE__ */
|
|
2297
|
-
description && /* @__PURE__ */
|
|
2417
|
+
children: /* @__PURE__ */ jsxs9(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.space, children: [
|
|
2418
|
+
icon && /* @__PURE__ */ jsx17(Icon_default, { name: icon, nameIOS: iconIOS, size: 22, color: theme2.colors.primary }),
|
|
2419
|
+
/* @__PURE__ */ jsx17(View_default, { flex: 1, flexDirection: "row", alignItems: "center", gap: theme2.styles.gap, children: /* @__PURE__ */ jsxs9(View_default, { flex: 1, children: [
|
|
2420
|
+
title && /* @__PURE__ */ jsx17(Text_default, { fontSize: 20, fontWeight: 700, children: title }),
|
|
2421
|
+
description && /* @__PURE__ */ jsx17(Text_default.body, { selectable: descriptionSelectable, children: description })
|
|
2298
2422
|
] }) }),
|
|
2299
|
-
rightElement ? /* @__PURE__ */
|
|
2300
|
-
rightValue !== void 0 && /* @__PURE__ */
|
|
2301
|
-
rightElement === "arrow" && /* @__PURE__ */
|
|
2423
|
+
rightElement ? /* @__PURE__ */ jsx17(Fragment6, { children: rightValue !== void 0 || rightElement === "arrow" ? /* @__PURE__ */ jsxs9(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
2424
|
+
rightValue !== void 0 && /* @__PURE__ */ jsx17(Text_default, { fontSize: 14, fontWeight: 700, selectable: rightValueSelectable, children: rightValue }),
|
|
2425
|
+
rightElement === "arrow" && /* @__PURE__ */ jsx17(
|
|
2302
2426
|
Icon_default,
|
|
2303
2427
|
{
|
|
2304
2428
|
name: "chevronRight",
|
|
@@ -2306,19 +2430,21 @@ function ListItem({
|
|
|
2306
2430
|
color: rightValue !== void 0 ? theme2.colors.textPrimary : theme2.colors.textSecondary
|
|
2307
2431
|
}
|
|
2308
2432
|
)
|
|
2309
|
-
] }) : rightElement === "switch" ? /* @__PURE__ */
|
|
2433
|
+
] }) : rightElement === "switch" ? /* @__PURE__ */ jsx17(Switch_default, { isEnabled: switchIsEnabled, onChange: switchOnChange }) : rightElement === "checkBox" ? /* @__PURE__ */ jsx17(CheckBox_default, { isChecked: checkBoxIsChecked, onChange: checkBoxOnChange }) : void 0 }) : void 0
|
|
2310
2434
|
] })
|
|
2311
2435
|
}
|
|
2312
2436
|
);
|
|
2313
2437
|
}
|
|
2314
|
-
var ListItem_default =
|
|
2438
|
+
var ListItem_default = memo17(ListItem);
|
|
2315
2439
|
export {
|
|
2316
2440
|
Animate_default as Animate,
|
|
2317
2441
|
BetterComponentsProvider_default as BetterComponentsProvider,
|
|
2318
2442
|
Button_default as Button,
|
|
2443
|
+
CheckBox_default as CheckBox,
|
|
2319
2444
|
Icon_default as Icon,
|
|
2320
2445
|
Image_default as Image,
|
|
2321
2446
|
InputField_default as InputField,
|
|
2447
|
+
Label_default as Label,
|
|
2322
2448
|
ListItem_default as ListItem,
|
|
2323
2449
|
Loader_default as Loader,
|
|
2324
2450
|
ScreenHolder_default as ScreenHolder,
|
|
@@ -2349,7 +2475,7 @@ export {
|
|
|
2349
2475
|
saturateColor,
|
|
2350
2476
|
useAlertControls,
|
|
2351
2477
|
useBetterComponentsContext,
|
|
2352
|
-
|
|
2478
|
+
useBooleanState7 as useBooleanState,
|
|
2353
2479
|
useDebounceState,
|
|
2354
2480
|
useDevice,
|
|
2355
2481
|
useEventEmitter,
|
|
@@ -2357,6 +2483,6 @@ export {
|
|
|
2357
2483
|
useKeyboard,
|
|
2358
2484
|
useLoader2 as useLoader,
|
|
2359
2485
|
useLoaderControls,
|
|
2360
|
-
|
|
2486
|
+
useTheme17 as useTheme
|
|
2361
2487
|
};
|
|
2362
2488
|
//# sourceMappingURL=index.mjs.map
|