react-native-better-html 1.0.15 → 1.0.17
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 +58 -34
- package/dist/index.d.ts +58 -34
- package/dist/index.js +298 -123
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +262 -89
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
Animate: () => Animate_default,
|
|
34
34
|
BetterComponentsProvider: () => BetterComponentsProvider_default,
|
|
35
35
|
Button: () => Button_default,
|
|
36
|
+
Icon: () => Icon_default,
|
|
36
37
|
Image: () => Image_default,
|
|
37
38
|
InputField: () => InputField_default,
|
|
38
39
|
Loader: () => Loader_default,
|
|
@@ -41,35 +42,36 @@ __export(index_exports, {
|
|
|
41
42
|
Text: () => Text_default,
|
|
42
43
|
View: () => View_default,
|
|
43
44
|
asyncStoragePlugin: () => asyncStoragePlugin,
|
|
44
|
-
colorThemeControls: () =>
|
|
45
|
-
countries: () =>
|
|
46
|
-
darkenColor: () =>
|
|
45
|
+
colorThemeControls: () => import_react_better_core12.colorThemeControls,
|
|
46
|
+
countries: () => import_react_better_core12.countries,
|
|
47
|
+
darkenColor: () => import_react_better_core12.darkenColor,
|
|
47
48
|
defaultAsyncStoragePluginOptions: () => defaultAsyncStoragePluginOptions,
|
|
48
|
-
desaturateColor: () =>
|
|
49
|
-
eventPreventDefault: () =>
|
|
50
|
-
eventPreventStop: () =>
|
|
51
|
-
eventStopPropagation: () =>
|
|
52
|
-
formatPhoneNumber: () =>
|
|
49
|
+
desaturateColor: () => import_react_better_core12.desaturateColor,
|
|
50
|
+
eventPreventDefault: () => import_react_better_core12.eventPreventDefault,
|
|
51
|
+
eventPreventStop: () => import_react_better_core12.eventPreventStop,
|
|
52
|
+
eventStopPropagation: () => import_react_better_core12.eventStopPropagation,
|
|
53
|
+
formatPhoneNumber: () => import_react_better_core12.formatPhoneNumber,
|
|
53
54
|
generateAsyncStorage: () => generateAsyncStorage,
|
|
54
|
-
generateRandomString: () =>
|
|
55
|
+
generateRandomString: () => import_react_better_core12.generateRandomString,
|
|
55
56
|
getFormErrorObject: () => getFormErrorObject,
|
|
56
|
-
getPluralWord: () =>
|
|
57
|
-
lightenColor: () =>
|
|
58
|
-
loaderControls: () =>
|
|
57
|
+
getPluralWord: () => import_react_better_core12.getPluralWord,
|
|
58
|
+
lightenColor: () => import_react_better_core12.lightenColor,
|
|
59
|
+
loaderControls: () => import_react_better_core12.loaderControls,
|
|
59
60
|
pressStrength: () => pressStrength,
|
|
60
|
-
saturateColor: () =>
|
|
61
|
+
saturateColor: () => import_react_better_core12.saturateColor,
|
|
61
62
|
useBetterComponentsContext: () => useBetterComponentsContext,
|
|
62
|
-
useBooleanState: () =>
|
|
63
|
-
useDebounceState: () =>
|
|
63
|
+
useBooleanState: () => import_react_better_core12.useBooleanState,
|
|
64
|
+
useDebounceState: () => import_react_better_core12.useDebounceState,
|
|
64
65
|
useDevice: () => useDevice,
|
|
66
|
+
useEventEmitter: () => useEventEmitter,
|
|
65
67
|
useForm: () => useForm,
|
|
66
68
|
useKeyboard: () => useKeyboard,
|
|
67
|
-
useLoader: () =>
|
|
68
|
-
useLoaderControls: () =>
|
|
69
|
-
useTheme: () =>
|
|
69
|
+
useLoader: () => import_react_better_core12.useLoader,
|
|
70
|
+
useLoaderControls: () => import_react_better_core12.useLoaderControls,
|
|
71
|
+
useTheme: () => import_react_better_core12.useTheme
|
|
70
72
|
});
|
|
71
73
|
module.exports = __toCommonJS(index_exports);
|
|
72
|
-
var
|
|
74
|
+
var import_react_better_core12 = require("react-better-core");
|
|
73
75
|
|
|
74
76
|
// src/components/BetterComponentsProvider.tsx
|
|
75
77
|
var import_react = require("react");
|
|
@@ -82,7 +84,38 @@ var appConfig = {};
|
|
|
82
84
|
var theme = {};
|
|
83
85
|
|
|
84
86
|
// src/constants/icons.ts
|
|
85
|
-
var icons = {
|
|
87
|
+
var icons = {
|
|
88
|
+
eye: {
|
|
89
|
+
width: 576,
|
|
90
|
+
height: 512,
|
|
91
|
+
paths: [
|
|
92
|
+
{
|
|
93
|
+
d: "M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM144 256a144 144 0 1 1 288 0 144 144 0 1 1 -288 0zm144-64c0 35.3-28.7 64-64 64c-7.1 0-13.9-1.2-20.3-3.3c-5.5-1.8-11.9 1.6-11.7 7.4c.3 6.9 1.3 13.8 3.2 20.7c13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3z",
|
|
94
|
+
type: "fill"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
eyeDashed: {
|
|
99
|
+
width: 640,
|
|
100
|
+
height: 512,
|
|
101
|
+
paths: [
|
|
102
|
+
{
|
|
103
|
+
d: "M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zM223.1 149.5C248.6 126.2 282.7 112 320 112c79.5 0 144 64.5 144 144c0 24.9-6.3 48.3-17.4 68.7L408 294.5c8.4-19.3 10.6-41.4 4.8-63.3c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3c0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zM373 389.9c-16.4 6.5-34.3 10.1-53 10.1c-79.5 0-144-64.5-144-144c0-6.9 .5-13.6 1.4-20.2L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5L373 389.9z",
|
|
104
|
+
type: "fill"
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
},
|
|
108
|
+
magnifyingGlass: {
|
|
109
|
+
width: 512,
|
|
110
|
+
height: 512,
|
|
111
|
+
paths: [
|
|
112
|
+
{
|
|
113
|
+
d: "M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z",
|
|
114
|
+
type: "fill"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
};
|
|
86
119
|
|
|
87
120
|
// src/constants/assets.ts
|
|
88
121
|
var assets = {};
|
|
@@ -184,10 +217,10 @@ var checkBetterCoreContextValue = (value, functionsName) => {
|
|
|
184
217
|
var pressStrength = () => {
|
|
185
218
|
if (!checkBetterCoreContextValue(externalBetterCoreContextValue, "pressStrength")) return void 0;
|
|
186
219
|
return {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
220
|
+
p05: externalBetterCoreContextValue.colorTheme === "dark" ? 0.85 : 0.95,
|
|
221
|
+
p1: externalBetterCoreContextValue.colorTheme === "dark" ? 0.6 : 0.8,
|
|
222
|
+
p2: externalBetterCoreContextValue.colorTheme === "dark" ? 0.5 : 0.7,
|
|
223
|
+
p3: externalBetterCoreContextValue.colorTheme === "dark" ? 0.4 : 0.6
|
|
191
224
|
};
|
|
192
225
|
};
|
|
193
226
|
|
|
@@ -585,6 +618,17 @@ function useForm(options) {
|
|
|
585
618
|
canSubmit
|
|
586
619
|
};
|
|
587
620
|
}
|
|
621
|
+
function useEventEmitter() {
|
|
622
|
+
return {
|
|
623
|
+
emit: (eventName, params) => {
|
|
624
|
+
import_react_native.DeviceEventEmitter.emit(eventName, params);
|
|
625
|
+
},
|
|
626
|
+
listen: (eventName, callback = () => {
|
|
627
|
+
}) => {
|
|
628
|
+
return import_react_native.DeviceEventEmitter.addListener(eventName, callback);
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
}
|
|
588
632
|
|
|
589
633
|
// src/utils/functions.ts
|
|
590
634
|
var getFormErrorObject = (formValues) => {
|
|
@@ -695,7 +739,8 @@ var ViewComponent = function View({
|
|
|
695
739
|
previousValue.shadowOffset = void 0;
|
|
696
740
|
else previousValue[currentValue] = void 0;
|
|
697
741
|
return previousValue;
|
|
698
|
-
}, {})
|
|
742
|
+
}, {}),
|
|
743
|
+
width: props.width !== "100%" ? props.width : void 0
|
|
699
744
|
}),
|
|
700
745
|
[style]
|
|
701
746
|
);
|
|
@@ -1107,7 +1152,7 @@ ButtonComponent.secondary = function Secondary(props) {
|
|
|
1107
1152
|
borderWidth: 1,
|
|
1108
1153
|
borderColor: theme2.colors.border,
|
|
1109
1154
|
textColor: theme2.colors.textPrimary,
|
|
1110
|
-
pressStrength: pressStrength().
|
|
1155
|
+
pressStrength: pressStrength().p05,
|
|
1111
1156
|
animateOpacity: props.disabled ? 0.4 : 1,
|
|
1112
1157
|
...props
|
|
1113
1158
|
}
|
|
@@ -1268,7 +1313,13 @@ var ImageComponent = function Image({ name, source, withDevFittingMode, ...props
|
|
|
1268
1313
|
}, [assets2, name]);
|
|
1269
1314
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native7.Image, { source: name ? assets2[name.toString()] : source, style, ...props });
|
|
1270
1315
|
};
|
|
1271
|
-
ImageComponent.profileImage = function ProfileImage({
|
|
1316
|
+
ImageComponent.profileImage = function ProfileImage({
|
|
1317
|
+
size = 50,
|
|
1318
|
+
letters,
|
|
1319
|
+
color,
|
|
1320
|
+
backgroundColor,
|
|
1321
|
+
...props
|
|
1322
|
+
}) {
|
|
1272
1323
|
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1273
1324
|
return letters ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1274
1325
|
View_default,
|
|
@@ -1282,7 +1333,7 @@ ImageComponent.profileImage = function ProfileImage({ size = 50, letters, backgr
|
|
|
1282
1333
|
alignItems: "center",
|
|
1283
1334
|
justifyContent: "center",
|
|
1284
1335
|
...props,
|
|
1285
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, marginTop: 1, children: letters.toUpperCase().slice(0, 2) })
|
|
1336
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, color: color ?? theme2.colors.textPrimary, marginTop: 1, children: letters.toUpperCase().slice(0, 2) })
|
|
1286
1337
|
}
|
|
1287
1338
|
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1288
1339
|
ImageComponent,
|
|
@@ -1301,13 +1352,64 @@ var Image2 = (0, import_react9.memo)(ImageComponent);
|
|
|
1301
1352
|
Image2.profileImage = ImageComponent.profileImage;
|
|
1302
1353
|
var Image_default = Image2;
|
|
1303
1354
|
|
|
1304
|
-
// src/components/
|
|
1355
|
+
// src/components/Icon.tsx
|
|
1305
1356
|
var import_react10 = require("react");
|
|
1306
1357
|
var import_react_native8 = require("react-native");
|
|
1307
|
-
var
|
|
1358
|
+
var import_react_native_svg = require("react-native-svg");
|
|
1308
1359
|
var import_react_better_core9 = require("react-better-core");
|
|
1360
|
+
var import_expo_symbols = require("expo-symbols");
|
|
1309
1361
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1310
|
-
var
|
|
1362
|
+
var import_react11 = require("react");
|
|
1363
|
+
function Icon({ name, nameIOS, size = 16, color, ...props }) {
|
|
1364
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
1365
|
+
const { icons: icons2 } = (0, import_react_better_core9.useBetterCoreContext)();
|
|
1366
|
+
const svgColor = color ?? theme2.colors.textPrimary;
|
|
1367
|
+
(0, import_react10.useEffect)(() => {
|
|
1368
|
+
if (!icons2[name.toString()])
|
|
1369
|
+
console.warn(
|
|
1370
|
+
`The icon \`${name}\` you are trying to use does not exist. Make sure to add it to the \`icons\` object in \`<BetterComponentsProvider>\` config value prop.`
|
|
1371
|
+
);
|
|
1372
|
+
}, [icons2, name]);
|
|
1373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1374
|
+
View_default,
|
|
1375
|
+
{
|
|
1376
|
+
width: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingHorizontal?.toString() ?? "0") ?? 0),
|
|
1377
|
+
height: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingVertical?.toString() ?? "0") ?? 0),
|
|
1378
|
+
alignItems: "center",
|
|
1379
|
+
justifyContent: "center",
|
|
1380
|
+
pressType: "opacity",
|
|
1381
|
+
pressStrength: pressStrength().p2,
|
|
1382
|
+
...props,
|
|
1383
|
+
children: import_react_native8.Platform.OS === "ios" && nameIOS ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_expo_symbols.SymbolView, { name: nameIOS, tintColor: svgColor, size }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1384
|
+
import_react_native_svg.Svg,
|
|
1385
|
+
{
|
|
1386
|
+
width: size,
|
|
1387
|
+
height: size,
|
|
1388
|
+
viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
|
|
1389
|
+
fill: "none",
|
|
1390
|
+
children: icons2[name.toString()]?.paths.map(({ type, ...path }) => /* @__PURE__ */ (0, import_react11.createElement)(
|
|
1391
|
+
import_react_native_svg.Path,
|
|
1392
|
+
{
|
|
1393
|
+
...path,
|
|
1394
|
+
fill: type === "fill" ? svgColor : void 0,
|
|
1395
|
+
stroke: type === "stroke" ? svgColor : void 0,
|
|
1396
|
+
key: path.d
|
|
1397
|
+
}
|
|
1398
|
+
))
|
|
1399
|
+
}
|
|
1400
|
+
)
|
|
1401
|
+
}
|
|
1402
|
+
);
|
|
1403
|
+
}
|
|
1404
|
+
var Icon_default = (0, import_react10.memo)(Icon);
|
|
1405
|
+
|
|
1406
|
+
// src/components/InputField.tsx
|
|
1407
|
+
var import_react12 = require("react");
|
|
1408
|
+
var import_react_native9 = require("react-native");
|
|
1409
|
+
var import_datetimepicker = __toESM(require("@react-native-community/datetimepicker"));
|
|
1410
|
+
var import_react_better_core10 = require("react-better-core");
|
|
1411
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1412
|
+
var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
1311
1413
|
({
|
|
1312
1414
|
flex,
|
|
1313
1415
|
placeholder,
|
|
@@ -1341,6 +1443,12 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1341
1443
|
maxLength,
|
|
1342
1444
|
multiline,
|
|
1343
1445
|
numberOfLines = 2,
|
|
1446
|
+
leftIcon,
|
|
1447
|
+
leftIconIOS,
|
|
1448
|
+
onPressLeftIcon,
|
|
1449
|
+
rightIcon,
|
|
1450
|
+
rightIconIOS,
|
|
1451
|
+
onPressRightIcon,
|
|
1344
1452
|
paddingHorizontal,
|
|
1345
1453
|
paddingVertical,
|
|
1346
1454
|
onFocus,
|
|
@@ -1352,29 +1460,32 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1352
1460
|
onPressEnter,
|
|
1353
1461
|
...props
|
|
1354
1462
|
}, ref) => {
|
|
1355
|
-
const theme2 = (0,
|
|
1356
|
-
const { colorTheme } = (0,
|
|
1357
|
-
const textInputRef = (0,
|
|
1358
|
-
const [internalValue, setInternalValue] = (0,
|
|
1359
|
-
const [internalDateValue, setInternalDateValue] = (0,
|
|
1360
|
-
const [isFocused, setIsFocused] = (0,
|
|
1361
|
-
const isIOSDateTime =
|
|
1463
|
+
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
1464
|
+
const { colorTheme } = (0, import_react_better_core10.useBetterCoreContext)();
|
|
1465
|
+
const textInputRef = (0, import_react12.useRef)(null);
|
|
1466
|
+
const [internalValue, setInternalValue] = (0, import_react12.useState)(value?.toString() || defaultValue || "");
|
|
1467
|
+
const [internalDateValue, setInternalDateValue] = (0, import_react12.useState)();
|
|
1468
|
+
const [isFocused, setIsFocused] = (0, import_react_better_core10.useBooleanState)();
|
|
1469
|
+
const isIOSDateTime = import_react_native9.Platform.OS === "ios" && (type === "date" || type === "time");
|
|
1470
|
+
const iconSize = 16;
|
|
1471
|
+
const iconPadding = onPressRightIcon ? theme2.styles.gap : 0;
|
|
1472
|
+
const iconSideSpace = theme2.styles.space;
|
|
1362
1473
|
const borderWidth = 1;
|
|
1363
1474
|
const readyPaddingHorizontal = paddingHorizontal ?? theme2.styles.space;
|
|
1364
1475
|
const readyPaddingVertical = paddingVertical ? parseFloat(paddingVertical.toString()) : (theme2.styles.space + theme2.styles.gap) / 2;
|
|
1365
|
-
const readyHeight = height ?? isIOSDateTime ? void 0 : borderWidth + readyPaddingVertical + lineHeight + readyPaddingVertical + borderWidth + (
|
|
1366
|
-
const onChangeRNDateTimePicker = (0,
|
|
1476
|
+
const readyHeight = height ?? isIOSDateTime ? void 0 : borderWidth + readyPaddingVertical + lineHeight + readyPaddingVertical + borderWidth + (import_react_native9.Platform.OS === "android" ? 2 : 0);
|
|
1477
|
+
const onChangeRNDateTimePicker = (0, import_react12.useCallback)(
|
|
1367
1478
|
(event, data) => {
|
|
1368
1479
|
setInternalDateValue(data);
|
|
1369
1480
|
onChange?.(data?.toISOString() ?? "");
|
|
1370
1481
|
},
|
|
1371
1482
|
[onChange]
|
|
1372
1483
|
);
|
|
1373
|
-
const onPressInputField = (0,
|
|
1484
|
+
const onPressInputField = (0, import_react12.useCallback)(
|
|
1374
1485
|
(event) => {
|
|
1375
1486
|
onPress?.(event);
|
|
1376
1487
|
if (type === "date" || type === "time") {
|
|
1377
|
-
if (
|
|
1488
|
+
if (import_react_native9.Platform.OS === "android") {
|
|
1378
1489
|
import_datetimepicker.DateTimePickerAndroid.open({
|
|
1379
1490
|
value: internalDateValue ?? /* @__PURE__ */ new Date(),
|
|
1380
1491
|
is24Hour: true,
|
|
@@ -1392,47 +1503,60 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1392
1503
|
},
|
|
1393
1504
|
onChange: onChangeRNDateTimePicker
|
|
1394
1505
|
});
|
|
1395
|
-
} else if (
|
|
1506
|
+
} else if (import_react_native9.Platform.OS === "ios") {
|
|
1396
1507
|
}
|
|
1397
1508
|
}
|
|
1398
1509
|
},
|
|
1399
1510
|
[onPress, type, internalDateValue, onChangeRNDateTimePicker]
|
|
1400
1511
|
);
|
|
1401
|
-
const onFocusElement = (0,
|
|
1512
|
+
const onFocusElement = (0, import_react12.useCallback)((event) => {
|
|
1402
1513
|
setIsFocused.setTrue();
|
|
1403
1514
|
onFocus?.(event);
|
|
1404
1515
|
}, []);
|
|
1405
|
-
const onBlurElement = (0,
|
|
1516
|
+
const onBlurElement = (0, import_react12.useCallback)((event) => {
|
|
1406
1517
|
setIsFocused.setFalse();
|
|
1407
1518
|
onBlur?.(event);
|
|
1408
1519
|
}, []);
|
|
1409
|
-
const onChangeText = (0,
|
|
1520
|
+
const onChangeText = (0, import_react12.useCallback)(
|
|
1410
1521
|
(text) => {
|
|
1411
1522
|
setInternalValue(text);
|
|
1412
1523
|
onChange?.(text);
|
|
1413
1524
|
},
|
|
1414
1525
|
[onChange]
|
|
1415
1526
|
);
|
|
1416
|
-
const textInputStyle = (0,
|
|
1527
|
+
const textInputStyle = (0, import_react12.useMemo)(
|
|
1417
1528
|
() => ({
|
|
1418
1529
|
flex: 1,
|
|
1419
1530
|
fontSize,
|
|
1420
1531
|
fontWeight,
|
|
1421
1532
|
lineHeight,
|
|
1422
1533
|
color: theme2.colors.textPrimary,
|
|
1534
|
+
paddingLeft: leftIcon ? iconSideSpace + iconSize + iconSideSpace : void 0,
|
|
1535
|
+
paddingRight: rightIcon ? iconSideSpace + iconSize + iconSideSpace : void 0,
|
|
1423
1536
|
paddingHorizontal: readyPaddingHorizontal,
|
|
1424
1537
|
paddingVertical: readyPaddingVertical
|
|
1425
1538
|
}),
|
|
1426
|
-
[
|
|
1539
|
+
[
|
|
1540
|
+
theme2.colors,
|
|
1541
|
+
fontSize,
|
|
1542
|
+
fontWeight,
|
|
1543
|
+
lineHeight,
|
|
1544
|
+
readyPaddingHorizontal,
|
|
1545
|
+
readyPaddingVertical,
|
|
1546
|
+
iconSideSpace,
|
|
1547
|
+
iconSize,
|
|
1548
|
+
leftIcon,
|
|
1549
|
+
rightIcon
|
|
1550
|
+
]
|
|
1427
1551
|
);
|
|
1428
|
-
const rnDateTimePickerStyle = (0,
|
|
1552
|
+
const rnDateTimePickerStyle = (0, import_react12.useMemo)(
|
|
1429
1553
|
() => ({
|
|
1430
1554
|
flex: iOSDateTimeFullSize ? 1 : void 0,
|
|
1431
1555
|
marginLeft: -8 + (iOSDateTimeFullSize ? 0 : theme2.styles.space)
|
|
1432
1556
|
}),
|
|
1433
1557
|
[iOSDateTimeFullSize]
|
|
1434
1558
|
);
|
|
1435
|
-
(0,
|
|
1559
|
+
(0, import_react12.useEffect)(() => {
|
|
1436
1560
|
if (value === void 0) return;
|
|
1437
1561
|
setInternalValue(value.toString());
|
|
1438
1562
|
try {
|
|
@@ -1440,7 +1564,7 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1440
1564
|
} catch (error) {
|
|
1441
1565
|
}
|
|
1442
1566
|
}, [value]);
|
|
1443
|
-
(0,
|
|
1567
|
+
(0, import_react12.useEffect)(() => {
|
|
1444
1568
|
if (type !== "date" && type !== "time") return;
|
|
1445
1569
|
const date = internalDateValue?.toISOString().split("T")[0] ?? "";
|
|
1446
1570
|
const hours = internalDateValue ? internalDateValue.getHours().toString() : "00";
|
|
@@ -1449,7 +1573,7 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1449
1573
|
type === "date" ? date : internalDateValue ? `${hours.length === 1 ? `0${hours}` : hours}:${minutes.length === 1 ? `0${minutes}` : minutes}` : ""
|
|
1450
1574
|
);
|
|
1451
1575
|
}, [internalDateValue]);
|
|
1452
|
-
(0,
|
|
1576
|
+
(0, import_react12.useImperativeHandle)(
|
|
1453
1577
|
ref,
|
|
1454
1578
|
() => {
|
|
1455
1579
|
return textInputRef.current;
|
|
@@ -1457,12 +1581,12 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1457
1581
|
[]
|
|
1458
1582
|
);
|
|
1459
1583
|
const withPressInputField = !!onPress || type === "date" || type === "time";
|
|
1460
|
-
const prefixSuffixBackgroundColor = colorTheme === "light" ? (0,
|
|
1461
|
-
const labelComponent = label && /* @__PURE__ */ (0,
|
|
1462
|
-
/* @__PURE__ */ (0,
|
|
1463
|
-
required && /* @__PURE__ */ (0,
|
|
1584
|
+
const prefixSuffixBackgroundColor = colorTheme === "light" ? (0, import_react_better_core10.darkenColor)(theme2.colors.backgroundContent, 0.03) : (0, import_react_better_core10.lightenColor)(theme2.colors.backgroundContent, 0.1);
|
|
1585
|
+
const labelComponent = label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(View_default, { isRow: true, alignItems: "center", gap: 2, children: [
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { fontSize: 14, color: isError ? theme2.colors.error : theme2.colors.textSecondary, children: label }),
|
|
1587
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { color: theme2.colors.error, children: "*" })
|
|
1464
1588
|
] });
|
|
1465
|
-
return /* @__PURE__ */ (0,
|
|
1589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1466
1590
|
Animate_default.View,
|
|
1467
1591
|
{
|
|
1468
1592
|
flex,
|
|
@@ -1472,8 +1596,8 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1472
1596
|
...props,
|
|
1473
1597
|
children: [
|
|
1474
1598
|
isIOSDateTime && !iOSDateTimeFullSize ? void 0 : labelComponent,
|
|
1475
|
-
/* @__PURE__ */ (0,
|
|
1476
|
-
prefix && /* @__PURE__ */ (0,
|
|
1599
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(View_default, { isRow: true, position: "relative", alignItems: "center", height: readyHeight, children: [
|
|
1600
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1477
1601
|
View_default,
|
|
1478
1602
|
{
|
|
1479
1603
|
isRow: true,
|
|
@@ -1488,20 +1612,20 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1488
1612
|
borderColor: theme2.colors.border,
|
|
1489
1613
|
paddingHorizontal: readyPaddingHorizontal,
|
|
1490
1614
|
onPress: onPressPrefix,
|
|
1491
|
-
children: typeof prefix === "string" ? /* @__PURE__ */ (0,
|
|
1615
|
+
children: typeof prefix === "string" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1492
1616
|
Text_default,
|
|
1493
1617
|
{
|
|
1494
1618
|
fontWeight: 700,
|
|
1495
1619
|
lineHeight,
|
|
1496
|
-
marginTop:
|
|
1620
|
+
marginTop: import_react_native9.Platform.OS === "ios" && onPressPrefix ? readyPaddingVertical : void 0,
|
|
1497
1621
|
children: prefix
|
|
1498
1622
|
}
|
|
1499
1623
|
) : prefix
|
|
1500
1624
|
}
|
|
1501
1625
|
),
|
|
1502
|
-
isIOSDateTime ? /* @__PURE__ */ (0,
|
|
1626
|
+
isIOSDateTime ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1503
1627
|
!iOSDateTimeFullSize ? labelComponent : void 0,
|
|
1504
|
-
/* @__PURE__ */ (0,
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1505
1629
|
import_datetimepicker.default,
|
|
1506
1630
|
{
|
|
1507
1631
|
value: internalDateValue ?? /* @__PURE__ */ new Date(),
|
|
@@ -1512,7 +1636,7 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1512
1636
|
onChange: onChangeRNDateTimePicker
|
|
1513
1637
|
}
|
|
1514
1638
|
)
|
|
1515
|
-
] }) : /* @__PURE__ */ (0,
|
|
1639
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1516
1640
|
View_default,
|
|
1517
1641
|
{
|
|
1518
1642
|
flex: 1,
|
|
@@ -1522,11 +1646,13 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1522
1646
|
borderTopRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1523
1647
|
borderBottomRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1524
1648
|
pressStrength: 1,
|
|
1525
|
-
onPress:
|
|
1526
|
-
children: /* @__PURE__ */ (0,
|
|
1649
|
+
onPress: import_react_native9.Platform.OS === "android" ? editable === false || withPressInputField ? onPressInputField : void 0 : void 0,
|
|
1650
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1527
1651
|
Animate_default.View,
|
|
1528
1652
|
{
|
|
1653
|
+
position: "relative",
|
|
1529
1654
|
flex: 1,
|
|
1655
|
+
justifyContent: "center",
|
|
1530
1656
|
backgroundColor: theme2.colors.backgroundContent,
|
|
1531
1657
|
borderTopLeftRadius: prefix ? 0 : theme2.styles.borderRadius,
|
|
1532
1658
|
borderBottomLeftRadius: prefix ? 0 : theme2.styles.borderRadius,
|
|
@@ -1536,44 +1662,72 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1536
1662
|
initialBorderColor: theme2.colors.border,
|
|
1537
1663
|
animateBorderColor: isFocused ? theme2.colors.primary : isError ? theme2.colors.error : theme2.colors.border,
|
|
1538
1664
|
overflow: "hidden",
|
|
1539
|
-
children:
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1665
|
+
children: [
|
|
1666
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1667
|
+
Icon_default,
|
|
1668
|
+
{
|
|
1669
|
+
position: "absolute",
|
|
1670
|
+
left: iconSideSpace - iconPadding,
|
|
1671
|
+
name: leftIcon,
|
|
1672
|
+
nameIOS: leftIconIOS,
|
|
1673
|
+
size: iconSize,
|
|
1674
|
+
pointerEvents: !onPressLeftIcon ? "box-none" : void 0,
|
|
1675
|
+
padding: iconPadding,
|
|
1676
|
+
onPress: onPressLeftIcon
|
|
1677
|
+
}
|
|
1678
|
+
),
|
|
1679
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1680
|
+
import_react_native9.TextInput,
|
|
1681
|
+
{
|
|
1682
|
+
style: textInputStyle,
|
|
1683
|
+
value: internalValue,
|
|
1684
|
+
defaultValue,
|
|
1685
|
+
autoCapitalize,
|
|
1686
|
+
autoComplete,
|
|
1687
|
+
autoCorrect,
|
|
1688
|
+
autoFocus,
|
|
1689
|
+
placeholder: placeholder ?? label,
|
|
1690
|
+
placeholderTextColor: theme2.colors.textSecondary + "80",
|
|
1691
|
+
enterKeyHint: returnKeyLabel,
|
|
1692
|
+
returnKeyType,
|
|
1693
|
+
onSubmitEditing: onPressEnter,
|
|
1694
|
+
readOnly: !editable || disabled || type === "date" || type === "time",
|
|
1695
|
+
textAlign,
|
|
1696
|
+
editable: !disabled,
|
|
1697
|
+
keyboardAppearance,
|
|
1698
|
+
keyboardType,
|
|
1699
|
+
cursorColor: theme2.colors.primary,
|
|
1700
|
+
selectionColor: theme2.colors.primary,
|
|
1701
|
+
secureTextEntry,
|
|
1702
|
+
onFocus: onFocusElement,
|
|
1703
|
+
onBlur: onBlurElement,
|
|
1704
|
+
onChangeText,
|
|
1705
|
+
maxLength,
|
|
1706
|
+
multiline,
|
|
1707
|
+
numberOfLines,
|
|
1708
|
+
onPress: withPressInputField ? onPressInputField : void 0,
|
|
1709
|
+
ref: textInputRef
|
|
1710
|
+
}
|
|
1711
|
+
),
|
|
1712
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1713
|
+
Icon_default,
|
|
1714
|
+
{
|
|
1715
|
+
position: "absolute",
|
|
1716
|
+
right: iconSideSpace - iconPadding,
|
|
1717
|
+
name: rightIcon,
|
|
1718
|
+
nameIOS: rightIconIOS,
|
|
1719
|
+
size: iconSize,
|
|
1720
|
+
pointerEvents: !onPressRightIcon ? "box-none" : void 0,
|
|
1721
|
+
padding: iconPadding,
|
|
1722
|
+
onPress: onPressRightIcon
|
|
1723
|
+
}
|
|
1724
|
+
)
|
|
1725
|
+
]
|
|
1572
1726
|
}
|
|
1573
1727
|
)
|
|
1574
1728
|
}
|
|
1575
1729
|
),
|
|
1576
|
-
suffix && /* @__PURE__ */ (0,
|
|
1730
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1577
1731
|
View_default,
|
|
1578
1732
|
{
|
|
1579
1733
|
isRow: true,
|
|
@@ -1587,19 +1741,19 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1587
1741
|
borderColor: theme2.colors.border,
|
|
1588
1742
|
paddingHorizontal: readyPaddingHorizontal,
|
|
1589
1743
|
onPress: onPressSuffix,
|
|
1590
|
-
children: typeof suffix === "string" ? /* @__PURE__ */ (0,
|
|
1744
|
+
children: typeof suffix === "string" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1591
1745
|
Text_default,
|
|
1592
1746
|
{
|
|
1593
1747
|
fontWeight: 700,
|
|
1594
1748
|
lineHeight,
|
|
1595
|
-
marginTop:
|
|
1749
|
+
marginTop: import_react_native9.Platform.OS === "ios" && onPressSuffix ? readyPaddingVertical : void 0,
|
|
1596
1750
|
children: suffix
|
|
1597
1751
|
}
|
|
1598
1752
|
) : suffix
|
|
1599
1753
|
}
|
|
1600
1754
|
)
|
|
1601
1755
|
] }),
|
|
1602
|
-
infoMessage && /* @__PURE__ */ (0,
|
|
1756
|
+
infoMessage && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1603
1757
|
Animate_default.Text,
|
|
1604
1758
|
{
|
|
1605
1759
|
fontSize: 14,
|
|
@@ -1611,7 +1765,7 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1611
1765
|
children: infoMessage
|
|
1612
1766
|
}
|
|
1613
1767
|
),
|
|
1614
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
1768
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1615
1769
|
Animate_default.Text,
|
|
1616
1770
|
{
|
|
1617
1771
|
fontSize: 14,
|
|
@@ -1628,8 +1782,8 @@ var InputFieldComponent = (0, import_react10.forwardRef)(
|
|
|
1628
1782
|
);
|
|
1629
1783
|
}
|
|
1630
1784
|
);
|
|
1631
|
-
InputFieldComponent.email = (0,
|
|
1632
|
-
return /* @__PURE__ */ (0,
|
|
1785
|
+
InputFieldComponent.email = (0, import_react12.forwardRef)(function Email(props, ref) {
|
|
1786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1633
1787
|
InputFieldComponent,
|
|
1634
1788
|
{
|
|
1635
1789
|
placeholder: "your@email.here",
|
|
@@ -1642,23 +1796,41 @@ InputFieldComponent.email = (0, import_react10.forwardRef)(function Email(props,
|
|
|
1642
1796
|
}
|
|
1643
1797
|
);
|
|
1644
1798
|
});
|
|
1645
|
-
InputFieldComponent.password = (0,
|
|
1646
|
-
|
|
1799
|
+
InputFieldComponent.password = (0, import_react12.forwardRef)(function Password(props, ref) {
|
|
1800
|
+
const inputFieldRef = (0, import_react12.useRef)(null);
|
|
1801
|
+
const [showPassword, setShowPassword] = (0, import_react_better_core10.useBooleanState)();
|
|
1802
|
+
const onPressEye = (0, import_react12.useCallback)(() => {
|
|
1803
|
+
setShowPassword.toggle();
|
|
1804
|
+
inputFieldRef.current?.focus();
|
|
1805
|
+
}, []);
|
|
1806
|
+
(0, import_react12.useImperativeHandle)(
|
|
1807
|
+
ref,
|
|
1808
|
+
() => {
|
|
1809
|
+
return inputFieldRef.current;
|
|
1810
|
+
},
|
|
1811
|
+
[]
|
|
1812
|
+
);
|
|
1813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1647
1814
|
InputFieldComponent,
|
|
1648
1815
|
{
|
|
1649
|
-
secureTextEntry:
|
|
1816
|
+
secureTextEntry: !showPassword,
|
|
1650
1817
|
placeholder: "******",
|
|
1651
1818
|
autoCapitalize: "none",
|
|
1652
1819
|
autoComplete: "password",
|
|
1653
1820
|
autoCorrect: false,
|
|
1821
|
+
rightIcon: showPassword ? "eyeDashed" : "eye",
|
|
1822
|
+
onPressRightIcon: onPressEye,
|
|
1654
1823
|
...props,
|
|
1655
|
-
ref
|
|
1824
|
+
ref: inputFieldRef
|
|
1656
1825
|
}
|
|
1657
1826
|
);
|
|
1658
1827
|
});
|
|
1659
|
-
InputFieldComponent.
|
|
1660
|
-
|
|
1661
|
-
|
|
1828
|
+
InputFieldComponent.search = (0, import_react12.forwardRef)(function Search(props, ref) {
|
|
1829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InputFieldComponent, { placeholder: "Search...", leftIcon: "magnifyingGlass", ...props, ref });
|
|
1830
|
+
});
|
|
1831
|
+
InputFieldComponent.code = (0, import_react12.forwardRef)(function Password2({ isSmall, ...props }, ref) {
|
|
1832
|
+
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
1833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1662
1834
|
InputFieldComponent,
|
|
1663
1835
|
{
|
|
1664
1836
|
flex: 1,
|
|
@@ -1673,29 +1845,30 @@ InputFieldComponent.code = (0, import_react10.forwardRef)(function Password2({ i
|
|
|
1673
1845
|
}
|
|
1674
1846
|
);
|
|
1675
1847
|
});
|
|
1676
|
-
var InputField = (0,
|
|
1848
|
+
var InputField = (0, import_react12.memo)(InputFieldComponent);
|
|
1677
1849
|
InputField.email = InputFieldComponent.email;
|
|
1678
1850
|
InputField.password = InputFieldComponent.password;
|
|
1851
|
+
InputField.search = InputFieldComponent.search;
|
|
1679
1852
|
InputField.code = InputFieldComponent.code;
|
|
1680
1853
|
var InputField_default = InputField;
|
|
1681
1854
|
|
|
1682
1855
|
// src/components/StatusBar.tsx
|
|
1683
|
-
var
|
|
1684
|
-
var
|
|
1685
|
-
var
|
|
1686
|
-
var
|
|
1856
|
+
var import_react13 = require("react");
|
|
1857
|
+
var import_react_better_core11 = require("react-better-core");
|
|
1858
|
+
var import_react_native10 = require("react-native");
|
|
1859
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1687
1860
|
function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }) {
|
|
1688
|
-
const theme2 = (0,
|
|
1689
|
-
return /* @__PURE__ */ (0,
|
|
1690
|
-
|
|
1861
|
+
const theme2 = (0, import_react_better_core11.useTheme)();
|
|
1862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1863
|
+
import_react_native10.StatusBar,
|
|
1691
1864
|
{
|
|
1692
1865
|
backgroundColor: darkStatusBar ? theme2.colors.backgroundSecondary : void 0,
|
|
1693
|
-
barStyle: barStyle ?? (
|
|
1866
|
+
barStyle: barStyle ?? (import_react_native10.Platform.OS === "android" ? androidBarStyle : iOSBarStyle),
|
|
1694
1867
|
hidden
|
|
1695
1868
|
}
|
|
1696
1869
|
);
|
|
1697
1870
|
}
|
|
1698
|
-
var StatusBar_default = (0,
|
|
1871
|
+
var StatusBar_default = (0, import_react13.memo)(StatusBar);
|
|
1699
1872
|
|
|
1700
1873
|
// src/plugins/asyncStorage.ts
|
|
1701
1874
|
var defaultAsyncStoragePluginOptions = {};
|
|
@@ -1714,6 +1887,7 @@ var asyncStoragePlugin = (options) => ({
|
|
|
1714
1887
|
Animate,
|
|
1715
1888
|
BetterComponentsProvider,
|
|
1716
1889
|
Button,
|
|
1890
|
+
Icon,
|
|
1717
1891
|
Image,
|
|
1718
1892
|
InputField,
|
|
1719
1893
|
Loader,
|
|
@@ -1743,6 +1917,7 @@ var asyncStoragePlugin = (options) => ({
|
|
|
1743
1917
|
useBooleanState,
|
|
1744
1918
|
useDebounceState,
|
|
1745
1919
|
useDevice,
|
|
1920
|
+
useEventEmitter,
|
|
1746
1921
|
useForm,
|
|
1747
1922
|
useKeyboard,
|
|
1748
1923
|
useLoader,
|