react-native-better-html 1.0.18 → 1.0.19
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 +54 -7
- package/dist/index.d.ts +54 -7
- package/dist/index.js +875 -590
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +758 -474
- 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 useTheme15,
|
|
4
4
|
useLoader as useLoader2,
|
|
5
5
|
useLoaderControls,
|
|
6
6
|
countries,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
darkenColor as darkenColor2,
|
|
9
9
|
saturateColor,
|
|
10
10
|
desaturateColor,
|
|
11
|
-
generateRandomString,
|
|
11
|
+
generateRandomString as generateRandomString3,
|
|
12
12
|
formatPhoneNumber,
|
|
13
13
|
eventPreventDefault,
|
|
14
14
|
eventStopPropagation,
|
|
@@ -21,15 +21,16 @@ import {
|
|
|
21
21
|
} from "react-better-core";
|
|
22
22
|
|
|
23
23
|
// src/components/BetterComponentsProvider.tsx
|
|
24
|
-
import { createContext, memo, useContext, useEffect, useMemo } from "react";
|
|
24
|
+
import { createContext, memo as memo10, useCallback as useCallback4, useContext, useEffect as useEffect5, useMemo as useMemo7, useState as useState2 } from "react";
|
|
25
25
|
import {
|
|
26
|
-
useBooleanState,
|
|
27
26
|
BetterCoreProvider,
|
|
28
|
-
useBetterCoreContext
|
|
27
|
+
useBetterCoreContext as useBetterCoreContext3,
|
|
28
|
+
generateRandomString as generateRandomString2
|
|
29
29
|
} from "react-better-core";
|
|
30
30
|
|
|
31
31
|
// src/constants/app.ts
|
|
32
32
|
var appConfig = {};
|
|
33
|
+
var defaultAlertDuration = 2.3 * 1e3;
|
|
33
34
|
|
|
34
35
|
// src/constants/theme.ts
|
|
35
36
|
var theme = {};
|
|
@@ -71,115 +72,15 @@ var icons = {
|
|
|
71
72
|
// src/constants/assets.ts
|
|
72
73
|
var assets = {};
|
|
73
74
|
|
|
74
|
-
// src/components/
|
|
75
|
-
import {
|
|
76
|
-
|
|
77
|
-
var externalBetterCoreContextValue;
|
|
78
|
-
var externalBetterComponentsContextValue;
|
|
79
|
-
var useBetterComponentsContext = () => {
|
|
80
|
-
const coreContext = useBetterCoreContext();
|
|
81
|
-
const context = useContext(betterComponentsContext);
|
|
82
|
-
if (context === void 0)
|
|
83
|
-
throw new Error(
|
|
84
|
-
"`useBetterComponentsContext()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
85
|
-
);
|
|
86
|
-
const { plugins, componentsState, ...rest } = context;
|
|
87
|
-
return {
|
|
88
|
-
...coreContext,
|
|
89
|
-
...rest
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
function BetterComponentsProviderInternalContent({ children }) {
|
|
93
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
94
|
-
}
|
|
95
|
-
function BetterComponentsProviderInternal({
|
|
96
|
-
config,
|
|
97
|
-
plugins,
|
|
98
|
-
children
|
|
99
|
-
}) {
|
|
100
|
-
const betterCoreContext = useBetterCoreContext();
|
|
101
|
-
const [sideMenuIsCollapsed, setSideMenuIsCollapsed] = useBooleanState();
|
|
102
|
-
const [sideMenuIsOpenMobile, setSideMenuIsOpenMobile] = useBooleanState();
|
|
103
|
-
const readyConfig = useMemo(
|
|
104
|
-
() => ({
|
|
105
|
-
app: {
|
|
106
|
-
...appConfig,
|
|
107
|
-
...config?.app
|
|
108
|
-
},
|
|
109
|
-
sideMenuIsCollapsed,
|
|
110
|
-
setSideMenuIsCollapsed,
|
|
111
|
-
sideMenuIsOpenMobile,
|
|
112
|
-
setSideMenuIsOpenMobile,
|
|
113
|
-
plugins: plugins ?? [],
|
|
114
|
-
componentsState: {}
|
|
115
|
-
}),
|
|
116
|
-
[config, sideMenuIsCollapsed, sideMenuIsOpenMobile, plugins]
|
|
117
|
-
);
|
|
118
|
-
useEffect(() => {
|
|
119
|
-
if (!plugins) return;
|
|
120
|
-
plugins.forEach((plugin) => {
|
|
121
|
-
plugin.initialize?.();
|
|
122
|
-
});
|
|
123
|
-
}, []);
|
|
124
|
-
externalBetterCoreContextValue = betterCoreContext;
|
|
125
|
-
externalBetterComponentsContextValue = readyConfig;
|
|
126
|
-
return /* @__PURE__ */ jsx(betterComponentsContext.Provider, { value: readyConfig, children: /* @__PURE__ */ jsx(BetterComponentsProviderInternalContent, { children }) });
|
|
127
|
-
}
|
|
128
|
-
function BetterComponentsProvider({ config, ...props }) {
|
|
129
|
-
const coreConfig = useMemo(
|
|
130
|
-
() => ({
|
|
131
|
-
theme: {
|
|
132
|
-
...theme,
|
|
133
|
-
...config?.theme
|
|
134
|
-
},
|
|
135
|
-
// colorTheme: config?.colorTheme ?? (localStorage.getItem("theme") === "dark" ? "dark" : "light"),
|
|
136
|
-
colorTheme: config?.colorTheme ?? "light",
|
|
137
|
-
icons: {
|
|
138
|
-
...icons,
|
|
139
|
-
...config?.icons
|
|
140
|
-
},
|
|
141
|
-
assets: {
|
|
142
|
-
...assets,
|
|
143
|
-
...config?.assets
|
|
144
|
-
},
|
|
145
|
-
loaders: config?.loaders
|
|
146
|
-
}),
|
|
147
|
-
[config]
|
|
148
|
-
);
|
|
149
|
-
const componentsConfig = useMemo(
|
|
150
|
-
() => ({
|
|
151
|
-
app: config?.app
|
|
152
|
-
}),
|
|
153
|
-
[config]
|
|
154
|
-
);
|
|
155
|
-
return /* @__PURE__ */ jsx(BetterCoreProvider, { config: coreConfig, children: /* @__PURE__ */ jsx(BetterComponentsProviderInternal, { config: componentsConfig, ...props }) });
|
|
156
|
-
}
|
|
157
|
-
var BetterComponentsProvider_default = memo(BetterComponentsProvider);
|
|
158
|
-
|
|
159
|
-
// src/utils/variableFunctions.ts
|
|
160
|
-
var checkBetterCoreContextValue = (value, functionsName) => {
|
|
161
|
-
if (value === void 0) {
|
|
162
|
-
throw new Error(
|
|
163
|
-
`\`${functionsName}()\` must be used within a \`<BetterCoreProvider>\`. Make sure to add one at the root of your component tree.`
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
return value !== void 0;
|
|
167
|
-
};
|
|
168
|
-
var pressStrength = () => {
|
|
169
|
-
if (!checkBetterCoreContextValue(externalBetterCoreContextValue, "pressStrength")) return void 0;
|
|
170
|
-
return {
|
|
171
|
-
p05: externalBetterCoreContextValue.colorTheme === "dark" ? 0.85 : 0.95,
|
|
172
|
-
p1: externalBetterCoreContextValue.colorTheme === "dark" ? 0.6 : 0.8,
|
|
173
|
-
p2: externalBetterCoreContextValue.colorTheme === "dark" ? 0.5 : 0.7,
|
|
174
|
-
p3: externalBetterCoreContextValue.colorTheme === "dark" ? 0.4 : 0.6
|
|
175
|
-
};
|
|
176
|
-
};
|
|
75
|
+
// src/components/alerts/AlertsHolder.tsx
|
|
76
|
+
import { memo as memo9 } from "react";
|
|
77
|
+
import { useTheme as useTheme9 } from "react-better-core";
|
|
177
78
|
|
|
178
79
|
// src/utils/hooks.ts
|
|
179
|
-
import { useCallback, useEffect
|
|
80
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
180
81
|
import { DeviceEventEmitter, Dimensions, Keyboard } from "react-native";
|
|
181
82
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
182
|
-
import { useBooleanState
|
|
83
|
+
import { useBooleanState, useTheme } from "react-better-core";
|
|
183
84
|
|
|
184
85
|
// src/constants/css.ts
|
|
185
86
|
var cssProps = /* @__PURE__ */ new Set([
|
|
@@ -397,10 +298,10 @@ function useDevice() {
|
|
|
397
298
|
};
|
|
398
299
|
}
|
|
399
300
|
function useKeyboard() {
|
|
400
|
-
const [keyboardOpened, setKeyboardOpened] =
|
|
401
|
-
const [keyboardWillOpen, setKeyboardWillOpen] =
|
|
301
|
+
const [keyboardOpened, setKeyboardOpened] = useBooleanState();
|
|
302
|
+
const [keyboardWillOpen, setKeyboardWillOpen] = useBooleanState();
|
|
402
303
|
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
403
|
-
|
|
304
|
+
useEffect(() => {
|
|
404
305
|
const keyboardDidShow = (event) => {
|
|
405
306
|
setKeyboardOpened.setTrue();
|
|
406
307
|
setKeyboardHeight(event.endCoordinates.height);
|
|
@@ -427,7 +328,7 @@ function useKeyboard() {
|
|
|
427
328
|
};
|
|
428
329
|
}
|
|
429
330
|
function useComponentPropsGrouper(props, prefix) {
|
|
430
|
-
return
|
|
331
|
+
return useMemo(() => {
|
|
431
332
|
const style = {};
|
|
432
333
|
const withPrefixStyle = {};
|
|
433
334
|
const restProps = {};
|
|
@@ -458,7 +359,7 @@ function useForm(options) {
|
|
|
458
359
|
);
|
|
459
360
|
const [values, setValues] = useState(defaultValues);
|
|
460
361
|
const [errors, setErrors] = useState({});
|
|
461
|
-
const [isSubmitting, setIsSubmitting] =
|
|
362
|
+
const [isSubmitting, setIsSubmitting] = useBooleanState();
|
|
462
363
|
const numberOfInputFields = Object.keys(defaultValues).length;
|
|
463
364
|
const setFieldValue = useCallback(
|
|
464
365
|
(field, value) => {
|
|
@@ -555,15 +456,15 @@ function useForm(options) {
|
|
|
555
456
|
setValues(defaultValues);
|
|
556
457
|
setErrors({});
|
|
557
458
|
}, [defaultValues]);
|
|
558
|
-
const isDirty =
|
|
459
|
+
const isDirty = useMemo(
|
|
559
460
|
() => Object.keys(defaultValues).some((key) => defaultValues[key] !== values[key]),
|
|
560
461
|
[defaultValues, values]
|
|
561
462
|
);
|
|
562
|
-
const isValid =
|
|
463
|
+
const isValid = useMemo(() => {
|
|
563
464
|
const validationErrors = validate?.(values) || {};
|
|
564
465
|
return Object.keys(validationErrors).length === 0;
|
|
565
466
|
}, [validate, values]);
|
|
566
|
-
const canSubmit =
|
|
467
|
+
const canSubmit = useMemo(() => {
|
|
567
468
|
const requiredFieldsHaveValues = requiredFields?.every((field) => values[field] !== void 0 && values[field] !== "") ?? true;
|
|
568
469
|
return isValid && requiredFieldsHaveValues;
|
|
569
470
|
}, [isValid, requiredFields]);
|
|
@@ -598,39 +499,8 @@ function useEventEmitter() {
|
|
|
598
499
|
};
|
|
599
500
|
}
|
|
600
501
|
|
|
601
|
-
// src/utils/functions.ts
|
|
602
|
-
var getFormErrorObject = (formValues) => {
|
|
603
|
-
return {};
|
|
604
|
-
};
|
|
605
|
-
|
|
606
|
-
// src/utils/asyncStorage.ts
|
|
607
|
-
import NativeAsyncStorage from "@react-native-async-storage/async-storage";
|
|
608
|
-
function generateAsyncStorage() {
|
|
609
|
-
return {
|
|
610
|
-
setItem: async (name, value) => {
|
|
611
|
-
if (value) await NativeAsyncStorage.setItem(name.toString(), JSON.stringify(value));
|
|
612
|
-
else await NativeAsyncStorage.removeItem(name.toString());
|
|
613
|
-
},
|
|
614
|
-
getItem: async (name) => {
|
|
615
|
-
const item = await NativeAsyncStorage.getItem(name.toString());
|
|
616
|
-
if (item === null) return void 0;
|
|
617
|
-
try {
|
|
618
|
-
return JSON.parse(item);
|
|
619
|
-
} catch (error) {
|
|
620
|
-
return void 0;
|
|
621
|
-
}
|
|
622
|
-
},
|
|
623
|
-
removeItem: async (name) => {
|
|
624
|
-
await NativeAsyncStorage.removeItem(name.toString());
|
|
625
|
-
},
|
|
626
|
-
removeAllItems: () => {
|
|
627
|
-
NativeAsyncStorage.clear();
|
|
628
|
-
}
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
|
|
632
502
|
// src/components/View.tsx
|
|
633
|
-
import { memo
|
|
503
|
+
import { memo, useMemo as useMemo2 } from "react";
|
|
634
504
|
import {
|
|
635
505
|
View as NativeView,
|
|
636
506
|
Platform,
|
|
@@ -639,7 +509,7 @@ import {
|
|
|
639
509
|
TouchableOpacity
|
|
640
510
|
} from "react-native";
|
|
641
511
|
import { useTheme as useTheme2 } from "react-better-core";
|
|
642
|
-
import { Fragment
|
|
512
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
643
513
|
var touchableHighlightStyleMoveToContent = [
|
|
644
514
|
"width",
|
|
645
515
|
"backgroundColor",
|
|
@@ -692,7 +562,7 @@ var ViewComponent = function View({
|
|
|
692
562
|
...props
|
|
693
563
|
}) {
|
|
694
564
|
const theme2 = useTheme2();
|
|
695
|
-
const style =
|
|
565
|
+
const style = useMemo2(
|
|
696
566
|
() => ({
|
|
697
567
|
flexDirection: isRow ? "row" : "column",
|
|
698
568
|
...props,
|
|
@@ -705,7 +575,7 @@ var ViewComponent = function View({
|
|
|
705
575
|
}),
|
|
706
576
|
[isRow, props]
|
|
707
577
|
);
|
|
708
|
-
const touchableHighlightStyle =
|
|
578
|
+
const touchableHighlightStyle = useMemo2(
|
|
709
579
|
() => ({
|
|
710
580
|
...style,
|
|
711
581
|
...touchableHighlightStyleMoveToContent.reduce((previousValue, currentValue) => {
|
|
@@ -718,21 +588,21 @@ var ViewComponent = function View({
|
|
|
718
588
|
}),
|
|
719
589
|
[style]
|
|
720
590
|
);
|
|
721
|
-
const touchableHighlightContentProps =
|
|
591
|
+
const touchableHighlightContentProps = useMemo2(
|
|
722
592
|
() => touchableHighlightStyleMoveToContent.reduce((previousValue, currentValue) => {
|
|
723
593
|
previousValue[currentValue] = props[currentValue];
|
|
724
594
|
return previousValue;
|
|
725
595
|
}, {}),
|
|
726
596
|
[props]
|
|
727
597
|
);
|
|
728
|
-
const touchableNativeFeedbackHolderStyle =
|
|
598
|
+
const touchableNativeFeedbackHolderStyle = useMemo2(
|
|
729
599
|
() => touchableNativeFeedbackStyleMoveToHolder.reduce((previousValue, currentValue) => {
|
|
730
600
|
previousValue[currentValue] = props[currentValue];
|
|
731
601
|
return previousValue;
|
|
732
602
|
}, {}),
|
|
733
603
|
[props]
|
|
734
604
|
);
|
|
735
|
-
const touchableNativeFeedbackContentStyle =
|
|
605
|
+
const touchableNativeFeedbackContentStyle = useMemo2(
|
|
736
606
|
() => ({
|
|
737
607
|
...style,
|
|
738
608
|
...touchableNativeFeedbackStyleMoveToHolder.reduce(
|
|
@@ -747,7 +617,7 @@ var ViewComponent = function View({
|
|
|
747
617
|
}),
|
|
748
618
|
[style]
|
|
749
619
|
);
|
|
750
|
-
const pressEvents =
|
|
620
|
+
const pressEvents = useMemo2(
|
|
751
621
|
() => !disabled ? {
|
|
752
622
|
onPress: (event) => {
|
|
753
623
|
onPress?.(event);
|
|
@@ -761,7 +631,7 @@ var ViewComponent = function View({
|
|
|
761
631
|
);
|
|
762
632
|
const androidBoxShadow = Platform.OS === "android" ? props.shadowOffsetWidth !== void 0 || props.shadowOffsetHeight !== void 0 ? `${props.shadowOffsetWidth ?? 0}px ${props.shadowOffsetHeight ?? 0}px ${props.shadowRadius}px ${props.shadowColor?.toString() ?? "#000000"}` : void 0 : void 0;
|
|
763
633
|
const isPressable = onPress || onPressIn || onPressOut || onLongPress || onPressWithValue;
|
|
764
|
-
return isPressable ? pressType === "opacity" ? /* @__PURE__ */
|
|
634
|
+
return isPressable ? pressType === "opacity" ? /* @__PURE__ */ jsx(
|
|
765
635
|
TouchableOpacity,
|
|
766
636
|
{
|
|
767
637
|
style,
|
|
@@ -771,7 +641,7 @@ var ViewComponent = function View({
|
|
|
771
641
|
...props,
|
|
772
642
|
children
|
|
773
643
|
}
|
|
774
|
-
) : pressType === "highlight" ? Platform.OS === "ios" ? /* @__PURE__ */
|
|
644
|
+
) : pressType === "highlight" ? Platform.OS === "ios" ? /* @__PURE__ */ jsx(
|
|
775
645
|
TouchableHighlight,
|
|
776
646
|
{
|
|
777
647
|
activeOpacity: pressStrength2,
|
|
@@ -779,7 +649,7 @@ var ViewComponent = function View({
|
|
|
779
649
|
style: touchableHighlightStyle,
|
|
780
650
|
...pressEvents,
|
|
781
651
|
...props,
|
|
782
|
-
children: /* @__PURE__ */
|
|
652
|
+
children: /* @__PURE__ */ jsx(
|
|
783
653
|
ViewComponent,
|
|
784
654
|
{
|
|
785
655
|
width: "100%",
|
|
@@ -794,7 +664,7 @@ var ViewComponent = function View({
|
|
|
794
664
|
}
|
|
795
665
|
)
|
|
796
666
|
}
|
|
797
|
-
) : Platform.OS === "android" ? /* @__PURE__ */
|
|
667
|
+
) : Platform.OS === "android" ? /* @__PURE__ */ jsx(
|
|
798
668
|
ViewComponent,
|
|
799
669
|
{
|
|
800
670
|
...touchableNativeFeedbackHolderStyle,
|
|
@@ -806,7 +676,7 @@ var ViewComponent = function View({
|
|
|
806
676
|
boxShadow: androidBoxShadow,
|
|
807
677
|
overflow: "hidden",
|
|
808
678
|
pointerEvents: "box-none",
|
|
809
|
-
children: /* @__PURE__ */
|
|
679
|
+
children: /* @__PURE__ */ jsx(
|
|
810
680
|
TouchableNativeFeedback,
|
|
811
681
|
{
|
|
812
682
|
...pressEvents,
|
|
@@ -817,15 +687,15 @@ var ViewComponent = function View({
|
|
|
817
687
|
),
|
|
818
688
|
useForeground: true,
|
|
819
689
|
touchSoundDisabled: true,
|
|
820
|
-
children: /* @__PURE__ */
|
|
690
|
+
children: /* @__PURE__ */ jsx(ViewComponent, { flex: 1, ...touchableNativeFeedbackContentStyle, children })
|
|
821
691
|
}
|
|
822
692
|
)
|
|
823
693
|
}
|
|
824
|
-
) : /* @__PURE__ */
|
|
694
|
+
) : /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsx(NativeView, { boxShadow: androidBoxShadow, style, ...props, children });
|
|
825
695
|
};
|
|
826
696
|
ViewComponent.box = function Box({ withShadow, ...props }) {
|
|
827
697
|
const theme2 = useTheme2();
|
|
828
|
-
const shadowProps =
|
|
698
|
+
const shadowProps = useMemo2(
|
|
829
699
|
() => withShadow ? {
|
|
830
700
|
shadowOpacity: 0.2,
|
|
831
701
|
shadowOffsetHeight: 10,
|
|
@@ -834,7 +704,7 @@ ViewComponent.box = function Box({ withShadow, ...props }) {
|
|
|
834
704
|
} : {},
|
|
835
705
|
[]
|
|
836
706
|
);
|
|
837
|
-
return /* @__PURE__ */
|
|
707
|
+
return /* @__PURE__ */ jsx(
|
|
838
708
|
ViewComponent,
|
|
839
709
|
{
|
|
840
710
|
width: "100%",
|
|
@@ -849,18 +719,52 @@ ViewComponent.box = function Box({ withShadow, ...props }) {
|
|
|
849
719
|
}
|
|
850
720
|
);
|
|
851
721
|
};
|
|
852
|
-
var View2 =
|
|
722
|
+
var View2 = memo(ViewComponent);
|
|
853
723
|
View2.box = ViewComponent.box;
|
|
854
724
|
var View_default = View2;
|
|
855
725
|
|
|
726
|
+
// src/components/alerts/Alert.tsx
|
|
727
|
+
import { memo as memo8, useCallback as useCallback3, useEffect as useEffect4, useMemo as useMemo6, useRef as useRef2 } from "react";
|
|
728
|
+
import { useBooleanState as useBooleanState2, useTheme as useTheme8 } from "react-better-core";
|
|
729
|
+
|
|
730
|
+
// src/plugins/alerts.ts
|
|
731
|
+
var defaultAlertsPluginOptions = {
|
|
732
|
+
align: "right",
|
|
733
|
+
defaultDuration: "auto",
|
|
734
|
+
defaultDisplay: {},
|
|
735
|
+
withCloseButton: true
|
|
736
|
+
};
|
|
737
|
+
var alertsPlugin = (options) => ({
|
|
738
|
+
name: "alerts",
|
|
739
|
+
initialize: () => {
|
|
740
|
+
},
|
|
741
|
+
getConfig: () => ({
|
|
742
|
+
...defaultAlertsPluginOptions,
|
|
743
|
+
...options
|
|
744
|
+
})
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
// src/plugins/asyncStorage.ts
|
|
748
|
+
var defaultAsyncStoragePluginOptions = {};
|
|
749
|
+
var asyncStoragePlugin = (options) => ({
|
|
750
|
+
name: "asyncStorage",
|
|
751
|
+
initialize: () => {
|
|
752
|
+
console.log("asyncStorage plugin initialized");
|
|
753
|
+
},
|
|
754
|
+
getConfig: () => ({
|
|
755
|
+
...defaultAsyncStoragePluginOptions,
|
|
756
|
+
...options
|
|
757
|
+
})
|
|
758
|
+
});
|
|
759
|
+
|
|
856
760
|
// src/components/Text.tsx
|
|
857
|
-
import { memo as
|
|
761
|
+
import { memo as memo2, useMemo as useMemo3 } from "react";
|
|
858
762
|
import { Text as NativeText } from "react-native";
|
|
859
763
|
import { useTheme as useTheme3 } from "react-better-core";
|
|
860
|
-
import { jsx as
|
|
764
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
861
765
|
var TextComponent = function Text({ selectionColor, children, ...props }) {
|
|
862
766
|
const theme2 = useTheme3();
|
|
863
|
-
const style =
|
|
767
|
+
const style = useMemo3(
|
|
864
768
|
() => ({
|
|
865
769
|
fontSize: 16,
|
|
866
770
|
color: theme2.colors.textPrimary,
|
|
@@ -868,27 +772,27 @@ var TextComponent = function Text({ selectionColor, children, ...props }) {
|
|
|
868
772
|
}),
|
|
869
773
|
[theme2, props]
|
|
870
774
|
);
|
|
871
|
-
return /* @__PURE__ */
|
|
775
|
+
return /* @__PURE__ */ jsx2(NativeText, { selectionColor: selectionColor ?? theme2.colors.primary, style, ...props, children });
|
|
872
776
|
};
|
|
873
777
|
TextComponent.title = function Title(props) {
|
|
874
|
-
return /* @__PURE__ */
|
|
778
|
+
return /* @__PURE__ */ jsx2(TextComponent, { fontSize: 32, fontWeight: 700, ...props });
|
|
875
779
|
};
|
|
876
780
|
TextComponent.subtitle = function Subtitle(props) {
|
|
877
|
-
return /* @__PURE__ */
|
|
781
|
+
return /* @__PURE__ */ jsx2(TextComponent, { fontSize: 24, fontWeight: 700, ...props });
|
|
878
782
|
};
|
|
879
783
|
TextComponent.body = function Body(props) {
|
|
880
784
|
const theme2 = useTheme3();
|
|
881
|
-
return /* @__PURE__ */
|
|
785
|
+
return /* @__PURE__ */ jsx2(TextComponent, { color: theme2.colors.textSecondary, ...props });
|
|
882
786
|
};
|
|
883
787
|
TextComponent.caption = function Caption(props) {
|
|
884
788
|
const theme2 = useTheme3();
|
|
885
|
-
return /* @__PURE__ */
|
|
789
|
+
return /* @__PURE__ */ jsx2(TextComponent, { fontSize: 14, color: theme2.colors.textSecondary, ...props });
|
|
886
790
|
};
|
|
887
791
|
TextComponent.unknown = function Unknown(props) {
|
|
888
792
|
const theme2 = useTheme3();
|
|
889
|
-
return /* @__PURE__ */
|
|
793
|
+
return /* @__PURE__ */ jsx2(TextComponent, { fontStyle: "italic", textAlign: "center", color: theme2.colors.textSecondary, ...props });
|
|
890
794
|
};
|
|
891
|
-
var Text2 =
|
|
795
|
+
var Text2 = memo2(TextComponent);
|
|
892
796
|
Text2.title = TextComponent.title;
|
|
893
797
|
Text2.subtitle = TextComponent.subtitle;
|
|
894
798
|
Text2.body = TextComponent.body;
|
|
@@ -896,13 +800,116 @@ Text2.caption = TextComponent.caption;
|
|
|
896
800
|
Text2.unknown = TextComponent.unknown;
|
|
897
801
|
var Text_default = Text2;
|
|
898
802
|
|
|
899
|
-
// src/components/
|
|
900
|
-
import { memo as
|
|
803
|
+
// src/components/Icon.tsx
|
|
804
|
+
import { memo as memo3, useEffect as useEffect2 } from "react";
|
|
901
805
|
import { Platform as Platform2 } from "react-native";
|
|
902
|
-
import {
|
|
806
|
+
import { Path, Svg } from "react-native-svg";
|
|
807
|
+
import { useBetterCoreContext, useTheme as useTheme4 } from "react-better-core";
|
|
808
|
+
import { SymbolView } from "expo-symbols";
|
|
809
|
+
|
|
810
|
+
// src/utils/variableFunctions.ts
|
|
811
|
+
import { generateRandomString } from "react-better-core";
|
|
812
|
+
var checkBetterCoreContextValue = (value, functionsName) => {
|
|
813
|
+
if (value === void 0) {
|
|
814
|
+
throw new Error(
|
|
815
|
+
`\`${functionsName}()\` must be used within a \`<BetterCoreProvider>\`. Make sure to add one at the root of your component tree.`
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
return value !== void 0;
|
|
819
|
+
};
|
|
820
|
+
var checkBetterComponentsContextValue = (value, functionsName) => {
|
|
821
|
+
if (value === void 0) {
|
|
822
|
+
throw new Error(
|
|
823
|
+
`\`${functionsName}()\` must be used within a \`<BetterComponentsProvider>\`. Make sure to add one at the root of your component tree.`
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
return value !== void 0;
|
|
827
|
+
};
|
|
828
|
+
var alertControls = {
|
|
829
|
+
createAlert: (alert) => {
|
|
830
|
+
if (!checkBetterComponentsContextValue(externalBetterComponentsContextValue, "alertControls.createAlert"))
|
|
831
|
+
return void 0;
|
|
832
|
+
const readyAlert = {
|
|
833
|
+
id: generateRandomString(36),
|
|
834
|
+
...alert
|
|
835
|
+
};
|
|
836
|
+
externalBetterComponentsContextValue.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
837
|
+
return readyAlert;
|
|
838
|
+
},
|
|
839
|
+
removeAlert: (alertId) => {
|
|
840
|
+
if (!checkBetterComponentsContextValue(externalBetterComponentsContextValue, "alertControls.removeAlert"))
|
|
841
|
+
return;
|
|
842
|
+
externalBetterComponentsContextValue.setAlerts(
|
|
843
|
+
(oldValue) => oldValue.filter((alert) => alert.id !== alertId)
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
var pressStrength = () => {
|
|
848
|
+
if (!checkBetterCoreContextValue(externalBetterCoreContextValue, "pressStrength")) return void 0;
|
|
849
|
+
return {
|
|
850
|
+
p05: externalBetterCoreContextValue.colorTheme === "dark" ? 0.85 : 0.95,
|
|
851
|
+
p1: externalBetterCoreContextValue.colorTheme === "dark" ? 0.6 : 0.8,
|
|
852
|
+
p2: externalBetterCoreContextValue.colorTheme === "dark" ? 0.5 : 0.7,
|
|
853
|
+
p3: externalBetterCoreContextValue.colorTheme === "dark" ? 0.4 : 0.6
|
|
854
|
+
};
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
// src/components/Icon.tsx
|
|
858
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
859
|
+
import { createElement } from "react";
|
|
860
|
+
function Icon({ name, nameIOS, size = 16, color, ...props }) {
|
|
861
|
+
const theme2 = useTheme4();
|
|
862
|
+
const { icons: icons2 } = useBetterCoreContext();
|
|
863
|
+
const svgColor = color ?? theme2.colors.textPrimary;
|
|
864
|
+
useEffect2(() => {
|
|
865
|
+
if (!icons2[name.toString()])
|
|
866
|
+
console.warn(
|
|
867
|
+
`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.`
|
|
868
|
+
);
|
|
869
|
+
}, [icons2, name]);
|
|
870
|
+
return /* @__PURE__ */ jsx3(
|
|
871
|
+
View_default,
|
|
872
|
+
{
|
|
873
|
+
width: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingHorizontal?.toString() ?? "0") ?? 0),
|
|
874
|
+
height: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingVertical?.toString() ?? "0") ?? 0),
|
|
875
|
+
alignItems: "center",
|
|
876
|
+
justifyContent: "center",
|
|
877
|
+
pressType: "opacity",
|
|
878
|
+
pressStrength: pressStrength().p2,
|
|
879
|
+
...props,
|
|
880
|
+
children: Platform2.OS === "ios" && nameIOS ? /* @__PURE__ */ jsx3(SymbolView, { name: nameIOS, tintColor: svgColor, size: size * 1.12 }) : /* @__PURE__ */ jsx3(
|
|
881
|
+
Svg,
|
|
882
|
+
{
|
|
883
|
+
width: size,
|
|
884
|
+
height: size,
|
|
885
|
+
viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
|
|
886
|
+
fill: "none",
|
|
887
|
+
children: icons2[name.toString()]?.paths.map(({ type, ...path }) => /* @__PURE__ */ createElement(
|
|
888
|
+
Path,
|
|
889
|
+
{
|
|
890
|
+
...path,
|
|
891
|
+
fill: type === "fill" ? svgColor : void 0,
|
|
892
|
+
stroke: type === "stroke" ? svgColor : void 0,
|
|
893
|
+
key: path.d
|
|
894
|
+
}
|
|
895
|
+
))
|
|
896
|
+
}
|
|
897
|
+
)
|
|
898
|
+
}
|
|
899
|
+
);
|
|
900
|
+
}
|
|
901
|
+
var Icon_default = memo3(Icon);
|
|
902
|
+
|
|
903
|
+
// src/components/Button.tsx
|
|
904
|
+
import { memo as memo7, useCallback as useCallback2 } from "react";
|
|
905
|
+
import { Platform as Platform3 } from "react-native";
|
|
906
|
+
import {
|
|
907
|
+
useLoader,
|
|
908
|
+
useTheme as useTheme7
|
|
909
|
+
} from "react-better-core";
|
|
903
910
|
|
|
904
911
|
// src/components/Animate.tsx
|
|
905
|
-
import { memo as memo4, useMemo as
|
|
912
|
+
import { memo as memo4, useMemo as useMemo4 } from "react";
|
|
906
913
|
import { Motion } from "@legendapp/motion";
|
|
907
914
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
908
915
|
var defaultTransitionDuration = 0.15 * 1e3;
|
|
@@ -912,7 +919,7 @@ var Animate = {
|
|
|
912
919
|
const animateProps2 = useComponentPropsGrouper(props, "animate");
|
|
913
920
|
const whileTapProps = useComponentPropsGrouper(props, "whileTap");
|
|
914
921
|
const transitionProps = useComponentPropsGrouper(props, "transition");
|
|
915
|
-
const transition =
|
|
922
|
+
const transition = useMemo4(
|
|
916
923
|
() => ({
|
|
917
924
|
type: "timing",
|
|
918
925
|
duration: defaultTransitionDuration,
|
|
@@ -920,7 +927,7 @@ var Animate = {
|
|
|
920
927
|
}),
|
|
921
928
|
[transitionProps.withPrefixStyle]
|
|
922
929
|
);
|
|
923
|
-
const transformOrigin =
|
|
930
|
+
const transformOrigin = useMemo4(
|
|
924
931
|
() => transformOriginX !== void 0 || transformOriginY !== void 0 ? {
|
|
925
932
|
x: transformOriginX ?? 0,
|
|
926
933
|
y: transformOriginY ?? 0
|
|
@@ -946,7 +953,7 @@ var Animate = {
|
|
|
946
953
|
const animateProps2 = useComponentPropsGrouper(props, "animate");
|
|
947
954
|
const whileTapProps = useComponentPropsGrouper(props, "whileTap");
|
|
948
955
|
const transitionProps = useComponentPropsGrouper(props, "transition");
|
|
949
|
-
const transition =
|
|
956
|
+
const transition = useMemo4(
|
|
950
957
|
() => ({
|
|
951
958
|
type: "timing",
|
|
952
959
|
duration: defaultTransitionDuration,
|
|
@@ -954,7 +961,7 @@ var Animate = {
|
|
|
954
961
|
}),
|
|
955
962
|
[transitionProps.withPrefixStyle]
|
|
956
963
|
);
|
|
957
|
-
const transformOrigin =
|
|
964
|
+
const transformOrigin = useMemo4(
|
|
958
965
|
() => transformOriginX !== void 0 || transformOriginY !== void 0 ? {
|
|
959
966
|
x: transformOriginX ?? 0,
|
|
960
967
|
y: transformOriginY ?? 0
|
|
@@ -981,14 +988,14 @@ var Animate_default = Animate;
|
|
|
981
988
|
// src/components/Loader.tsx
|
|
982
989
|
import { memo as memo5 } from "react";
|
|
983
990
|
import { ActivityIndicator } from "react-native";
|
|
984
|
-
import { useTheme as
|
|
991
|
+
import { useTheme as useTheme5 } from "react-better-core";
|
|
985
992
|
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
986
993
|
var LoaderComponent = function Loader({ size = "small", color, ...props }) {
|
|
987
|
-
const theme2 =
|
|
994
|
+
const theme2 = useTheme5();
|
|
988
995
|
return /* @__PURE__ */ jsx5(View_default, { ...props, children: /* @__PURE__ */ jsx5(ActivityIndicator, { size, color: color ?? theme2.colors.textPrimary }) });
|
|
989
996
|
};
|
|
990
997
|
LoaderComponent.box = function Box2({ text = "Loading...", size = "large", color, ...props }) {
|
|
991
|
-
const theme2 =
|
|
998
|
+
const theme2 = useTheme5();
|
|
992
999
|
return /* @__PURE__ */ jsxs(
|
|
993
1000
|
View_default,
|
|
994
1001
|
{
|
|
@@ -1005,7 +1012,7 @@ LoaderComponent.box = function Box2({ text = "Loading...", size = "large", color
|
|
|
1005
1012
|
);
|
|
1006
1013
|
};
|
|
1007
1014
|
LoaderComponent.text = function LoaderText({ text = "Loading...", size, color, ...props }) {
|
|
1008
|
-
const theme2 =
|
|
1015
|
+
const theme2 = useTheme5();
|
|
1009
1016
|
return /* @__PURE__ */ jsxs(
|
|
1010
1017
|
View_default,
|
|
1011
1018
|
{
|
|
@@ -1027,32 +1034,105 @@ Loader2.box = LoaderComponent.box;
|
|
|
1027
1034
|
Loader2.text = LoaderComponent.text;
|
|
1028
1035
|
var Loader_default = Loader2;
|
|
1029
1036
|
|
|
1030
|
-
// src/components/
|
|
1031
|
-
import {
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1037
|
+
// src/components/Image.tsx
|
|
1038
|
+
import { memo as memo6, useEffect as useEffect3, useMemo as useMemo5 } from "react";
|
|
1039
|
+
import { useBetterCoreContext as useBetterCoreContext2, useTheme as useTheme6 } from "react-better-core";
|
|
1040
|
+
import {
|
|
1041
|
+
Image as NativeImage
|
|
1042
|
+
} from "react-native";
|
|
1043
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1044
|
+
var ImageComponent = function Image({ name, source, withDevFittingMode, ...props }) {
|
|
1045
|
+
const { assets: assets2 } = useBetterCoreContext2();
|
|
1046
|
+
const style = useMemo5(
|
|
1047
|
+
() => ({
|
|
1048
|
+
width: 100,
|
|
1049
|
+
height: 100,
|
|
1050
|
+
...withDevFittingMode ? {
|
|
1051
|
+
borderWidth: 1,
|
|
1052
|
+
borderColor: "#eb39f7"
|
|
1053
|
+
} : {},
|
|
1054
|
+
...props
|
|
1055
|
+
}),
|
|
1056
|
+
[withDevFittingMode, props]
|
|
1057
|
+
);
|
|
1058
|
+
useEffect3(() => {
|
|
1059
|
+
if (!name) return;
|
|
1060
|
+
if (!assets2[name.toString()])
|
|
1061
|
+
console.warn(
|
|
1062
|
+
`The asset \`${name}\` you are trying to use does not exist. Make sure to add it to the \`assets\` object in \`<BetterComponentsProvider>\` config value prop.`
|
|
1063
|
+
);
|
|
1064
|
+
}, [assets2, name]);
|
|
1065
|
+
return /* @__PURE__ */ jsx6(NativeImage, { source: name ? assets2[name.toString()] : source, style, ...props });
|
|
1066
|
+
};
|
|
1067
|
+
ImageComponent.profileImage = function ProfileImage({
|
|
1068
|
+
size = 50,
|
|
1069
|
+
letters,
|
|
1070
|
+
color,
|
|
1071
|
+
backgroundColor,
|
|
1053
1072
|
...props
|
|
1054
1073
|
}) {
|
|
1055
|
-
const theme2 =
|
|
1074
|
+
const theme2 = useTheme6();
|
|
1075
|
+
return letters ? /* @__PURE__ */ jsx6(
|
|
1076
|
+
View_default,
|
|
1077
|
+
{
|
|
1078
|
+
width: size,
|
|
1079
|
+
height: size,
|
|
1080
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
1081
|
+
borderWidth: 1,
|
|
1082
|
+
borderColor: theme2.colors.border,
|
|
1083
|
+
borderRadius: 999,
|
|
1084
|
+
alignItems: "center",
|
|
1085
|
+
justifyContent: "center",
|
|
1086
|
+
...props,
|
|
1087
|
+
children: /* @__PURE__ */ jsx6(Text_default, { fontSize: size / 2.5, fontWeight: 700, color: color ?? theme2.colors.textPrimary, marginTop: 1, children: letters.toUpperCase().slice(0, 2) })
|
|
1088
|
+
}
|
|
1089
|
+
) : /* @__PURE__ */ jsx6(
|
|
1090
|
+
ImageComponent,
|
|
1091
|
+
{
|
|
1092
|
+
width: size,
|
|
1093
|
+
height: size,
|
|
1094
|
+
borderWidth: 1,
|
|
1095
|
+
borderColor: theme2.colors.border,
|
|
1096
|
+
borderRadius: 999,
|
|
1097
|
+
objectFit: "cover",
|
|
1098
|
+
...props
|
|
1099
|
+
}
|
|
1100
|
+
);
|
|
1101
|
+
};
|
|
1102
|
+
var Image2 = memo6(ImageComponent);
|
|
1103
|
+
Image2.profileImage = ImageComponent.profileImage;
|
|
1104
|
+
var Image_default = Image2;
|
|
1105
|
+
|
|
1106
|
+
// src/components/Button.tsx
|
|
1107
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1108
|
+
var ButtonComponent = function Button({
|
|
1109
|
+
value,
|
|
1110
|
+
text,
|
|
1111
|
+
textFontSize = 16,
|
|
1112
|
+
textFontWeight = 700,
|
|
1113
|
+
textDecorationLine,
|
|
1114
|
+
textColor,
|
|
1115
|
+
icon,
|
|
1116
|
+
iconIOS,
|
|
1117
|
+
iconPosition = "left",
|
|
1118
|
+
iconColor,
|
|
1119
|
+
iconSize,
|
|
1120
|
+
image,
|
|
1121
|
+
imagePosition = "left",
|
|
1122
|
+
imageWidth,
|
|
1123
|
+
imageHeight,
|
|
1124
|
+
loaderName,
|
|
1125
|
+
isLoading,
|
|
1126
|
+
isSmall,
|
|
1127
|
+
animateOpacity,
|
|
1128
|
+
flex,
|
|
1129
|
+
alignSelf,
|
|
1130
|
+
disabled,
|
|
1131
|
+
onPress,
|
|
1132
|
+
onPressWithValue,
|
|
1133
|
+
...props
|
|
1134
|
+
}) {
|
|
1135
|
+
const theme2 = useTheme7();
|
|
1056
1136
|
const isLoadingLoader = useLoader(loaderName);
|
|
1057
1137
|
const isLoadingElement = isLoading || isLoadingLoader;
|
|
1058
1138
|
const isDisabled = disabled || isLoadingElement;
|
|
@@ -1061,7 +1141,24 @@ var ButtonComponent = function Button({
|
|
|
1061
1141
|
const paddingVertical = props.paddingVertical ? parseFloat(props.paddingVertical.toString()) : theme2.styles.space;
|
|
1062
1142
|
const paddingHorizontal = props.paddingHorizontal ? parseFloat(props.paddingHorizontal.toString()) : theme2.styles.space + theme2.styles.gap;
|
|
1063
1143
|
const buttonHeight = paddingVertical + lineHeight + paddingVertical;
|
|
1064
|
-
|
|
1144
|
+
const onPressElement = useCallback2(
|
|
1145
|
+
(event) => {
|
|
1146
|
+
onPress?.(event);
|
|
1147
|
+
onPressWithValue?.(value);
|
|
1148
|
+
},
|
|
1149
|
+
[onPress, onPressWithValue, value]
|
|
1150
|
+
);
|
|
1151
|
+
const iconComponent = icon ? /* @__PURE__ */ jsx7(View_default, { height: 20, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx7(
|
|
1152
|
+
Icon_default,
|
|
1153
|
+
{
|
|
1154
|
+
name: icon,
|
|
1155
|
+
nameIOS: iconIOS,
|
|
1156
|
+
color: iconColor ?? textColor ?? theme2.colors.base,
|
|
1157
|
+
size: iconSize ?? textFontSize ?? 16
|
|
1158
|
+
}
|
|
1159
|
+
) }) : void 0;
|
|
1160
|
+
const imageComponent = image ? /* @__PURE__ */ jsx7(Image_default, { name: image, width: imageWidth ?? textFontSize ?? 16, height: imageHeight }) : void 0;
|
|
1161
|
+
return /* @__PURE__ */ jsx7(
|
|
1065
1162
|
Animate_default.View,
|
|
1066
1163
|
{
|
|
1067
1164
|
position: "relative",
|
|
@@ -1074,7 +1171,7 @@ var ButtonComponent = function Button({
|
|
|
1074
1171
|
{
|
|
1075
1172
|
position: "relative",
|
|
1076
1173
|
width: !isSmall ? "100%" : void 0,
|
|
1077
|
-
height:
|
|
1174
|
+
height: Platform3.OS === "android" ? buttonHeight : void 0,
|
|
1078
1175
|
alignItems: "center",
|
|
1079
1176
|
justifyContent: "center",
|
|
1080
1177
|
backgroundColor: theme2.colors.primary,
|
|
@@ -1082,22 +1179,29 @@ var ButtonComponent = function Button({
|
|
|
1082
1179
|
paddingVertical,
|
|
1083
1180
|
paddingHorizontal,
|
|
1084
1181
|
disabled: isDisabled,
|
|
1182
|
+
onPress: onPressElement,
|
|
1085
1183
|
...props,
|
|
1086
1184
|
children: [
|
|
1087
|
-
/* @__PURE__ */
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1185
|
+
/* @__PURE__ */ jsx7(Animate_default.View, { initialOpacity: 1, animateOpacity: isLoadingElement ? 0 : 1, children: /* @__PURE__ */ jsxs2(View_default, { isRow: true, alignItems: "center", justifyContent: "center", gap: theme2.styles.gap, children: [
|
|
1186
|
+
iconPosition === "left" && iconComponent,
|
|
1187
|
+
imagePosition === "left" && imageComponent,
|
|
1188
|
+
text && /* @__PURE__ */ jsx7(
|
|
1189
|
+
Text_default,
|
|
1190
|
+
{
|
|
1191
|
+
fontSize: textFontSize,
|
|
1192
|
+
fontWeight: textFontWeight,
|
|
1193
|
+
textDecorationLine,
|
|
1194
|
+
textDecorationColor: color,
|
|
1195
|
+
textAlign: "center",
|
|
1196
|
+
lineHeight,
|
|
1197
|
+
color,
|
|
1198
|
+
children: text
|
|
1199
|
+
}
|
|
1200
|
+
),
|
|
1201
|
+
iconPosition === "right" && iconComponent,
|
|
1202
|
+
imagePosition === "right" && imageComponent
|
|
1203
|
+
] }) }),
|
|
1204
|
+
/* @__PURE__ */ jsx7(
|
|
1101
1205
|
Animate_default.View,
|
|
1102
1206
|
{
|
|
1103
1207
|
position: "absolute",
|
|
@@ -1108,7 +1212,7 @@ var ButtonComponent = function Button({
|
|
|
1108
1212
|
justifyContent: "center",
|
|
1109
1213
|
initialOpacity: 0,
|
|
1110
1214
|
animateOpacity: isLoadingElement ? 1 : 0,
|
|
1111
|
-
children: /* @__PURE__ */
|
|
1215
|
+
children: /* @__PURE__ */ jsx7(Loader_default, { color })
|
|
1112
1216
|
}
|
|
1113
1217
|
)
|
|
1114
1218
|
]
|
|
@@ -1118,8 +1222,8 @@ var ButtonComponent = function Button({
|
|
|
1118
1222
|
);
|
|
1119
1223
|
};
|
|
1120
1224
|
ButtonComponent.secondary = function Secondary(props) {
|
|
1121
|
-
const theme2 =
|
|
1122
|
-
return /* @__PURE__ */
|
|
1225
|
+
const theme2 = useTheme7();
|
|
1226
|
+
return /* @__PURE__ */ jsx7(
|
|
1123
1227
|
ButtonComponent,
|
|
1124
1228
|
{
|
|
1125
1229
|
backgroundColor: theme2.colors.backgroundContent,
|
|
@@ -1133,15 +1237,16 @@ ButtonComponent.secondary = function Secondary(props) {
|
|
|
1133
1237
|
);
|
|
1134
1238
|
};
|
|
1135
1239
|
ButtonComponent.destructive = function Destructive(props) {
|
|
1136
|
-
const theme2 =
|
|
1137
|
-
return /* @__PURE__ */
|
|
1240
|
+
const theme2 = useTheme7();
|
|
1241
|
+
return /* @__PURE__ */ jsx7(ButtonComponent, { backgroundColor: theme2.colors.error, ...props });
|
|
1138
1242
|
};
|
|
1139
1243
|
ButtonComponent.text = function ButtonText(props) {
|
|
1140
|
-
const theme2 =
|
|
1141
|
-
return /* @__PURE__ */
|
|
1244
|
+
const theme2 = useTheme7();
|
|
1245
|
+
return /* @__PURE__ */ jsx7(
|
|
1142
1246
|
ButtonComponent,
|
|
1143
1247
|
{
|
|
1144
1248
|
width: "auto",
|
|
1249
|
+
textFontWeight: 400,
|
|
1145
1250
|
textColor: theme2.colors.textPrimary,
|
|
1146
1251
|
textDecorationLine: "underline",
|
|
1147
1252
|
backgroundColor: "transparent",
|
|
@@ -1153,17 +1258,323 @@ ButtonComponent.text = function ButtonText(props) {
|
|
|
1153
1258
|
}
|
|
1154
1259
|
);
|
|
1155
1260
|
};
|
|
1156
|
-
|
|
1261
|
+
ButtonComponent.icon = function ButtonIcon({ size = 16, ...props }) {
|
|
1262
|
+
const theme2 = useTheme7();
|
|
1263
|
+
const buttonSize = size + theme2.styles.space;
|
|
1264
|
+
return /* @__PURE__ */ jsx7(
|
|
1265
|
+
ButtonComponent,
|
|
1266
|
+
{
|
|
1267
|
+
width: buttonSize,
|
|
1268
|
+
height: buttonSize,
|
|
1269
|
+
textColor: theme2.colors.textPrimary,
|
|
1270
|
+
backgroundColor: "transparent",
|
|
1271
|
+
hitSlop: theme2.styles.gap / 2,
|
|
1272
|
+
borderRadius: 999,
|
|
1273
|
+
iconSize: size,
|
|
1274
|
+
paddingVertical: 0,
|
|
1275
|
+
paddingHorizontal: 0,
|
|
1276
|
+
pressType: "opacity",
|
|
1277
|
+
...props
|
|
1278
|
+
}
|
|
1279
|
+
);
|
|
1280
|
+
};
|
|
1281
|
+
var Button2 = memo7(ButtonComponent);
|
|
1157
1282
|
Button2.secondary = ButtonComponent.secondary;
|
|
1158
1283
|
Button2.destructive = ButtonComponent.destructive;
|
|
1159
1284
|
Button2.text = ButtonComponent.text;
|
|
1285
|
+
Button2.icon = ButtonComponent.icon;
|
|
1160
1286
|
var Button_default = Button2;
|
|
1161
1287
|
|
|
1288
|
+
// src/components/alerts/Alert.tsx
|
|
1289
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1290
|
+
var getAlertDurationFromAuto = (duration, alert) => {
|
|
1291
|
+
if (duration === "auto") {
|
|
1292
|
+
const titleLength = alert.title?.length ?? 0;
|
|
1293
|
+
const messageLength = alert.message?.length ?? 0;
|
|
1294
|
+
return Math.max(defaultAlertDuration, (titleLength + messageLength) * 30);
|
|
1295
|
+
}
|
|
1296
|
+
return duration;
|
|
1297
|
+
};
|
|
1298
|
+
function Alert({ alert }) {
|
|
1299
|
+
const theme2 = useTheme8();
|
|
1300
|
+
const alertControls2 = useAlertControls();
|
|
1301
|
+
const alertsPlugin2 = usePlugin("alerts");
|
|
1302
|
+
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
1303
|
+
const defaultAlertDurationNumber = getAlertDurationFromAuto(
|
|
1304
|
+
alert.duration ?? pluginConfig.defaultDuration ?? defaultAlertsPluginOptions.defaultDuration,
|
|
1305
|
+
alert
|
|
1306
|
+
);
|
|
1307
|
+
const defaultAlertDisplay = alert.display ?? pluginConfig.defaultDisplay?.[alert.type] ?? defaultAlertsPluginOptions.defaultDisplay[alert.type] ?? "default";
|
|
1308
|
+
const calledOnCloseRef = useRef2(false);
|
|
1309
|
+
const [isRemoved, setIsRemoved] = useBooleanState2();
|
|
1310
|
+
const onPressCloseAlert = useCallback3(() => {
|
|
1311
|
+
setIsRemoved.setTrue();
|
|
1312
|
+
setTimeout(() => {
|
|
1313
|
+
alertControls2.removeAlert(alert.id);
|
|
1314
|
+
if (!calledOnCloseRef.current) {
|
|
1315
|
+
alert.onClose?.(alert);
|
|
1316
|
+
calledOnCloseRef.current = true;
|
|
1317
|
+
}
|
|
1318
|
+
}, defaultTransitionDuration);
|
|
1319
|
+
}, [alert]);
|
|
1320
|
+
const alertData = useMemo6(
|
|
1321
|
+
() => ({
|
|
1322
|
+
info: {
|
|
1323
|
+
icon: "infoI",
|
|
1324
|
+
iconIOS: "info",
|
|
1325
|
+
backgroundColor: theme2.colors.info,
|
|
1326
|
+
title: "Info"
|
|
1327
|
+
},
|
|
1328
|
+
success: {
|
|
1329
|
+
icon: "check",
|
|
1330
|
+
backgroundColor: theme2.colors.success,
|
|
1331
|
+
title: "Success"
|
|
1332
|
+
},
|
|
1333
|
+
warning: {
|
|
1334
|
+
icon: "warningTriangle",
|
|
1335
|
+
backgroundColor: theme2.colors.warn,
|
|
1336
|
+
title: "Warning"
|
|
1337
|
+
},
|
|
1338
|
+
error: {
|
|
1339
|
+
icon: "XMark",
|
|
1340
|
+
backgroundColor: theme2.colors.error,
|
|
1341
|
+
title: "Error"
|
|
1342
|
+
}
|
|
1343
|
+
}),
|
|
1344
|
+
[theme2]
|
|
1345
|
+
);
|
|
1346
|
+
useEffect4(() => {
|
|
1347
|
+
const timeout = setTimeout(onPressCloseAlert, defaultAlertDurationNumber);
|
|
1348
|
+
return () => {
|
|
1349
|
+
clearTimeout(timeout);
|
|
1350
|
+
};
|
|
1351
|
+
}, [onPressCloseAlert, defaultAlertDurationNumber]);
|
|
1352
|
+
return defaultAlertDisplay === "prominent" ? /* @__PURE__ */ jsx8(Fragment2, {}) : /* @__PURE__ */ jsx8(
|
|
1353
|
+
Animate_default.View,
|
|
1354
|
+
{
|
|
1355
|
+
initialOpacity: 0,
|
|
1356
|
+
animateOpacity: isRemoved ? 0 : 1,
|
|
1357
|
+
initialX: 40,
|
|
1358
|
+
animateX: isRemoved ? 40 : 0,
|
|
1359
|
+
children: /* @__PURE__ */ jsx8(View_default.box, { width: "auto", withShadow: true, children: /* @__PURE__ */ jsxs3(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.space, children: [
|
|
1360
|
+
/* @__PURE__ */ jsx8(
|
|
1361
|
+
View_default,
|
|
1362
|
+
{
|
|
1363
|
+
alignItems: "center",
|
|
1364
|
+
justifyContent: "center",
|
|
1365
|
+
backgroundColor: alertData[alert.type].backgroundColor,
|
|
1366
|
+
borderRadius: 999,
|
|
1367
|
+
padding: (theme2.styles.space + theme2.styles.gap) / 2,
|
|
1368
|
+
children: /* @__PURE__ */ jsx8(
|
|
1369
|
+
Icon_default,
|
|
1370
|
+
{
|
|
1371
|
+
name: alertData[alert.type].icon,
|
|
1372
|
+
color: alertData[alert.type].iconColor ?? theme2.colors.base
|
|
1373
|
+
}
|
|
1374
|
+
)
|
|
1375
|
+
}
|
|
1376
|
+
),
|
|
1377
|
+
/* @__PURE__ */ jsxs3(View_default, { children: [
|
|
1378
|
+
/* @__PURE__ */ jsx8(Text_default, { fontSize: 18, fontWeight: 700, children: alert.title ?? alertData[alert.type].title }),
|
|
1379
|
+
/* @__PURE__ */ jsx8(Text_default.body, { children: alert.message })
|
|
1380
|
+
] }),
|
|
1381
|
+
pluginConfig.withCloseButton && /* @__PURE__ */ jsx8(Button_default.icon, { icon: "XMark", onPress: onPressCloseAlert })
|
|
1382
|
+
] }) })
|
|
1383
|
+
}
|
|
1384
|
+
);
|
|
1385
|
+
}
|
|
1386
|
+
var Alert_default = memo8(Alert);
|
|
1387
|
+
|
|
1388
|
+
// src/components/alerts/AlertsHolder.tsx
|
|
1389
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1390
|
+
function AlertsHolder() {
|
|
1391
|
+
const theme2 = useTheme9();
|
|
1392
|
+
const device = useDevice();
|
|
1393
|
+
const alertsPlugin2 = usePlugin("alerts");
|
|
1394
|
+
const { alerts } = useBetterComponentsContextInternal();
|
|
1395
|
+
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
1396
|
+
return /* @__PURE__ */ jsx9(
|
|
1397
|
+
View_default,
|
|
1398
|
+
{
|
|
1399
|
+
position: "absolute",
|
|
1400
|
+
width: "100%",
|
|
1401
|
+
top: device.safeArea.afterCalculations.top + theme2.styles.gap / 2,
|
|
1402
|
+
left: 0,
|
|
1403
|
+
gap: theme2.styles.gap,
|
|
1404
|
+
alignItems: pluginConfig.align === "left" ? "flex-start" : pluginConfig.align === "center" ? "center" : pluginConfig.align === "right" ? "flex-end" : void 0,
|
|
1405
|
+
paddingHorizontal: theme2.styles.space,
|
|
1406
|
+
pointerEvents: "box-none",
|
|
1407
|
+
zIndex: 1e3,
|
|
1408
|
+
children: alerts.map((alert) => /* @__PURE__ */ jsx9(Alert_default, { alert }, alert.id))
|
|
1409
|
+
}
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1412
|
+
var AlertsHolder_default = memo9(AlertsHolder);
|
|
1413
|
+
|
|
1414
|
+
// src/components/BetterComponentsProvider.tsx
|
|
1415
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1416
|
+
var betterComponentsContext = createContext(void 0);
|
|
1417
|
+
var externalBetterCoreContextValue;
|
|
1418
|
+
var externalBetterComponentsContextValue;
|
|
1419
|
+
var useBetterComponentsContext = () => {
|
|
1420
|
+
const coreContext = useBetterCoreContext3();
|
|
1421
|
+
const context = useContext(betterComponentsContext);
|
|
1422
|
+
if (context === void 0)
|
|
1423
|
+
throw new Error(
|
|
1424
|
+
"`useBetterComponentsContext()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1425
|
+
);
|
|
1426
|
+
const { plugins, componentsState, ...rest } = context;
|
|
1427
|
+
return {
|
|
1428
|
+
...coreContext,
|
|
1429
|
+
...rest
|
|
1430
|
+
};
|
|
1431
|
+
};
|
|
1432
|
+
var useBetterComponentsContextInternal = () => {
|
|
1433
|
+
const context = useContext(betterComponentsContext);
|
|
1434
|
+
if (context === void 0)
|
|
1435
|
+
throw new Error(
|
|
1436
|
+
"`useBetterComponentsContextInternal()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1437
|
+
);
|
|
1438
|
+
return context;
|
|
1439
|
+
};
|
|
1440
|
+
var useAlertControls = () => {
|
|
1441
|
+
const context = useContext(betterComponentsContext);
|
|
1442
|
+
if (context === void 0)
|
|
1443
|
+
throw new Error(
|
|
1444
|
+
"`useAlertControls()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1445
|
+
);
|
|
1446
|
+
const createAlert = useCallback4((alert) => {
|
|
1447
|
+
const readyAlert = {
|
|
1448
|
+
id: generateRandomString2(36),
|
|
1449
|
+
...alert
|
|
1450
|
+
};
|
|
1451
|
+
context.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
1452
|
+
return readyAlert;
|
|
1453
|
+
}, []);
|
|
1454
|
+
const removeAlert = useCallback4((alertId) => {
|
|
1455
|
+
context.setAlerts((oldValue) => oldValue.filter((alert) => alert.id !== alertId));
|
|
1456
|
+
}, []);
|
|
1457
|
+
return {
|
|
1458
|
+
createAlert,
|
|
1459
|
+
removeAlert
|
|
1460
|
+
};
|
|
1461
|
+
};
|
|
1462
|
+
var usePlugin = (pluginName) => {
|
|
1463
|
+
const context = useContext(betterComponentsContext);
|
|
1464
|
+
if (context === void 0) {
|
|
1465
|
+
throw new Error(
|
|
1466
|
+
"`usePlugin()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1467
|
+
);
|
|
1468
|
+
}
|
|
1469
|
+
return useMemo7(
|
|
1470
|
+
() => context.plugins.find((plugin) => plugin.name === pluginName),
|
|
1471
|
+
[context.plugins, pluginName]
|
|
1472
|
+
);
|
|
1473
|
+
};
|
|
1474
|
+
function BetterComponentsProviderInternalContent({ children }) {
|
|
1475
|
+
const alertsPlugin2 = usePlugin("alerts");
|
|
1476
|
+
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
1477
|
+
children,
|
|
1478
|
+
alertsPlugin2 && /* @__PURE__ */ jsx10(AlertsHolder_default, {})
|
|
1479
|
+
] });
|
|
1480
|
+
}
|
|
1481
|
+
function BetterComponentsProviderInternal({
|
|
1482
|
+
config,
|
|
1483
|
+
plugins,
|
|
1484
|
+
children
|
|
1485
|
+
}) {
|
|
1486
|
+
const betterCoreContext = useBetterCoreContext3();
|
|
1487
|
+
const [alerts, setAlerts] = useState2([]);
|
|
1488
|
+
const readyConfig = useMemo7(
|
|
1489
|
+
() => ({
|
|
1490
|
+
app: {
|
|
1491
|
+
...appConfig,
|
|
1492
|
+
...config?.app
|
|
1493
|
+
},
|
|
1494
|
+
alerts,
|
|
1495
|
+
setAlerts,
|
|
1496
|
+
plugins: plugins ?? [],
|
|
1497
|
+
componentsState: {}
|
|
1498
|
+
}),
|
|
1499
|
+
[config, alerts, plugins]
|
|
1500
|
+
);
|
|
1501
|
+
useEffect5(() => {
|
|
1502
|
+
if (!plugins) return;
|
|
1503
|
+
plugins.forEach((plugin) => {
|
|
1504
|
+
plugin.initialize?.();
|
|
1505
|
+
});
|
|
1506
|
+
}, []);
|
|
1507
|
+
externalBetterCoreContextValue = betterCoreContext;
|
|
1508
|
+
externalBetterComponentsContextValue = readyConfig;
|
|
1509
|
+
return /* @__PURE__ */ jsx10(betterComponentsContext.Provider, { value: readyConfig, children: /* @__PURE__ */ jsx10(BetterComponentsProviderInternalContent, { children }) });
|
|
1510
|
+
}
|
|
1511
|
+
function BetterComponentsProvider({ config, ...props }) {
|
|
1512
|
+
const coreConfig = useMemo7(
|
|
1513
|
+
() => ({
|
|
1514
|
+
theme: {
|
|
1515
|
+
...theme,
|
|
1516
|
+
...config?.theme
|
|
1517
|
+
},
|
|
1518
|
+
// colorTheme: config?.colorTheme ?? (localStorage.getItem("theme") === "dark" ? "dark" : "light"),
|
|
1519
|
+
colorTheme: config?.colorTheme ?? "light",
|
|
1520
|
+
icons: {
|
|
1521
|
+
...icons,
|
|
1522
|
+
...config?.icons
|
|
1523
|
+
},
|
|
1524
|
+
assets: {
|
|
1525
|
+
...assets,
|
|
1526
|
+
...config?.assets
|
|
1527
|
+
},
|
|
1528
|
+
loaders: config?.loaders
|
|
1529
|
+
}),
|
|
1530
|
+
[config]
|
|
1531
|
+
);
|
|
1532
|
+
const componentsConfig = useMemo7(
|
|
1533
|
+
() => ({
|
|
1534
|
+
app: config?.app
|
|
1535
|
+
}),
|
|
1536
|
+
[config]
|
|
1537
|
+
);
|
|
1538
|
+
return /* @__PURE__ */ jsx10(BetterCoreProvider, { config: coreConfig, children: /* @__PURE__ */ jsx10(BetterComponentsProviderInternal, { config: componentsConfig, ...props }) });
|
|
1539
|
+
}
|
|
1540
|
+
var BetterComponentsProvider_default = memo10(BetterComponentsProvider);
|
|
1541
|
+
|
|
1542
|
+
// src/utils/functions.ts
|
|
1543
|
+
var getFormErrorObject = (formValues) => {
|
|
1544
|
+
return {};
|
|
1545
|
+
};
|
|
1546
|
+
|
|
1547
|
+
// src/utils/asyncStorage.ts
|
|
1548
|
+
import NativeAsyncStorage from "@react-native-async-storage/async-storage";
|
|
1549
|
+
function generateAsyncStorage() {
|
|
1550
|
+
return {
|
|
1551
|
+
setItem: async (name, value) => {
|
|
1552
|
+
if (value) await NativeAsyncStorage.setItem(name.toString(), JSON.stringify(value));
|
|
1553
|
+
else await NativeAsyncStorage.removeItem(name.toString());
|
|
1554
|
+
},
|
|
1555
|
+
getItem: async (name) => {
|
|
1556
|
+
const item = await NativeAsyncStorage.getItem(name.toString());
|
|
1557
|
+
if (item === null) return void 0;
|
|
1558
|
+
try {
|
|
1559
|
+
return JSON.parse(item);
|
|
1560
|
+
} catch (error) {
|
|
1561
|
+
return void 0;
|
|
1562
|
+
}
|
|
1563
|
+
},
|
|
1564
|
+
removeItem: async (name) => {
|
|
1565
|
+
await NativeAsyncStorage.removeItem(name.toString());
|
|
1566
|
+
},
|
|
1567
|
+
removeAllItems: () => {
|
|
1568
|
+
NativeAsyncStorage.clear();
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1162
1573
|
// src/components/ScreenHolder.tsx
|
|
1163
|
-
import { memo as
|
|
1164
|
-
import { KeyboardAvoidingView, Platform as
|
|
1165
|
-
import { useBooleanState as useBooleanState3, useTheme as
|
|
1166
|
-
import { jsx as
|
|
1574
|
+
import { memo as memo11, useCallback as useCallback5, useMemo as useMemo8 } from "react";
|
|
1575
|
+
import { KeyboardAvoidingView, Platform as Platform4, RefreshControl, ScrollView } from "react-native";
|
|
1576
|
+
import { useBooleanState as useBooleanState3, useTheme as useTheme10 } from "react-better-core";
|
|
1577
|
+
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1167
1578
|
var ScreenHolderComponent = ({
|
|
1168
1579
|
noScroll,
|
|
1169
1580
|
noSideSpace,
|
|
@@ -1180,17 +1591,17 @@ var ScreenHolderComponent = ({
|
|
|
1180
1591
|
withNoHeader,
|
|
1181
1592
|
children
|
|
1182
1593
|
}) => {
|
|
1183
|
-
const theme2 =
|
|
1594
|
+
const theme2 = useTheme10();
|
|
1184
1595
|
const device = useDevice();
|
|
1185
1596
|
const keyboard = useKeyboard();
|
|
1186
1597
|
const [isRefreshing, setIsRefreshing] = useBooleanState3();
|
|
1187
|
-
const keyboardAvoidingViewStyle =
|
|
1598
|
+
const keyboardAvoidingViewStyle = useMemo8(
|
|
1188
1599
|
() => ({
|
|
1189
1600
|
flex: 1
|
|
1190
1601
|
}),
|
|
1191
1602
|
[]
|
|
1192
1603
|
);
|
|
1193
|
-
const onRefreshElement =
|
|
1604
|
+
const onRefreshElement = useCallback5(() => {
|
|
1194
1605
|
setIsRefreshing.setTrue();
|
|
1195
1606
|
onRefresh?.();
|
|
1196
1607
|
setTimeout(() => {
|
|
@@ -1198,36 +1609,36 @@ var ScreenHolderComponent = ({
|
|
|
1198
1609
|
onRefreshEnd?.();
|
|
1199
1610
|
}, refreshTimeout * 1e3);
|
|
1200
1611
|
}, [onRefresh, onRefreshEnd, refreshTimeout]);
|
|
1201
|
-
const content = /* @__PURE__ */
|
|
1612
|
+
const content = /* @__PURE__ */ jsx11(
|
|
1202
1613
|
View_default,
|
|
1203
1614
|
{
|
|
1204
1615
|
flex: 1,
|
|
1205
1616
|
paddingHorizontal: !noSideSpace ? theme2.styles.space : void 0,
|
|
1206
1617
|
paddingTop: theme2.styles.gap + (insideTopSafeArea ? device.safeArea.afterCalculations.top : 0),
|
|
1207
|
-
paddingBottom:
|
|
1618
|
+
paddingBottom: Platform4.OS === "ios" && keyboard.isOpened ? device.safeArea.afterCalculations.top : bottomSpace + (insideBottomSafeArea ? device.safeArea.afterCalculations.bottom : 0),
|
|
1208
1619
|
children
|
|
1209
1620
|
}
|
|
1210
1621
|
);
|
|
1211
1622
|
const withRefresh = onRefresh || onRefreshEnd;
|
|
1212
|
-
return /* @__PURE__ */
|
|
1623
|
+
return /* @__PURE__ */ jsx11(View_default, { flex: 1, backgroundColor: backgroundColor ?? theme2.colors.backgroundBase, children: /* @__PURE__ */ jsxs5(
|
|
1213
1624
|
KeyboardAvoidingView,
|
|
1214
1625
|
{
|
|
1215
1626
|
style: keyboardAvoidingViewStyle,
|
|
1216
|
-
keyboardVerticalOffset: keyboardVerticalOffset ?? (withNoHeader ?
|
|
1217
|
-
behavior:
|
|
1627
|
+
keyboardVerticalOffset: keyboardVerticalOffset ?? (withNoHeader ? Platform4.OS === "ios" ? 0 : theme2.styles.gap : keepFooterOnKeyboardOpened ? Platform4.OS === "ios" ? device.safeArea.afterCalculations.bottom : theme2.styles.gap : void 0),
|
|
1628
|
+
behavior: Platform4.OS === "ios" ? "padding" : "height",
|
|
1218
1629
|
children: [
|
|
1219
|
-
/* @__PURE__ */
|
|
1630
|
+
/* @__PURE__ */ jsx11(View_default, { flex: 1, children: noScroll ? content : /* @__PURE__ */ jsx11(
|
|
1220
1631
|
ScrollView,
|
|
1221
1632
|
{
|
|
1222
|
-
refreshControl: withRefresh ? /* @__PURE__ */
|
|
1633
|
+
refreshControl: withRefresh ? /* @__PURE__ */ jsx11(RefreshControl, { refreshing: isRefreshing, onRefresh: onRefreshElement }) : void 0,
|
|
1223
1634
|
children: content
|
|
1224
1635
|
}
|
|
1225
1636
|
) }),
|
|
1226
|
-
keepFooterOnKeyboardOpened || (
|
|
1637
|
+
keepFooterOnKeyboardOpened || (Platform4.OS === "ios" ? !keyboard.willOpen : !keyboard.isOpened) ? footer && /* @__PURE__ */ jsx11(View_default, { children: footer }) : !withNoHeader && /* @__PURE__ */ jsx11(
|
|
1227
1638
|
View_default,
|
|
1228
1639
|
{
|
|
1229
1640
|
width: "100%",
|
|
1230
|
-
height: device.safeArea.afterCalculations.bottom + (
|
|
1641
|
+
height: device.safeArea.afterCalculations.bottom + (Platform4.OS === "android" ? theme2.styles.gap : 0)
|
|
1231
1642
|
}
|
|
1232
1643
|
)
|
|
1233
1644
|
]
|
|
@@ -1241,154 +1652,34 @@ ScreenHolderComponent.footer = function Footer({
|
|
|
1241
1652
|
withNoHeader,
|
|
1242
1653
|
children
|
|
1243
1654
|
}) {
|
|
1244
|
-
const theme2 =
|
|
1655
|
+
const theme2 = useTheme10();
|
|
1245
1656
|
const device = useDevice();
|
|
1246
1657
|
const keyboard = useKeyboard();
|
|
1247
|
-
return /* @__PURE__ */
|
|
1658
|
+
return /* @__PURE__ */ jsx11(
|
|
1248
1659
|
View_default,
|
|
1249
1660
|
{
|
|
1250
1661
|
backgroundColor: backgroundColor ?? theme2.colors.backgroundBase,
|
|
1251
1662
|
paddingHorizontal: !noSideSpace ? theme2.styles.space : void 0,
|
|
1252
1663
|
paddingTop: theme2.styles.gap,
|
|
1253
|
-
paddingBottom: (
|
|
1664
|
+
paddingBottom: (Platform4.OS === "ios" ? keyboard.willOpen : keyboard.isOpened) && withNoHeader ? theme2.styles.gap : insideBottomSafeArea ? device.safeArea.afterCalculations.bottom : void 0,
|
|
1254
1665
|
children
|
|
1255
1666
|
}
|
|
1256
1667
|
);
|
|
1257
1668
|
};
|
|
1258
|
-
var ScreenHolder =
|
|
1669
|
+
var ScreenHolder = memo11(ScreenHolderComponent);
|
|
1259
1670
|
ScreenHolder.footer = ScreenHolderComponent.footer;
|
|
1260
1671
|
var ScreenHolder_default = ScreenHolder;
|
|
1261
1672
|
|
|
1262
|
-
// src/components/Image.tsx
|
|
1263
|
-
import { memo as memo8, useEffect as useEffect3, useMemo as useMemo7 } from "react";
|
|
1264
|
-
import { useBetterCoreContext as useBetterCoreContext2, useTheme as useTheme7 } from "react-better-core";
|
|
1265
|
-
import {
|
|
1266
|
-
Image as NativeImage
|
|
1267
|
-
} from "react-native";
|
|
1268
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1269
|
-
var ImageComponent = function Image({ name, source, withDevFittingMode, ...props }) {
|
|
1270
|
-
const { assets: assets2 } = useBetterCoreContext2();
|
|
1271
|
-
const style = useMemo7(
|
|
1272
|
-
() => ({
|
|
1273
|
-
width: 100,
|
|
1274
|
-
height: 100,
|
|
1275
|
-
...withDevFittingMode ? {
|
|
1276
|
-
borderWidth: 1,
|
|
1277
|
-
borderColor: "#eb39f7"
|
|
1278
|
-
} : {},
|
|
1279
|
-
...props
|
|
1280
|
-
}),
|
|
1281
|
-
[withDevFittingMode, props]
|
|
1282
|
-
);
|
|
1283
|
-
useEffect3(() => {
|
|
1284
|
-
if (!name) return;
|
|
1285
|
-
if (!assets2[name.toString()])
|
|
1286
|
-
console.warn(
|
|
1287
|
-
`The asset \`${name}\` you are trying to use does not exist. Make sure to add it to the \`assets\` object in \`<BetterComponentsProvider>\` config value prop.`
|
|
1288
|
-
);
|
|
1289
|
-
}, [assets2, name]);
|
|
1290
|
-
return /* @__PURE__ */ jsx8(NativeImage, { source: name ? assets2[name.toString()] : source, style, ...props });
|
|
1291
|
-
};
|
|
1292
|
-
ImageComponent.profileImage = function ProfileImage({
|
|
1293
|
-
size = 50,
|
|
1294
|
-
letters,
|
|
1295
|
-
color,
|
|
1296
|
-
backgroundColor,
|
|
1297
|
-
...props
|
|
1298
|
-
}) {
|
|
1299
|
-
const theme2 = useTheme7();
|
|
1300
|
-
return letters ? /* @__PURE__ */ jsx8(
|
|
1301
|
-
View_default,
|
|
1302
|
-
{
|
|
1303
|
-
width: size,
|
|
1304
|
-
height: size,
|
|
1305
|
-
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
1306
|
-
borderWidth: 1,
|
|
1307
|
-
borderColor: theme2.colors.border,
|
|
1308
|
-
borderRadius: 999,
|
|
1309
|
-
alignItems: "center",
|
|
1310
|
-
justifyContent: "center",
|
|
1311
|
-
...props,
|
|
1312
|
-
children: /* @__PURE__ */ jsx8(Text_default, { fontSize: size / 2.5, fontWeight: 700, color: color ?? theme2.colors.textPrimary, marginTop: 1, children: letters.toUpperCase().slice(0, 2) })
|
|
1313
|
-
}
|
|
1314
|
-
) : /* @__PURE__ */ jsx8(
|
|
1315
|
-
ImageComponent,
|
|
1316
|
-
{
|
|
1317
|
-
width: size,
|
|
1318
|
-
height: size,
|
|
1319
|
-
borderWidth: 1,
|
|
1320
|
-
borderColor: theme2.colors.border,
|
|
1321
|
-
borderRadius: 999,
|
|
1322
|
-
objectFit: "cover",
|
|
1323
|
-
...props
|
|
1324
|
-
}
|
|
1325
|
-
);
|
|
1326
|
-
};
|
|
1327
|
-
var Image2 = memo8(ImageComponent);
|
|
1328
|
-
Image2.profileImage = ImageComponent.profileImage;
|
|
1329
|
-
var Image_default = Image2;
|
|
1330
|
-
|
|
1331
|
-
// src/components/Icon.tsx
|
|
1332
|
-
import { memo as memo9, useEffect as useEffect4 } from "react";
|
|
1333
|
-
import { Platform as Platform4 } from "react-native";
|
|
1334
|
-
import { Path, Svg } from "react-native-svg";
|
|
1335
|
-
import { useBetterCoreContext as useBetterCoreContext3, useTheme as useTheme8 } from "react-better-core";
|
|
1336
|
-
import { SymbolView } from "expo-symbols";
|
|
1337
|
-
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1338
|
-
import { createElement } from "react";
|
|
1339
|
-
function Icon({ name, nameIOS, size = 16, color, ...props }) {
|
|
1340
|
-
const theme2 = useTheme8();
|
|
1341
|
-
const { icons: icons2 } = useBetterCoreContext3();
|
|
1342
|
-
const svgColor = color ?? theme2.colors.textPrimary;
|
|
1343
|
-
useEffect4(() => {
|
|
1344
|
-
if (!icons2[name.toString()])
|
|
1345
|
-
console.warn(
|
|
1346
|
-
`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.`
|
|
1347
|
-
);
|
|
1348
|
-
}, [icons2, name]);
|
|
1349
|
-
return /* @__PURE__ */ jsx9(
|
|
1350
|
-
View_default,
|
|
1351
|
-
{
|
|
1352
|
-
width: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingHorizontal?.toString() ?? "0") ?? 0),
|
|
1353
|
-
height: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingVertical?.toString() ?? "0") ?? 0),
|
|
1354
|
-
alignItems: "center",
|
|
1355
|
-
justifyContent: "center",
|
|
1356
|
-
pressType: "opacity",
|
|
1357
|
-
pressStrength: pressStrength().p2,
|
|
1358
|
-
...props,
|
|
1359
|
-
children: Platform4.OS === "ios" && nameIOS ? /* @__PURE__ */ jsx9(SymbolView, { name: nameIOS, tintColor: svgColor, size }) : /* @__PURE__ */ jsx9(
|
|
1360
|
-
Svg,
|
|
1361
|
-
{
|
|
1362
|
-
width: size,
|
|
1363
|
-
height: size,
|
|
1364
|
-
viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
|
|
1365
|
-
fill: "none",
|
|
1366
|
-
children: icons2[name.toString()]?.paths.map(({ type, ...path }) => /* @__PURE__ */ createElement(
|
|
1367
|
-
Path,
|
|
1368
|
-
{
|
|
1369
|
-
...path,
|
|
1370
|
-
fill: type === "fill" ? svgColor : void 0,
|
|
1371
|
-
stroke: type === "stroke" ? svgColor : void 0,
|
|
1372
|
-
key: path.d
|
|
1373
|
-
}
|
|
1374
|
-
))
|
|
1375
|
-
}
|
|
1376
|
-
)
|
|
1377
|
-
}
|
|
1378
|
-
);
|
|
1379
|
-
}
|
|
1380
|
-
var Icon_default = memo9(Icon);
|
|
1381
|
-
|
|
1382
1673
|
// src/components/InputField.tsx
|
|
1383
1674
|
import {
|
|
1384
1675
|
forwardRef,
|
|
1385
|
-
memo as
|
|
1386
|
-
useCallback as
|
|
1387
|
-
useEffect as
|
|
1676
|
+
memo as memo12,
|
|
1677
|
+
useCallback as useCallback6,
|
|
1678
|
+
useEffect as useEffect6,
|
|
1388
1679
|
useImperativeHandle,
|
|
1389
|
-
useMemo as
|
|
1390
|
-
useRef as
|
|
1391
|
-
useState as
|
|
1680
|
+
useMemo as useMemo9,
|
|
1681
|
+
useRef as useRef3,
|
|
1682
|
+
useState as useState3
|
|
1392
1683
|
} from "react";
|
|
1393
1684
|
import {
|
|
1394
1685
|
Platform as Platform5,
|
|
@@ -1402,9 +1693,9 @@ import {
|
|
|
1402
1693
|
lightenColor,
|
|
1403
1694
|
useBetterCoreContext as useBetterCoreContext4,
|
|
1404
1695
|
useBooleanState as useBooleanState4,
|
|
1405
|
-
useTheme as
|
|
1696
|
+
useTheme as useTheme11
|
|
1406
1697
|
} from "react-better-core";
|
|
1407
|
-
import { Fragment as
|
|
1698
|
+
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1408
1699
|
var InputFieldComponent = forwardRef(
|
|
1409
1700
|
({
|
|
1410
1701
|
flex,
|
|
@@ -1456,11 +1747,11 @@ var InputFieldComponent = forwardRef(
|
|
|
1456
1747
|
onPressEnter,
|
|
1457
1748
|
...props
|
|
1458
1749
|
}, ref) => {
|
|
1459
|
-
const theme2 =
|
|
1750
|
+
const theme2 = useTheme11();
|
|
1460
1751
|
const { colorTheme } = useBetterCoreContext4();
|
|
1461
|
-
const textInputRef =
|
|
1462
|
-
const [internalValue, setInternalValue] =
|
|
1463
|
-
const [internalDateValue, setInternalDateValue] =
|
|
1752
|
+
const textInputRef = useRef3(null);
|
|
1753
|
+
const [internalValue, setInternalValue] = useState3(value?.toString() || defaultValue || "");
|
|
1754
|
+
const [internalDateValue, setInternalDateValue] = useState3();
|
|
1464
1755
|
const [isFocused, setIsFocused] = useBooleanState4();
|
|
1465
1756
|
const isIOSDateTime = Platform5.OS === "ios" && (type === "date" || type === "time");
|
|
1466
1757
|
const iconSize = 16;
|
|
@@ -1470,14 +1761,14 @@ var InputFieldComponent = forwardRef(
|
|
|
1470
1761
|
const readyPaddingHorizontal = paddingHorizontal ?? theme2.styles.space;
|
|
1471
1762
|
const readyPaddingVertical = paddingVertical ? parseFloat(paddingVertical.toString()) : (theme2.styles.space + theme2.styles.gap) / 2;
|
|
1472
1763
|
const readyHeight = height ?? isIOSDateTime ? void 0 : borderWidth + readyPaddingVertical + lineHeight + readyPaddingVertical + borderWidth + (Platform5.OS === "android" ? 2 : 0);
|
|
1473
|
-
const onChangeRNDateTimePicker =
|
|
1764
|
+
const onChangeRNDateTimePicker = useCallback6(
|
|
1474
1765
|
(event, data) => {
|
|
1475
1766
|
setInternalDateValue(data);
|
|
1476
1767
|
onChange?.(data?.toISOString() ?? "");
|
|
1477
1768
|
},
|
|
1478
1769
|
[onChange]
|
|
1479
1770
|
);
|
|
1480
|
-
const onPressInputField =
|
|
1771
|
+
const onPressInputField = useCallback6(
|
|
1481
1772
|
(event) => {
|
|
1482
1773
|
onPress?.(event);
|
|
1483
1774
|
if (type === "date" || type === "time") {
|
|
@@ -1505,22 +1796,22 @@ var InputFieldComponent = forwardRef(
|
|
|
1505
1796
|
},
|
|
1506
1797
|
[onPress, type, internalDateValue, onChangeRNDateTimePicker]
|
|
1507
1798
|
);
|
|
1508
|
-
const onFocusElement =
|
|
1799
|
+
const onFocusElement = useCallback6((event) => {
|
|
1509
1800
|
setIsFocused.setTrue();
|
|
1510
1801
|
onFocus?.(event);
|
|
1511
1802
|
}, []);
|
|
1512
|
-
const onBlurElement =
|
|
1803
|
+
const onBlurElement = useCallback6((event) => {
|
|
1513
1804
|
setIsFocused.setFalse();
|
|
1514
1805
|
onBlur?.(event);
|
|
1515
1806
|
}, []);
|
|
1516
|
-
const onChangeText =
|
|
1807
|
+
const onChangeText = useCallback6(
|
|
1517
1808
|
(text) => {
|
|
1518
1809
|
setInternalValue(text);
|
|
1519
1810
|
onChange?.(text);
|
|
1520
1811
|
},
|
|
1521
1812
|
[onChange]
|
|
1522
1813
|
);
|
|
1523
|
-
const textInputStyle =
|
|
1814
|
+
const textInputStyle = useMemo9(
|
|
1524
1815
|
() => ({
|
|
1525
1816
|
flex: 1,
|
|
1526
1817
|
fontSize,
|
|
@@ -1545,14 +1836,14 @@ var InputFieldComponent = forwardRef(
|
|
|
1545
1836
|
rightIcon
|
|
1546
1837
|
]
|
|
1547
1838
|
);
|
|
1548
|
-
const rnDateTimePickerStyle =
|
|
1839
|
+
const rnDateTimePickerStyle = useMemo9(
|
|
1549
1840
|
() => ({
|
|
1550
1841
|
flex: iOSDateTimeFullSize ? 1 : void 0,
|
|
1551
1842
|
marginLeft: -8 + (iOSDateTimeFullSize ? 0 : theme2.styles.space)
|
|
1552
1843
|
}),
|
|
1553
1844
|
[iOSDateTimeFullSize]
|
|
1554
1845
|
);
|
|
1555
|
-
|
|
1846
|
+
useEffect6(() => {
|
|
1556
1847
|
if (value === void 0) return;
|
|
1557
1848
|
setInternalValue(value.toString());
|
|
1558
1849
|
try {
|
|
@@ -1560,7 +1851,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1560
1851
|
} catch (error) {
|
|
1561
1852
|
}
|
|
1562
1853
|
}, [value]);
|
|
1563
|
-
|
|
1854
|
+
useEffect6(() => {
|
|
1564
1855
|
if (type !== "date" && type !== "time") return;
|
|
1565
1856
|
const date = internalDateValue?.toISOString().split("T")[0] ?? "";
|
|
1566
1857
|
const hours = internalDateValue ? internalDateValue.getHours().toString() : "00";
|
|
@@ -1578,11 +1869,11 @@ var InputFieldComponent = forwardRef(
|
|
|
1578
1869
|
);
|
|
1579
1870
|
const withPressInputField = !!onPress || type === "date" || type === "time";
|
|
1580
1871
|
const prefixSuffixBackgroundColor = colorTheme === "light" ? darkenColor(theme2.colors.backgroundContent, 0.03) : lightenColor(theme2.colors.backgroundContent, 0.1);
|
|
1581
|
-
const labelComponent = label && /* @__PURE__ */
|
|
1582
|
-
/* @__PURE__ */
|
|
1583
|
-
required && /* @__PURE__ */
|
|
1872
|
+
const labelComponent = label && /* @__PURE__ */ jsxs6(View_default, { isRow: true, alignItems: "center", gap: 2, children: [
|
|
1873
|
+
/* @__PURE__ */ jsx12(Text_default, { fontSize: 14, color: isError ? theme2.colors.error : theme2.colors.textSecondary, children: label }),
|
|
1874
|
+
required && /* @__PURE__ */ jsx12(Text_default, { color: theme2.colors.error, children: "*" })
|
|
1584
1875
|
] });
|
|
1585
|
-
return /* @__PURE__ */
|
|
1876
|
+
return /* @__PURE__ */ jsxs6(
|
|
1586
1877
|
Animate_default.View,
|
|
1587
1878
|
{
|
|
1588
1879
|
flex,
|
|
@@ -1592,8 +1883,8 @@ var InputFieldComponent = forwardRef(
|
|
|
1592
1883
|
...props,
|
|
1593
1884
|
children: [
|
|
1594
1885
|
isIOSDateTime && !iOSDateTimeFullSize ? void 0 : labelComponent,
|
|
1595
|
-
/* @__PURE__ */
|
|
1596
|
-
prefix && /* @__PURE__ */
|
|
1886
|
+
/* @__PURE__ */ jsxs6(View_default, { isRow: true, position: "relative", alignItems: "center", height: readyHeight, children: [
|
|
1887
|
+
prefix && /* @__PURE__ */ jsx12(
|
|
1597
1888
|
View_default,
|
|
1598
1889
|
{
|
|
1599
1890
|
isRow: true,
|
|
@@ -1608,7 +1899,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1608
1899
|
borderColor: theme2.colors.border,
|
|
1609
1900
|
paddingHorizontal: readyPaddingHorizontal,
|
|
1610
1901
|
onPress: onPressPrefix,
|
|
1611
|
-
children: typeof prefix === "string" ? /* @__PURE__ */
|
|
1902
|
+
children: typeof prefix === "string" ? /* @__PURE__ */ jsx12(
|
|
1612
1903
|
Text_default,
|
|
1613
1904
|
{
|
|
1614
1905
|
fontWeight: 700,
|
|
@@ -1619,9 +1910,9 @@ var InputFieldComponent = forwardRef(
|
|
|
1619
1910
|
) : prefix
|
|
1620
1911
|
}
|
|
1621
1912
|
),
|
|
1622
|
-
isIOSDateTime ? /* @__PURE__ */
|
|
1913
|
+
isIOSDateTime ? /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
1623
1914
|
!iOSDateTimeFullSize ? labelComponent : void 0,
|
|
1624
|
-
/* @__PURE__ */
|
|
1915
|
+
/* @__PURE__ */ jsx12(
|
|
1625
1916
|
RNDateTimePicker,
|
|
1626
1917
|
{
|
|
1627
1918
|
value: internalDateValue ?? /* @__PURE__ */ new Date(),
|
|
@@ -1633,7 +1924,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1633
1924
|
onChange: onChangeRNDateTimePicker
|
|
1634
1925
|
}
|
|
1635
1926
|
)
|
|
1636
|
-
] }) : /* @__PURE__ */
|
|
1927
|
+
] }) : /* @__PURE__ */ jsx12(
|
|
1637
1928
|
View_default,
|
|
1638
1929
|
{
|
|
1639
1930
|
flex: 1,
|
|
@@ -1644,7 +1935,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1644
1935
|
borderBottomRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1645
1936
|
pressStrength: 1,
|
|
1646
1937
|
onPress: Platform5.OS === "android" ? editable === false || withPressInputField ? onPressInputField : void 0 : void 0,
|
|
1647
|
-
children: /* @__PURE__ */
|
|
1938
|
+
children: /* @__PURE__ */ jsxs6(
|
|
1648
1939
|
Animate_default.View,
|
|
1649
1940
|
{
|
|
1650
1941
|
position: "relative",
|
|
@@ -1660,7 +1951,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1660
1951
|
animateBorderColor: isFocused ? theme2.colors.primary : isError ? theme2.colors.error : theme2.colors.border,
|
|
1661
1952
|
overflow: "hidden",
|
|
1662
1953
|
children: [
|
|
1663
|
-
leftIcon && /* @__PURE__ */
|
|
1954
|
+
leftIcon && /* @__PURE__ */ jsx12(
|
|
1664
1955
|
Icon_default,
|
|
1665
1956
|
{
|
|
1666
1957
|
position: "absolute",
|
|
@@ -1673,7 +1964,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1673
1964
|
onPress: onPressLeftIcon
|
|
1674
1965
|
}
|
|
1675
1966
|
),
|
|
1676
|
-
/* @__PURE__ */
|
|
1967
|
+
/* @__PURE__ */ jsx12(
|
|
1677
1968
|
TextInput2,
|
|
1678
1969
|
{
|
|
1679
1970
|
style: textInputStyle,
|
|
@@ -1706,7 +1997,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1706
1997
|
ref: textInputRef
|
|
1707
1998
|
}
|
|
1708
1999
|
),
|
|
1709
|
-
rightIcon && /* @__PURE__ */
|
|
2000
|
+
rightIcon && /* @__PURE__ */ jsx12(
|
|
1710
2001
|
Icon_default,
|
|
1711
2002
|
{
|
|
1712
2003
|
position: "absolute",
|
|
@@ -1724,7 +2015,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1724
2015
|
)
|
|
1725
2016
|
}
|
|
1726
2017
|
),
|
|
1727
|
-
suffix && /* @__PURE__ */
|
|
2018
|
+
suffix && /* @__PURE__ */ jsx12(
|
|
1728
2019
|
View_default,
|
|
1729
2020
|
{
|
|
1730
2021
|
isRow: true,
|
|
@@ -1738,7 +2029,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1738
2029
|
borderColor: theme2.colors.border,
|
|
1739
2030
|
paddingHorizontal: readyPaddingHorizontal,
|
|
1740
2031
|
onPress: onPressSuffix,
|
|
1741
|
-
children: typeof suffix === "string" ? /* @__PURE__ */
|
|
2032
|
+
children: typeof suffix === "string" ? /* @__PURE__ */ jsx12(
|
|
1742
2033
|
Text_default,
|
|
1743
2034
|
{
|
|
1744
2035
|
fontWeight: 700,
|
|
@@ -1750,7 +2041,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1750
2041
|
}
|
|
1751
2042
|
)
|
|
1752
2043
|
] }),
|
|
1753
|
-
infoMessage && /* @__PURE__ */
|
|
2044
|
+
infoMessage && /* @__PURE__ */ jsx12(
|
|
1754
2045
|
Animate_default.Text,
|
|
1755
2046
|
{
|
|
1756
2047
|
fontSize: 14,
|
|
@@ -1762,7 +2053,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1762
2053
|
children: infoMessage
|
|
1763
2054
|
}
|
|
1764
2055
|
),
|
|
1765
|
-
errorMessage && /* @__PURE__ */
|
|
2056
|
+
errorMessage && /* @__PURE__ */ jsx12(
|
|
1766
2057
|
Animate_default.Text,
|
|
1767
2058
|
{
|
|
1768
2059
|
fontSize: 14,
|
|
@@ -1780,7 +2071,7 @@ var InputFieldComponent = forwardRef(
|
|
|
1780
2071
|
}
|
|
1781
2072
|
);
|
|
1782
2073
|
InputFieldComponent.email = forwardRef(function Email(props, ref) {
|
|
1783
|
-
return /* @__PURE__ */
|
|
2074
|
+
return /* @__PURE__ */ jsx12(
|
|
1784
2075
|
InputFieldComponent,
|
|
1785
2076
|
{
|
|
1786
2077
|
placeholder: "your@email.here",
|
|
@@ -1794,9 +2085,9 @@ InputFieldComponent.email = forwardRef(function Email(props, ref) {
|
|
|
1794
2085
|
);
|
|
1795
2086
|
});
|
|
1796
2087
|
InputFieldComponent.password = forwardRef(function Password(props, ref) {
|
|
1797
|
-
const inputFieldRef =
|
|
2088
|
+
const inputFieldRef = useRef3(null);
|
|
1798
2089
|
const [showPassword, setShowPassword] = useBooleanState4();
|
|
1799
|
-
const onPressEye =
|
|
2090
|
+
const onPressEye = useCallback6(() => {
|
|
1800
2091
|
setShowPassword.toggle();
|
|
1801
2092
|
inputFieldRef.current?.focus();
|
|
1802
2093
|
}, []);
|
|
@@ -1807,7 +2098,7 @@ InputFieldComponent.password = forwardRef(function Password(props, ref) {
|
|
|
1807
2098
|
},
|
|
1808
2099
|
[]
|
|
1809
2100
|
);
|
|
1810
|
-
return /* @__PURE__ */
|
|
2101
|
+
return /* @__PURE__ */ jsx12(
|
|
1811
2102
|
InputFieldComponent,
|
|
1812
2103
|
{
|
|
1813
2104
|
secureTextEntry: !showPassword,
|
|
@@ -1823,11 +2114,11 @@ InputFieldComponent.password = forwardRef(function Password(props, ref) {
|
|
|
1823
2114
|
);
|
|
1824
2115
|
});
|
|
1825
2116
|
InputFieldComponent.search = forwardRef(function Search(props, ref) {
|
|
1826
|
-
return /* @__PURE__ */
|
|
2117
|
+
return /* @__PURE__ */ jsx12(InputFieldComponent, { placeholder: "Search...", leftIcon: "magnifyingGlass", ...props, ref });
|
|
1827
2118
|
});
|
|
1828
2119
|
InputFieldComponent.code = forwardRef(function Password2({ isSmall, ...props }, ref) {
|
|
1829
|
-
const theme2 =
|
|
1830
|
-
return /* @__PURE__ */
|
|
2120
|
+
const theme2 = useTheme11();
|
|
2121
|
+
return /* @__PURE__ */ jsx12(
|
|
1831
2122
|
InputFieldComponent,
|
|
1832
2123
|
{
|
|
1833
2124
|
flex: 1,
|
|
@@ -1842,7 +2133,7 @@ InputFieldComponent.code = forwardRef(function Password2({ isSmall, ...props },
|
|
|
1842
2133
|
}
|
|
1843
2134
|
);
|
|
1844
2135
|
});
|
|
1845
|
-
var InputField =
|
|
2136
|
+
var InputField = memo12(InputFieldComponent);
|
|
1846
2137
|
InputField.email = InputFieldComponent.email;
|
|
1847
2138
|
InputField.password = InputFieldComponent.password;
|
|
1848
2139
|
InputField.search = InputFieldComponent.search;
|
|
@@ -1850,32 +2141,32 @@ InputField.code = InputFieldComponent.code;
|
|
|
1850
2141
|
var InputField_default = InputField;
|
|
1851
2142
|
|
|
1852
2143
|
// src/components/Switch.tsx
|
|
1853
|
-
import { memo as
|
|
2144
|
+
import { memo as memo13, useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo10 } from "react";
|
|
1854
2145
|
import { Switch as NativeSwitch, Platform as Platform6 } from "react-native";
|
|
1855
|
-
import { useBooleanState as useBooleanState5, useTheme as
|
|
1856
|
-
import { jsx as
|
|
2146
|
+
import { useBooleanState as useBooleanState5, useTheme as useTheme12 } from "react-better-core";
|
|
2147
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1857
2148
|
function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
1858
|
-
const theme2 =
|
|
2149
|
+
const theme2 = useTheme12();
|
|
1859
2150
|
const [enabled, setEnabled] = useBooleanState5(isEnabled ?? defaultIsEnabled);
|
|
1860
|
-
const onPressElement =
|
|
2151
|
+
const onPressElement = useCallback7(() => {
|
|
1861
2152
|
onChange?.(!enabled);
|
|
1862
2153
|
setEnabled.toggle();
|
|
1863
2154
|
}, [onChange, enabled]);
|
|
1864
|
-
const trackColor =
|
|
2155
|
+
const trackColor = useMemo10(
|
|
1865
2156
|
() => ({
|
|
1866
2157
|
false: theme2.colors.border,
|
|
1867
2158
|
true: theme2.colors.primary
|
|
1868
2159
|
}),
|
|
1869
2160
|
[theme2.colors]
|
|
1870
2161
|
);
|
|
1871
|
-
|
|
2162
|
+
useEffect7(() => {
|
|
1872
2163
|
if (isEnabled === void 0) return;
|
|
1873
2164
|
setEnabled.setState(isEnabled);
|
|
1874
2165
|
}, [isEnabled]);
|
|
1875
2166
|
const ballSize = 26;
|
|
1876
2167
|
const ballGap = 3;
|
|
1877
2168
|
const holderWidth = ballSize * 2.1;
|
|
1878
|
-
return Platform6.OS === "ios" ? /* @__PURE__ */
|
|
2169
|
+
return Platform6.OS === "ios" ? /* @__PURE__ */ jsx13(
|
|
1879
2170
|
NativeSwitch,
|
|
1880
2171
|
{
|
|
1881
2172
|
trackColor,
|
|
@@ -1884,7 +2175,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1884
2175
|
value: enabled,
|
|
1885
2176
|
disabled
|
|
1886
2177
|
}
|
|
1887
|
-
) : /* @__PURE__ */
|
|
2178
|
+
) : /* @__PURE__ */ jsx13(
|
|
1888
2179
|
View_default,
|
|
1889
2180
|
{
|
|
1890
2181
|
width: holderWidth,
|
|
@@ -1892,7 +2183,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1892
2183
|
pressStrength: pressStrength().p05,
|
|
1893
2184
|
disabled,
|
|
1894
2185
|
onPress: !disabled ? onPressElement : void 0,
|
|
1895
|
-
children: /* @__PURE__ */
|
|
2186
|
+
children: /* @__PURE__ */ jsx13(
|
|
1896
2187
|
Animate_default.View,
|
|
1897
2188
|
{
|
|
1898
2189
|
width: "100%",
|
|
@@ -1902,7 +2193,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1902
2193
|
animateOpacity: disabled ? 0.6 : 1,
|
|
1903
2194
|
initialBackgroundColor: theme2.colors.border,
|
|
1904
2195
|
animateBackgroundColor: enabled ? theme2.colors.primary : theme2.colors.border,
|
|
1905
|
-
children: /* @__PURE__ */
|
|
2196
|
+
children: /* @__PURE__ */ jsx13(
|
|
1906
2197
|
Animate_default.View,
|
|
1907
2198
|
{
|
|
1908
2199
|
width: ballSize,
|
|
@@ -1919,16 +2210,16 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1919
2210
|
}
|
|
1920
2211
|
);
|
|
1921
2212
|
}
|
|
1922
|
-
var Switch_default =
|
|
2213
|
+
var Switch_default = memo13(Switch);
|
|
1923
2214
|
|
|
1924
2215
|
// src/components/StatusBar.tsx
|
|
1925
|
-
import { memo as
|
|
1926
|
-
import { useTheme as
|
|
2216
|
+
import { memo as memo14 } from "react";
|
|
2217
|
+
import { useTheme as useTheme13 } from "react-better-core";
|
|
1927
2218
|
import { StatusBar as NativeStatusBar, Platform as Platform7 } from "react-native";
|
|
1928
|
-
import { jsx as
|
|
2219
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1929
2220
|
function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }) {
|
|
1930
|
-
const theme2 =
|
|
1931
|
-
return /* @__PURE__ */
|
|
2221
|
+
const theme2 = useTheme13();
|
|
2222
|
+
return /* @__PURE__ */ jsx14(
|
|
1932
2223
|
NativeStatusBar,
|
|
1933
2224
|
{
|
|
1934
2225
|
backgroundColor: darkStatusBar ? theme2.colors.backgroundSecondary : void 0,
|
|
@@ -1937,29 +2228,31 @@ function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarSty
|
|
|
1937
2228
|
}
|
|
1938
2229
|
);
|
|
1939
2230
|
}
|
|
1940
|
-
var StatusBar_default =
|
|
2231
|
+
var StatusBar_default = memo14(StatusBar);
|
|
1941
2232
|
|
|
1942
2233
|
// src/components/ListItem.tsx
|
|
1943
|
-
import { memo as
|
|
1944
|
-
import { useTheme as
|
|
1945
|
-
import { Fragment as
|
|
2234
|
+
import { memo as memo15 } from "react";
|
|
2235
|
+
import { useTheme as useTheme14 } from "react-better-core";
|
|
2236
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1946
2237
|
function ListItem({
|
|
1947
2238
|
icon,
|
|
1948
2239
|
iconIOS,
|
|
1949
2240
|
title,
|
|
1950
2241
|
description,
|
|
2242
|
+
descriptionSelectable,
|
|
1951
2243
|
rightElement,
|
|
1952
2244
|
backgroundColor,
|
|
1953
2245
|
insideScreenHolder,
|
|
1954
2246
|
onPress,
|
|
1955
|
-
|
|
2247
|
+
rightValue,
|
|
2248
|
+
rightValueSelectable,
|
|
1956
2249
|
switchIsEnabled,
|
|
1957
2250
|
switchOnChange
|
|
1958
2251
|
}) {
|
|
1959
|
-
const theme2 =
|
|
2252
|
+
const theme2 = useTheme14();
|
|
1960
2253
|
const device = useDevice();
|
|
1961
2254
|
const sideSpace = theme2.styles.space;
|
|
1962
|
-
return /* @__PURE__ */
|
|
2255
|
+
return /* @__PURE__ */ jsx15(
|
|
1963
2256
|
View_default,
|
|
1964
2257
|
{
|
|
1965
2258
|
width: insideScreenHolder ? device.windowDimensions.width : "100%",
|
|
@@ -1969,41 +2262,28 @@ function ListItem({
|
|
|
1969
2262
|
paddingHorizontal: sideSpace,
|
|
1970
2263
|
pressStrength: pressStrength().p05,
|
|
1971
2264
|
onPress,
|
|
1972
|
-
children: /* @__PURE__ */
|
|
1973
|
-
icon && /* @__PURE__ */
|
|
1974
|
-
/* @__PURE__ */
|
|
1975
|
-
title && /* @__PURE__ */
|
|
1976
|
-
description && /* @__PURE__ */
|
|
2265
|
+
children: /* @__PURE__ */ jsxs7(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.space, children: [
|
|
2266
|
+
icon && /* @__PURE__ */ jsx15(Icon_default, { name: icon, nameIOS: iconIOS, size: 22, color: theme2.colors.primary }),
|
|
2267
|
+
/* @__PURE__ */ jsx15(View_default, { flex: 1, flexDirection: "row", alignItems: "center", gap: theme2.styles.gap, children: /* @__PURE__ */ jsxs7(View_default, { flex: 1, children: [
|
|
2268
|
+
title && /* @__PURE__ */ jsx15(Text_default, { fontSize: 20, fontWeight: 700, children: title }),
|
|
2269
|
+
description && /* @__PURE__ */ jsx15(Text_default.body, { selectable: descriptionSelectable, children: description })
|
|
1977
2270
|
] }) }),
|
|
1978
|
-
rightElement ? /* @__PURE__ */
|
|
1979
|
-
|
|
1980
|
-
/* @__PURE__ */
|
|
2271
|
+
rightElement ? /* @__PURE__ */ jsx15(Fragment5, { children: rightValue !== void 0 || rightElement === "arrow" ? /* @__PURE__ */ jsxs7(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
2272
|
+
rightValue !== void 0 && /* @__PURE__ */ jsx15(Text_default, { fontSize: 14, fontWeight: 700, selectable: rightValueSelectable, children: rightValue }),
|
|
2273
|
+
rightElement === "arrow" && /* @__PURE__ */ jsx15(
|
|
1981
2274
|
Icon_default,
|
|
1982
2275
|
{
|
|
1983
2276
|
name: "chevronRight",
|
|
1984
2277
|
nameIOS: "chevron.right",
|
|
1985
|
-
color:
|
|
2278
|
+
color: rightValue !== void 0 ? theme2.colors.textPrimary : theme2.colors.textSecondary
|
|
1986
2279
|
}
|
|
1987
2280
|
)
|
|
1988
|
-
] }) : rightElement === "switch" ? /* @__PURE__ */
|
|
2281
|
+
] }) : rightElement === "switch" ? /* @__PURE__ */ jsx15(Switch_default, { isEnabled: switchIsEnabled, onChange: switchOnChange }) : void 0 }) : void 0
|
|
1989
2282
|
] })
|
|
1990
2283
|
}
|
|
1991
2284
|
);
|
|
1992
2285
|
}
|
|
1993
|
-
var ListItem_default =
|
|
1994
|
-
|
|
1995
|
-
// src/plugins/asyncStorage.ts
|
|
1996
|
-
var defaultAsyncStoragePluginOptions = {};
|
|
1997
|
-
var asyncStoragePlugin = (options) => ({
|
|
1998
|
-
name: "asyncStorage",
|
|
1999
|
-
initialize: () => {
|
|
2000
|
-
console.log("asyncStorage plugin initialized");
|
|
2001
|
-
},
|
|
2002
|
-
getConfig: () => ({
|
|
2003
|
-
...defaultAsyncStoragePluginOptions,
|
|
2004
|
-
...options
|
|
2005
|
-
})
|
|
2006
|
-
});
|
|
2286
|
+
var ListItem_default = memo15(ListItem);
|
|
2007
2287
|
export {
|
|
2008
2288
|
Animate_default as Animate,
|
|
2009
2289
|
BetterComponentsProvider_default as BetterComponentsProvider,
|
|
@@ -2018,10 +2298,13 @@ export {
|
|
|
2018
2298
|
Switch_default as Switch,
|
|
2019
2299
|
Text_default as Text,
|
|
2020
2300
|
View_default as View,
|
|
2301
|
+
alertControls,
|
|
2302
|
+
alertsPlugin,
|
|
2021
2303
|
asyncStoragePlugin,
|
|
2022
2304
|
colorThemeControls,
|
|
2023
2305
|
countries,
|
|
2024
2306
|
darkenColor2 as darkenColor,
|
|
2307
|
+
defaultAlertsPluginOptions,
|
|
2025
2308
|
defaultAsyncStoragePluginOptions,
|
|
2026
2309
|
desaturateColor,
|
|
2027
2310
|
eventPreventDefault,
|
|
@@ -2029,13 +2312,14 @@ export {
|
|
|
2029
2312
|
eventStopPropagation,
|
|
2030
2313
|
formatPhoneNumber,
|
|
2031
2314
|
generateAsyncStorage,
|
|
2032
|
-
generateRandomString,
|
|
2315
|
+
generateRandomString3 as generateRandomString,
|
|
2033
2316
|
getFormErrorObject,
|
|
2034
2317
|
getPluralWord,
|
|
2035
2318
|
lightenColor2 as lightenColor,
|
|
2036
2319
|
loaderControls,
|
|
2037
2320
|
pressStrength,
|
|
2038
2321
|
saturateColor,
|
|
2322
|
+
useAlertControls,
|
|
2039
2323
|
useBetterComponentsContext,
|
|
2040
2324
|
useBooleanState6 as useBooleanState,
|
|
2041
2325
|
useDebounceState,
|
|
@@ -2045,6 +2329,6 @@ export {
|
|
|
2045
2329
|
useKeyboard,
|
|
2046
2330
|
useLoader2 as useLoader,
|
|
2047
2331
|
useLoaderControls,
|
|
2048
|
-
|
|
2332
|
+
useTheme15 as useTheme
|
|
2049
2333
|
};
|
|
2050
2334
|
//# sourceMappingURL=index.mjs.map
|