react-native-better-html 1.0.18 → 1.0.20
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 +888 -590
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +771 -474
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,44 +43,49 @@ __export(index_exports, {
|
|
|
43
43
|
Switch: () => Switch_default,
|
|
44
44
|
Text: () => Text_default,
|
|
45
45
|
View: () => View_default,
|
|
46
|
+
alertControls: () => alertControls,
|
|
47
|
+
alertsPlugin: () => alertsPlugin,
|
|
46
48
|
asyncStoragePlugin: () => asyncStoragePlugin,
|
|
47
|
-
colorThemeControls: () =>
|
|
48
|
-
countries: () =>
|
|
49
|
-
darkenColor: () =>
|
|
49
|
+
colorThemeControls: () => import_react_better_core17.colorThemeControls,
|
|
50
|
+
countries: () => import_react_better_core17.countries,
|
|
51
|
+
darkenColor: () => import_react_better_core17.darkenColor,
|
|
52
|
+
defaultAlertsPluginOptions: () => defaultAlertsPluginOptions,
|
|
50
53
|
defaultAsyncStoragePluginOptions: () => defaultAsyncStoragePluginOptions,
|
|
51
|
-
desaturateColor: () =>
|
|
52
|
-
eventPreventDefault: () =>
|
|
53
|
-
eventPreventStop: () =>
|
|
54
|
-
eventStopPropagation: () =>
|
|
55
|
-
formatPhoneNumber: () =>
|
|
54
|
+
desaturateColor: () => import_react_better_core17.desaturateColor,
|
|
55
|
+
eventPreventDefault: () => import_react_better_core17.eventPreventDefault,
|
|
56
|
+
eventPreventStop: () => import_react_better_core17.eventPreventStop,
|
|
57
|
+
eventStopPropagation: () => import_react_better_core17.eventStopPropagation,
|
|
58
|
+
formatPhoneNumber: () => import_react_better_core17.formatPhoneNumber,
|
|
56
59
|
generateAsyncStorage: () => generateAsyncStorage,
|
|
57
|
-
generateRandomString: () =>
|
|
60
|
+
generateRandomString: () => import_react_better_core17.generateRandomString,
|
|
58
61
|
getFormErrorObject: () => getFormErrorObject,
|
|
59
|
-
getPluralWord: () =>
|
|
60
|
-
lightenColor: () =>
|
|
61
|
-
loaderControls: () =>
|
|
62
|
+
getPluralWord: () => import_react_better_core17.getPluralWord,
|
|
63
|
+
lightenColor: () => import_react_better_core17.lightenColor,
|
|
64
|
+
loaderControls: () => import_react_better_core17.loaderControls,
|
|
62
65
|
pressStrength: () => pressStrength,
|
|
63
|
-
saturateColor: () =>
|
|
66
|
+
saturateColor: () => import_react_better_core17.saturateColor,
|
|
67
|
+
useAlertControls: () => useAlertControls,
|
|
64
68
|
useBetterComponentsContext: () => useBetterComponentsContext,
|
|
65
|
-
useBooleanState: () =>
|
|
66
|
-
useDebounceState: () =>
|
|
69
|
+
useBooleanState: () => import_react_better_core17.useBooleanState,
|
|
70
|
+
useDebounceState: () => import_react_better_core17.useDebounceState,
|
|
67
71
|
useDevice: () => useDevice,
|
|
68
72
|
useEventEmitter: () => useEventEmitter,
|
|
69
73
|
useForm: () => useForm,
|
|
70
74
|
useKeyboard: () => useKeyboard,
|
|
71
|
-
useLoader: () =>
|
|
72
|
-
useLoaderControls: () =>
|
|
73
|
-
useTheme: () =>
|
|
75
|
+
useLoader: () => import_react_better_core17.useLoader,
|
|
76
|
+
useLoaderControls: () => import_react_better_core17.useLoaderControls,
|
|
77
|
+
useTheme: () => import_react_better_core17.useTheme
|
|
74
78
|
});
|
|
75
79
|
module.exports = __toCommonJS(index_exports);
|
|
76
|
-
var
|
|
80
|
+
var import_react_better_core17 = require("react-better-core");
|
|
77
81
|
|
|
78
82
|
// src/components/BetterComponentsProvider.tsx
|
|
79
|
-
var
|
|
80
|
-
var
|
|
83
|
+
var import_react12 = require("react");
|
|
84
|
+
var import_react_better_core11 = require("react-better-core");
|
|
81
85
|
|
|
82
86
|
// src/constants/app.ts
|
|
83
87
|
var appConfig = {};
|
|
88
|
+
var defaultAlertDuration = 2.3 * 1e3;
|
|
84
89
|
|
|
85
90
|
// src/constants/theme.ts
|
|
86
91
|
var theme = {};
|
|
@@ -122,115 +127,15 @@ var icons = {
|
|
|
122
127
|
// src/constants/assets.ts
|
|
123
128
|
var assets = {};
|
|
124
129
|
|
|
125
|
-
// src/components/
|
|
126
|
-
var
|
|
127
|
-
var
|
|
128
|
-
var externalBetterCoreContextValue;
|
|
129
|
-
var externalBetterComponentsContextValue;
|
|
130
|
-
var useBetterComponentsContext = () => {
|
|
131
|
-
const coreContext = (0, import_react_better_core.useBetterCoreContext)();
|
|
132
|
-
const context = (0, import_react.useContext)(betterComponentsContext);
|
|
133
|
-
if (context === void 0)
|
|
134
|
-
throw new Error(
|
|
135
|
-
"`useBetterComponentsContext()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
136
|
-
);
|
|
137
|
-
const { plugins, componentsState, ...rest } = context;
|
|
138
|
-
return {
|
|
139
|
-
...coreContext,
|
|
140
|
-
...rest
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
function BetterComponentsProviderInternalContent({ children }) {
|
|
144
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
145
|
-
}
|
|
146
|
-
function BetterComponentsProviderInternal({
|
|
147
|
-
config,
|
|
148
|
-
plugins,
|
|
149
|
-
children
|
|
150
|
-
}) {
|
|
151
|
-
const betterCoreContext = (0, import_react_better_core.useBetterCoreContext)();
|
|
152
|
-
const [sideMenuIsCollapsed, setSideMenuIsCollapsed] = (0, import_react_better_core.useBooleanState)();
|
|
153
|
-
const [sideMenuIsOpenMobile, setSideMenuIsOpenMobile] = (0, import_react_better_core.useBooleanState)();
|
|
154
|
-
const readyConfig = (0, import_react.useMemo)(
|
|
155
|
-
() => ({
|
|
156
|
-
app: {
|
|
157
|
-
...appConfig,
|
|
158
|
-
...config?.app
|
|
159
|
-
},
|
|
160
|
-
sideMenuIsCollapsed,
|
|
161
|
-
setSideMenuIsCollapsed,
|
|
162
|
-
sideMenuIsOpenMobile,
|
|
163
|
-
setSideMenuIsOpenMobile,
|
|
164
|
-
plugins: plugins ?? [],
|
|
165
|
-
componentsState: {}
|
|
166
|
-
}),
|
|
167
|
-
[config, sideMenuIsCollapsed, sideMenuIsOpenMobile, plugins]
|
|
168
|
-
);
|
|
169
|
-
(0, import_react.useEffect)(() => {
|
|
170
|
-
if (!plugins) return;
|
|
171
|
-
plugins.forEach((plugin) => {
|
|
172
|
-
plugin.initialize?.();
|
|
173
|
-
});
|
|
174
|
-
}, []);
|
|
175
|
-
externalBetterCoreContextValue = betterCoreContext;
|
|
176
|
-
externalBetterComponentsContextValue = readyConfig;
|
|
177
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(betterComponentsContext.Provider, { value: readyConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BetterComponentsProviderInternalContent, { children }) });
|
|
178
|
-
}
|
|
179
|
-
function BetterComponentsProvider({ config, ...props }) {
|
|
180
|
-
const coreConfig = (0, import_react.useMemo)(
|
|
181
|
-
() => ({
|
|
182
|
-
theme: {
|
|
183
|
-
...theme,
|
|
184
|
-
...config?.theme
|
|
185
|
-
},
|
|
186
|
-
// colorTheme: config?.colorTheme ?? (localStorage.getItem("theme") === "dark" ? "dark" : "light"),
|
|
187
|
-
colorTheme: config?.colorTheme ?? "light",
|
|
188
|
-
icons: {
|
|
189
|
-
...icons,
|
|
190
|
-
...config?.icons
|
|
191
|
-
},
|
|
192
|
-
assets: {
|
|
193
|
-
...assets,
|
|
194
|
-
...config?.assets
|
|
195
|
-
},
|
|
196
|
-
loaders: config?.loaders
|
|
197
|
-
}),
|
|
198
|
-
[config]
|
|
199
|
-
);
|
|
200
|
-
const componentsConfig = (0, import_react.useMemo)(
|
|
201
|
-
() => ({
|
|
202
|
-
app: config?.app
|
|
203
|
-
}),
|
|
204
|
-
[config]
|
|
205
|
-
);
|
|
206
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_better_core.BetterCoreProvider, { config: coreConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BetterComponentsProviderInternal, { config: componentsConfig, ...props }) });
|
|
207
|
-
}
|
|
208
|
-
var BetterComponentsProvider_default = (0, import_react.memo)(BetterComponentsProvider);
|
|
209
|
-
|
|
210
|
-
// src/utils/variableFunctions.ts
|
|
211
|
-
var checkBetterCoreContextValue = (value, functionsName) => {
|
|
212
|
-
if (value === void 0) {
|
|
213
|
-
throw new Error(
|
|
214
|
-
`\`${functionsName}()\` must be used within a \`<BetterCoreProvider>\`. Make sure to add one at the root of your component tree.`
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
return value !== void 0;
|
|
218
|
-
};
|
|
219
|
-
var pressStrength = () => {
|
|
220
|
-
if (!checkBetterCoreContextValue(externalBetterCoreContextValue, "pressStrength")) return void 0;
|
|
221
|
-
return {
|
|
222
|
-
p05: externalBetterCoreContextValue.colorTheme === "dark" ? 0.85 : 0.95,
|
|
223
|
-
p1: externalBetterCoreContextValue.colorTheme === "dark" ? 0.6 : 0.8,
|
|
224
|
-
p2: externalBetterCoreContextValue.colorTheme === "dark" ? 0.5 : 0.7,
|
|
225
|
-
p3: externalBetterCoreContextValue.colorTheme === "dark" ? 0.4 : 0.6
|
|
226
|
-
};
|
|
227
|
-
};
|
|
130
|
+
// src/components/alerts/AlertsHolder.tsx
|
|
131
|
+
var import_react11 = require("react");
|
|
132
|
+
var import_react_better_core10 = require("react-better-core");
|
|
228
133
|
|
|
229
134
|
// src/utils/hooks.ts
|
|
230
|
-
var
|
|
135
|
+
var import_react = require("react");
|
|
231
136
|
var import_react_native = require("react-native");
|
|
232
137
|
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
233
|
-
var
|
|
138
|
+
var import_react_better_core = require("react-better-core");
|
|
234
139
|
|
|
235
140
|
// src/constants/css.ts
|
|
236
141
|
var cssProps = /* @__PURE__ */ new Set([
|
|
@@ -423,7 +328,7 @@ var animateTransitionProps = /* @__PURE__ */ new Set([
|
|
|
423
328
|
|
|
424
329
|
// src/utils/hooks.ts
|
|
425
330
|
function useDevice() {
|
|
426
|
-
const theme2 = (0,
|
|
331
|
+
const theme2 = (0, import_react_better_core.useTheme)();
|
|
427
332
|
const safeAreaInsets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
428
333
|
const screenDimensions = import_react_native.Dimensions.get("screen");
|
|
429
334
|
const windowDimensions = import_react_native.Dimensions.get("window");
|
|
@@ -448,10 +353,10 @@ function useDevice() {
|
|
|
448
353
|
};
|
|
449
354
|
}
|
|
450
355
|
function useKeyboard() {
|
|
451
|
-
const [keyboardOpened, setKeyboardOpened] = (0,
|
|
452
|
-
const [keyboardWillOpen, setKeyboardWillOpen] = (0,
|
|
453
|
-
const [keyboardHeight, setKeyboardHeight] = (0,
|
|
454
|
-
(0,
|
|
356
|
+
const [keyboardOpened, setKeyboardOpened] = (0, import_react_better_core.useBooleanState)();
|
|
357
|
+
const [keyboardWillOpen, setKeyboardWillOpen] = (0, import_react_better_core.useBooleanState)();
|
|
358
|
+
const [keyboardHeight, setKeyboardHeight] = (0, import_react.useState)(0);
|
|
359
|
+
(0, import_react.useEffect)(() => {
|
|
455
360
|
const keyboardDidShow = (event) => {
|
|
456
361
|
setKeyboardOpened.setTrue();
|
|
457
362
|
setKeyboardHeight(event.endCoordinates.height);
|
|
@@ -478,7 +383,7 @@ function useKeyboard() {
|
|
|
478
383
|
};
|
|
479
384
|
}
|
|
480
385
|
function useComponentPropsGrouper(props, prefix) {
|
|
481
|
-
return (0,
|
|
386
|
+
return (0, import_react.useMemo)(() => {
|
|
482
387
|
const style = {};
|
|
483
388
|
const withPrefixStyle = {};
|
|
484
389
|
const restProps = {};
|
|
@@ -504,14 +409,14 @@ function useComponentPropsGrouper(props, prefix) {
|
|
|
504
409
|
}
|
|
505
410
|
function useForm(options) {
|
|
506
411
|
const { defaultValues, requiredFields, additional, onSubmit, validate } = options;
|
|
507
|
-
const inputFieldRefs = (0,
|
|
412
|
+
const inputFieldRefs = (0, import_react.useRef)(
|
|
508
413
|
{}
|
|
509
414
|
);
|
|
510
|
-
const [values, setValues] = (0,
|
|
511
|
-
const [errors, setErrors] = (0,
|
|
512
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
415
|
+
const [values, setValues] = (0, import_react.useState)(defaultValues);
|
|
416
|
+
const [errors, setErrors] = (0, import_react.useState)({});
|
|
417
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react_better_core.useBooleanState)();
|
|
513
418
|
const numberOfInputFields = Object.keys(defaultValues).length;
|
|
514
|
-
const setFieldValue = (0,
|
|
419
|
+
const setFieldValue = (0, import_react.useCallback)(
|
|
515
420
|
(field, value) => {
|
|
516
421
|
setValues((oldValue) => ({
|
|
517
422
|
...oldValue,
|
|
@@ -524,7 +429,7 @@ function useForm(options) {
|
|
|
524
429
|
},
|
|
525
430
|
[]
|
|
526
431
|
);
|
|
527
|
-
const setFieldsValue = (0,
|
|
432
|
+
const setFieldsValue = (0, import_react.useCallback)((values2) => {
|
|
528
433
|
setValues((oldValue) => ({
|
|
529
434
|
...oldValue,
|
|
530
435
|
...values2
|
|
@@ -535,15 +440,15 @@ function useForm(options) {
|
|
|
535
440
|
return newErrors;
|
|
536
441
|
});
|
|
537
442
|
}, []);
|
|
538
|
-
const focusField = (0,
|
|
443
|
+
const focusField = (0, import_react.useCallback)((field) => {
|
|
539
444
|
inputFieldRefs.current[field]?.focus();
|
|
540
445
|
}, []);
|
|
541
|
-
const validateForm = (0,
|
|
446
|
+
const validateForm = (0, import_react.useCallback)(() => {
|
|
542
447
|
const validationErrors = validate?.(values) || {};
|
|
543
448
|
setErrors(validationErrors);
|
|
544
449
|
return validationErrors;
|
|
545
450
|
}, [validate, values]);
|
|
546
|
-
const onSubmitFunction = (0,
|
|
451
|
+
const onSubmitFunction = (0, import_react.useCallback)(
|
|
547
452
|
async (event) => {
|
|
548
453
|
event?.preventDefault();
|
|
549
454
|
setIsSubmitting.setTrue();
|
|
@@ -561,7 +466,7 @@ function useForm(options) {
|
|
|
561
466
|
},
|
|
562
467
|
[values, validateForm, onSubmit, focusField]
|
|
563
468
|
);
|
|
564
|
-
const getInputFieldProps = (0,
|
|
469
|
+
const getInputFieldProps = (0, import_react.useCallback)(
|
|
565
470
|
(field) => {
|
|
566
471
|
const thisInputFieldIndex = Object.keys(values).findIndex((key) => key === field);
|
|
567
472
|
const isLastInputField = thisInputFieldIndex === numberOfInputFields - 1;
|
|
@@ -586,7 +491,7 @@ function useForm(options) {
|
|
|
586
491
|
},
|
|
587
492
|
[values, setFieldValue, errors, requiredFields, additional, onSubmitFunction]
|
|
588
493
|
);
|
|
589
|
-
const getSwitchProps = (0,
|
|
494
|
+
const getSwitchProps = (0, import_react.useCallback)(
|
|
590
495
|
(field, insideListItem) => {
|
|
591
496
|
return insideListItem ? {
|
|
592
497
|
switchIsEnabled: values[field],
|
|
@@ -602,19 +507,19 @@ function useForm(options) {
|
|
|
602
507
|
},
|
|
603
508
|
[values, setFieldValue]
|
|
604
509
|
);
|
|
605
|
-
const reset = (0,
|
|
510
|
+
const reset = (0, import_react.useCallback)(() => {
|
|
606
511
|
setValues(defaultValues);
|
|
607
512
|
setErrors({});
|
|
608
513
|
}, [defaultValues]);
|
|
609
|
-
const isDirty = (0,
|
|
514
|
+
const isDirty = (0, import_react.useMemo)(
|
|
610
515
|
() => Object.keys(defaultValues).some((key) => defaultValues[key] !== values[key]),
|
|
611
516
|
[defaultValues, values]
|
|
612
517
|
);
|
|
613
|
-
const isValid = (0,
|
|
518
|
+
const isValid = (0, import_react.useMemo)(() => {
|
|
614
519
|
const validationErrors = validate?.(values) || {};
|
|
615
520
|
return Object.keys(validationErrors).length === 0;
|
|
616
521
|
}, [validate, values]);
|
|
617
|
-
const canSubmit = (0,
|
|
522
|
+
const canSubmit = (0, import_react.useMemo)(() => {
|
|
618
523
|
const requiredFieldsHaveValues = requiredFields?.every((field) => values[field] !== void 0 && values[field] !== "") ?? true;
|
|
619
524
|
return isValid && requiredFieldsHaveValues;
|
|
620
525
|
}, [isValid, requiredFields]);
|
|
@@ -649,42 +554,11 @@ function useEventEmitter() {
|
|
|
649
554
|
};
|
|
650
555
|
}
|
|
651
556
|
|
|
652
|
-
// src/utils/functions.ts
|
|
653
|
-
var getFormErrorObject = (formValues) => {
|
|
654
|
-
return {};
|
|
655
|
-
};
|
|
656
|
-
|
|
657
|
-
// src/utils/asyncStorage.ts
|
|
658
|
-
var import_async_storage = __toESM(require("@react-native-async-storage/async-storage"));
|
|
659
|
-
function generateAsyncStorage() {
|
|
660
|
-
return {
|
|
661
|
-
setItem: async (name, value) => {
|
|
662
|
-
if (value) await import_async_storage.default.setItem(name.toString(), JSON.stringify(value));
|
|
663
|
-
else await import_async_storage.default.removeItem(name.toString());
|
|
664
|
-
},
|
|
665
|
-
getItem: async (name) => {
|
|
666
|
-
const item = await import_async_storage.default.getItem(name.toString());
|
|
667
|
-
if (item === null) return void 0;
|
|
668
|
-
try {
|
|
669
|
-
return JSON.parse(item);
|
|
670
|
-
} catch (error) {
|
|
671
|
-
return void 0;
|
|
672
|
-
}
|
|
673
|
-
},
|
|
674
|
-
removeItem: async (name) => {
|
|
675
|
-
await import_async_storage.default.removeItem(name.toString());
|
|
676
|
-
},
|
|
677
|
-
removeAllItems: () => {
|
|
678
|
-
import_async_storage.default.clear();
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
}
|
|
682
|
-
|
|
683
557
|
// src/components/View.tsx
|
|
684
|
-
var
|
|
558
|
+
var import_react2 = require("react");
|
|
685
559
|
var import_react_native2 = require("react-native");
|
|
686
|
-
var
|
|
687
|
-
var
|
|
560
|
+
var import_react_better_core2 = require("react-better-core");
|
|
561
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
688
562
|
var touchableHighlightStyleMoveToContent = [
|
|
689
563
|
"width",
|
|
690
564
|
"backgroundColor",
|
|
@@ -736,8 +610,8 @@ var ViewComponent = function View({
|
|
|
736
610
|
children,
|
|
737
611
|
...props
|
|
738
612
|
}) {
|
|
739
|
-
const theme2 = (0,
|
|
740
|
-
const style = (0,
|
|
613
|
+
const theme2 = (0, import_react_better_core2.useTheme)();
|
|
614
|
+
const style = (0, import_react2.useMemo)(
|
|
741
615
|
() => ({
|
|
742
616
|
flexDirection: isRow ? "row" : "column",
|
|
743
617
|
...props,
|
|
@@ -750,7 +624,7 @@ var ViewComponent = function View({
|
|
|
750
624
|
}),
|
|
751
625
|
[isRow, props]
|
|
752
626
|
);
|
|
753
|
-
const touchableHighlightStyle = (0,
|
|
627
|
+
const touchableHighlightStyle = (0, import_react2.useMemo)(
|
|
754
628
|
() => ({
|
|
755
629
|
...style,
|
|
756
630
|
...touchableHighlightStyleMoveToContent.reduce((previousValue, currentValue) => {
|
|
@@ -763,21 +637,21 @@ var ViewComponent = function View({
|
|
|
763
637
|
}),
|
|
764
638
|
[style]
|
|
765
639
|
);
|
|
766
|
-
const touchableHighlightContentProps = (0,
|
|
640
|
+
const touchableHighlightContentProps = (0, import_react2.useMemo)(
|
|
767
641
|
() => touchableHighlightStyleMoveToContent.reduce((previousValue, currentValue) => {
|
|
768
642
|
previousValue[currentValue] = props[currentValue];
|
|
769
643
|
return previousValue;
|
|
770
644
|
}, {}),
|
|
771
645
|
[props]
|
|
772
646
|
);
|
|
773
|
-
const touchableNativeFeedbackHolderStyle = (0,
|
|
647
|
+
const touchableNativeFeedbackHolderStyle = (0, import_react2.useMemo)(
|
|
774
648
|
() => touchableNativeFeedbackStyleMoveToHolder.reduce((previousValue, currentValue) => {
|
|
775
649
|
previousValue[currentValue] = props[currentValue];
|
|
776
650
|
return previousValue;
|
|
777
651
|
}, {}),
|
|
778
652
|
[props]
|
|
779
653
|
);
|
|
780
|
-
const touchableNativeFeedbackContentStyle = (0,
|
|
654
|
+
const touchableNativeFeedbackContentStyle = (0, import_react2.useMemo)(
|
|
781
655
|
() => ({
|
|
782
656
|
...style,
|
|
783
657
|
...touchableNativeFeedbackStyleMoveToHolder.reduce(
|
|
@@ -792,7 +666,7 @@ var ViewComponent = function View({
|
|
|
792
666
|
}),
|
|
793
667
|
[style]
|
|
794
668
|
);
|
|
795
|
-
const pressEvents = (0,
|
|
669
|
+
const pressEvents = (0, import_react2.useMemo)(
|
|
796
670
|
() => !disabled ? {
|
|
797
671
|
onPress: (event) => {
|
|
798
672
|
onPress?.(event);
|
|
@@ -806,7 +680,7 @@ var ViewComponent = function View({
|
|
|
806
680
|
);
|
|
807
681
|
const androidBoxShadow = import_react_native2.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;
|
|
808
682
|
const isPressable = onPress || onPressIn || onPressOut || onLongPress || onPressWithValue;
|
|
809
|
-
return isPressable ? pressType === "opacity" ? /* @__PURE__ */ (0,
|
|
683
|
+
return isPressable ? pressType === "opacity" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
810
684
|
import_react_native2.TouchableOpacity,
|
|
811
685
|
{
|
|
812
686
|
style,
|
|
@@ -816,7 +690,7 @@ var ViewComponent = function View({
|
|
|
816
690
|
...props,
|
|
817
691
|
children
|
|
818
692
|
}
|
|
819
|
-
) : pressType === "highlight" ? import_react_native2.Platform.OS === "ios" ? /* @__PURE__ */ (0,
|
|
693
|
+
) : pressType === "highlight" ? import_react_native2.Platform.OS === "ios" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
820
694
|
import_react_native2.TouchableHighlight,
|
|
821
695
|
{
|
|
822
696
|
activeOpacity: pressStrength2,
|
|
@@ -824,7 +698,7 @@ var ViewComponent = function View({
|
|
|
824
698
|
style: touchableHighlightStyle,
|
|
825
699
|
...pressEvents,
|
|
826
700
|
...props,
|
|
827
|
-
children: /* @__PURE__ */ (0,
|
|
701
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
828
702
|
ViewComponent,
|
|
829
703
|
{
|
|
830
704
|
width: "100%",
|
|
@@ -839,7 +713,7 @@ var ViewComponent = function View({
|
|
|
839
713
|
}
|
|
840
714
|
)
|
|
841
715
|
}
|
|
842
|
-
) : import_react_native2.Platform.OS === "android" ? /* @__PURE__ */ (0,
|
|
716
|
+
) : import_react_native2.Platform.OS === "android" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
843
717
|
ViewComponent,
|
|
844
718
|
{
|
|
845
719
|
...touchableNativeFeedbackHolderStyle,
|
|
@@ -851,7 +725,7 @@ var ViewComponent = function View({
|
|
|
851
725
|
boxShadow: androidBoxShadow,
|
|
852
726
|
overflow: "hidden",
|
|
853
727
|
pointerEvents: "box-none",
|
|
854
|
-
children: /* @__PURE__ */ (0,
|
|
728
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
855
729
|
import_react_native2.TouchableNativeFeedback,
|
|
856
730
|
{
|
|
857
731
|
...pressEvents,
|
|
@@ -862,15 +736,15 @@ var ViewComponent = function View({
|
|
|
862
736
|
),
|
|
863
737
|
useForeground: true,
|
|
864
738
|
touchSoundDisabled: true,
|
|
865
|
-
children: /* @__PURE__ */ (0,
|
|
739
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ViewComponent, { flex: 1, ...touchableNativeFeedbackContentStyle, children })
|
|
866
740
|
}
|
|
867
741
|
)
|
|
868
742
|
}
|
|
869
|
-
) : /* @__PURE__ */ (0,
|
|
743
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native2.View, { boxShadow: androidBoxShadow, style, ...props, children });
|
|
870
744
|
};
|
|
871
745
|
ViewComponent.box = function Box({ withShadow, ...props }) {
|
|
872
|
-
const theme2 = (0,
|
|
873
|
-
const shadowProps = (0,
|
|
746
|
+
const theme2 = (0, import_react_better_core2.useTheme)();
|
|
747
|
+
const shadowProps = (0, import_react2.useMemo)(
|
|
874
748
|
() => withShadow ? {
|
|
875
749
|
shadowOpacity: 0.2,
|
|
876
750
|
shadowOffsetHeight: 10,
|
|
@@ -879,7 +753,7 @@ ViewComponent.box = function Box({ withShadow, ...props }) {
|
|
|
879
753
|
} : {},
|
|
880
754
|
[]
|
|
881
755
|
);
|
|
882
|
-
return /* @__PURE__ */ (0,
|
|
756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
883
757
|
ViewComponent,
|
|
884
758
|
{
|
|
885
759
|
width: "100%",
|
|
@@ -894,18 +768,52 @@ ViewComponent.box = function Box({ withShadow, ...props }) {
|
|
|
894
768
|
}
|
|
895
769
|
);
|
|
896
770
|
};
|
|
897
|
-
var View2 = (0,
|
|
771
|
+
var View2 = (0, import_react2.memo)(ViewComponent);
|
|
898
772
|
View2.box = ViewComponent.box;
|
|
899
773
|
var View_default = View2;
|
|
900
774
|
|
|
775
|
+
// src/components/alerts/Alert.tsx
|
|
776
|
+
var import_react10 = require("react");
|
|
777
|
+
var import_react_better_core9 = require("react-better-core");
|
|
778
|
+
|
|
779
|
+
// src/plugins/alerts.ts
|
|
780
|
+
var defaultAlertsPluginOptions = {
|
|
781
|
+
align: "right",
|
|
782
|
+
defaultDuration: "auto",
|
|
783
|
+
defaultDisplay: {},
|
|
784
|
+
withCloseButton: true
|
|
785
|
+
};
|
|
786
|
+
var alertsPlugin = (options) => ({
|
|
787
|
+
name: "alerts",
|
|
788
|
+
initialize: () => {
|
|
789
|
+
},
|
|
790
|
+
getConfig: () => ({
|
|
791
|
+
...defaultAlertsPluginOptions,
|
|
792
|
+
...options
|
|
793
|
+
})
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
// src/plugins/asyncStorage.ts
|
|
797
|
+
var defaultAsyncStoragePluginOptions = {};
|
|
798
|
+
var asyncStoragePlugin = (options) => ({
|
|
799
|
+
name: "asyncStorage",
|
|
800
|
+
initialize: () => {
|
|
801
|
+
console.log("asyncStorage plugin initialized");
|
|
802
|
+
},
|
|
803
|
+
getConfig: () => ({
|
|
804
|
+
...defaultAsyncStoragePluginOptions,
|
|
805
|
+
...options
|
|
806
|
+
})
|
|
807
|
+
});
|
|
808
|
+
|
|
901
809
|
// src/components/Text.tsx
|
|
902
|
-
var
|
|
810
|
+
var import_react3 = require("react");
|
|
903
811
|
var import_react_native3 = require("react-native");
|
|
904
|
-
var
|
|
905
|
-
var
|
|
812
|
+
var import_react_better_core3 = require("react-better-core");
|
|
813
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
906
814
|
var TextComponent = function Text({ selectionColor, children, ...props }) {
|
|
907
|
-
const theme2 = (0,
|
|
908
|
-
const style = (0,
|
|
815
|
+
const theme2 = (0, import_react_better_core3.useTheme)();
|
|
816
|
+
const style = (0, import_react3.useMemo)(
|
|
909
817
|
() => ({
|
|
910
818
|
fontSize: 16,
|
|
911
819
|
color: theme2.colors.textPrimary,
|
|
@@ -913,27 +821,27 @@ var TextComponent = function Text({ selectionColor, children, ...props }) {
|
|
|
913
821
|
}),
|
|
914
822
|
[theme2, props]
|
|
915
823
|
);
|
|
916
|
-
return /* @__PURE__ */ (0,
|
|
824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_native3.Text, { selectionColor: selectionColor ?? theme2.colors.primary, style, ...props, children });
|
|
917
825
|
};
|
|
918
826
|
TextComponent.title = function Title(props) {
|
|
919
|
-
return /* @__PURE__ */ (0,
|
|
827
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TextComponent, { fontSize: 32, fontWeight: 700, ...props });
|
|
920
828
|
};
|
|
921
829
|
TextComponent.subtitle = function Subtitle(props) {
|
|
922
|
-
return /* @__PURE__ */ (0,
|
|
830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TextComponent, { fontSize: 24, fontWeight: 700, ...props });
|
|
923
831
|
};
|
|
924
832
|
TextComponent.body = function Body(props) {
|
|
925
|
-
const theme2 = (0,
|
|
926
|
-
return /* @__PURE__ */ (0,
|
|
833
|
+
const theme2 = (0, import_react_better_core3.useTheme)();
|
|
834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TextComponent, { color: theme2.colors.textSecondary, ...props });
|
|
927
835
|
};
|
|
928
836
|
TextComponent.caption = function Caption(props) {
|
|
929
|
-
const theme2 = (0,
|
|
930
|
-
return /* @__PURE__ */ (0,
|
|
837
|
+
const theme2 = (0, import_react_better_core3.useTheme)();
|
|
838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TextComponent, { fontSize: 14, color: theme2.colors.textSecondary, ...props });
|
|
931
839
|
};
|
|
932
840
|
TextComponent.unknown = function Unknown(props) {
|
|
933
|
-
const theme2 = (0,
|
|
934
|
-
return /* @__PURE__ */ (0,
|
|
841
|
+
const theme2 = (0, import_react_better_core3.useTheme)();
|
|
842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(TextComponent, { fontStyle: "italic", textAlign: "center", color: theme2.colors.textSecondary, ...props });
|
|
935
843
|
};
|
|
936
|
-
var Text2 = (0,
|
|
844
|
+
var Text2 = (0, import_react3.memo)(TextComponent);
|
|
937
845
|
Text2.title = TextComponent.title;
|
|
938
846
|
Text2.subtitle = TextComponent.subtitle;
|
|
939
847
|
Text2.body = TextComponent.body;
|
|
@@ -941,75 +849,175 @@ Text2.caption = TextComponent.caption;
|
|
|
941
849
|
Text2.unknown = TextComponent.unknown;
|
|
942
850
|
var Text_default = Text2;
|
|
943
851
|
|
|
944
|
-
// src/components/
|
|
945
|
-
var
|
|
946
|
-
var
|
|
947
|
-
var
|
|
852
|
+
// src/components/Icon.tsx
|
|
853
|
+
var import_react4 = require("react");
|
|
854
|
+
var import_react_native4 = require("react-native");
|
|
855
|
+
var import_react_native_svg = require("react-native-svg");
|
|
856
|
+
var import_react_better_core5 = require("react-better-core");
|
|
857
|
+
var import_expo_symbols = require("expo-symbols");
|
|
948
858
|
|
|
949
|
-
// src/
|
|
950
|
-
var
|
|
951
|
-
var
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
View: (0, import_react5.memo)(function View3({ transformOriginX, transformOriginY, children, ...props }) {
|
|
956
|
-
const initialProps = useComponentPropsGrouper(props, "initial");
|
|
957
|
-
const animateProps2 = useComponentPropsGrouper(props, "animate");
|
|
958
|
-
const whileTapProps = useComponentPropsGrouper(props, "whileTap");
|
|
959
|
-
const transitionProps = useComponentPropsGrouper(props, "transition");
|
|
960
|
-
const transition = (0, import_react5.useMemo)(
|
|
961
|
-
() => ({
|
|
962
|
-
type: "timing",
|
|
963
|
-
duration: defaultTransitionDuration,
|
|
964
|
-
...transitionProps.withPrefixStyle
|
|
965
|
-
}),
|
|
966
|
-
[transitionProps.withPrefixStyle]
|
|
967
|
-
);
|
|
968
|
-
const transformOrigin = (0, import_react5.useMemo)(
|
|
969
|
-
() => transformOriginX !== void 0 || transformOriginY !== void 0 ? {
|
|
970
|
-
x: transformOriginX ?? 0,
|
|
971
|
-
y: transformOriginY ?? 0
|
|
972
|
-
} : void 0,
|
|
973
|
-
[transformOriginX, transformOriginY]
|
|
974
|
-
);
|
|
975
|
-
const content = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
976
|
-
import_motion.Motion.View,
|
|
977
|
-
{
|
|
978
|
-
style: initialProps.style,
|
|
979
|
-
initial: initialProps.withPrefixStyle,
|
|
980
|
-
animate: animateProps2.withPrefixStyle,
|
|
981
|
-
transition,
|
|
982
|
-
whileTap: whileTapProps.withPrefixStyle,
|
|
983
|
-
transformOrigin,
|
|
984
|
-
children
|
|
985
|
-
}
|
|
859
|
+
// src/utils/variableFunctions.ts
|
|
860
|
+
var import_react_better_core4 = require("react-better-core");
|
|
861
|
+
var checkBetterCoreContextValue = (value, functionsName) => {
|
|
862
|
+
if (value === void 0) {
|
|
863
|
+
throw new Error(
|
|
864
|
+
`\`${functionsName}()\` must be used within a \`<BetterCoreProvider>\`. Make sure to add one at the root of your component tree.`
|
|
986
865
|
);
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
const transition = (0, import_react5.useMemo)(
|
|
995
|
-
() => ({
|
|
996
|
-
type: "timing",
|
|
997
|
-
duration: defaultTransitionDuration,
|
|
998
|
-
...transitionProps.withPrefixStyle
|
|
999
|
-
}),
|
|
1000
|
-
[transitionProps.withPrefixStyle]
|
|
866
|
+
}
|
|
867
|
+
return value !== void 0;
|
|
868
|
+
};
|
|
869
|
+
var checkBetterComponentsContextValue = (value, functionsName) => {
|
|
870
|
+
if (value === void 0) {
|
|
871
|
+
throw new Error(
|
|
872
|
+
`\`${functionsName}()\` must be used within a \`<BetterComponentsProvider>\`. Make sure to add one at the root of your component tree.`
|
|
1001
873
|
);
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
874
|
+
}
|
|
875
|
+
return value !== void 0;
|
|
876
|
+
};
|
|
877
|
+
var alertControls = {
|
|
878
|
+
createAlert: (alert) => {
|
|
879
|
+
if (!checkBetterComponentsContextValue(externalBetterComponentsContextValue, "alertControls.createAlert"))
|
|
880
|
+
return void 0;
|
|
881
|
+
const readyAlert = {
|
|
882
|
+
id: (0, import_react_better_core4.generateRandomString)(36),
|
|
883
|
+
...alert
|
|
884
|
+
};
|
|
885
|
+
externalBetterComponentsContextValue.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
886
|
+
return readyAlert;
|
|
887
|
+
},
|
|
888
|
+
removeAlert: (alertId) => {
|
|
889
|
+
if (!checkBetterComponentsContextValue(externalBetterComponentsContextValue, "alertControls.removeAlert"))
|
|
890
|
+
return;
|
|
891
|
+
externalBetterComponentsContextValue.setAlerts(
|
|
892
|
+
(oldValue) => oldValue.filter((alert) => alert.id !== alertId)
|
|
1008
893
|
);
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
var pressStrength = () => {
|
|
897
|
+
if (!checkBetterCoreContextValue(externalBetterCoreContextValue, "pressStrength")) return void 0;
|
|
898
|
+
return {
|
|
899
|
+
p05: externalBetterCoreContextValue.colorTheme === "dark" ? 0.85 : 0.95,
|
|
900
|
+
p1: externalBetterCoreContextValue.colorTheme === "dark" ? 0.6 : 0.8,
|
|
901
|
+
p2: externalBetterCoreContextValue.colorTheme === "dark" ? 0.5 : 0.7,
|
|
902
|
+
p3: externalBetterCoreContextValue.colorTheme === "dark" ? 0.4 : 0.6
|
|
903
|
+
};
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
// src/components/Icon.tsx
|
|
907
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
908
|
+
var import_react5 = require("react");
|
|
909
|
+
function Icon({ name, nameIOS, size = 16, color, ...props }) {
|
|
910
|
+
const theme2 = (0, import_react_better_core5.useTheme)();
|
|
911
|
+
const { icons: icons2 } = (0, import_react_better_core5.useBetterCoreContext)();
|
|
912
|
+
const svgColor = color ?? theme2.colors.textPrimary;
|
|
913
|
+
(0, import_react4.useEffect)(() => {
|
|
914
|
+
if (!icons2[name.toString()])
|
|
915
|
+
console.warn(
|
|
916
|
+
`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.`
|
|
917
|
+
);
|
|
918
|
+
}, [icons2, name]);
|
|
919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
920
|
+
View_default,
|
|
921
|
+
{
|
|
922
|
+
width: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingHorizontal?.toString() ?? "0") ?? 0),
|
|
923
|
+
height: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingVertical?.toString() ?? "0") ?? 0),
|
|
924
|
+
alignItems: "center",
|
|
925
|
+
justifyContent: "center",
|
|
926
|
+
pressType: "opacity",
|
|
927
|
+
pressStrength: pressStrength().p2,
|
|
928
|
+
...props,
|
|
929
|
+
children: import_react_native4.Platform.OS === "ios" && nameIOS ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_expo_symbols.SymbolView, { name: nameIOS, tintColor: svgColor, size: size * 1.12 }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
930
|
+
import_react_native_svg.Svg,
|
|
931
|
+
{
|
|
932
|
+
width: size,
|
|
933
|
+
height: size,
|
|
934
|
+
viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
|
|
935
|
+
fill: "none",
|
|
936
|
+
children: icons2[name.toString()]?.paths.map(({ type, ...path }) => /* @__PURE__ */ (0, import_react5.createElement)(
|
|
937
|
+
import_react_native_svg.Path,
|
|
938
|
+
{
|
|
939
|
+
...path,
|
|
940
|
+
fill: type === "fill" ? svgColor : void 0,
|
|
941
|
+
stroke: type === "stroke" ? svgColor : void 0,
|
|
942
|
+
key: path.d
|
|
943
|
+
}
|
|
944
|
+
))
|
|
945
|
+
}
|
|
946
|
+
)
|
|
947
|
+
}
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
var Icon_default = (0, import_react4.memo)(Icon);
|
|
951
|
+
|
|
952
|
+
// src/components/Button.tsx
|
|
953
|
+
var import_react9 = require("react");
|
|
954
|
+
var import_react_native7 = require("react-native");
|
|
955
|
+
var import_react_better_core8 = require("react-better-core");
|
|
956
|
+
|
|
957
|
+
// src/components/Animate.tsx
|
|
958
|
+
var import_react6 = require("react");
|
|
959
|
+
var import_motion = require("@legendapp/motion");
|
|
960
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
961
|
+
var defaultTransitionDuration = 0.15 * 1e3;
|
|
962
|
+
var Animate = {
|
|
963
|
+
View: (0, import_react6.memo)(function View3({ transformOriginX, transformOriginY, children, ...props }) {
|
|
964
|
+
const initialProps = useComponentPropsGrouper(props, "initial");
|
|
965
|
+
const animateProps2 = useComponentPropsGrouper(props, "animate");
|
|
966
|
+
const whileTapProps = useComponentPropsGrouper(props, "whileTap");
|
|
967
|
+
const transitionProps = useComponentPropsGrouper(props, "transition");
|
|
968
|
+
const transition = (0, import_react6.useMemo)(
|
|
969
|
+
() => ({
|
|
970
|
+
type: "timing",
|
|
971
|
+
duration: defaultTransitionDuration,
|
|
972
|
+
...transitionProps.withPrefixStyle
|
|
973
|
+
}),
|
|
974
|
+
[transitionProps.withPrefixStyle]
|
|
975
|
+
);
|
|
976
|
+
const transformOrigin = (0, import_react6.useMemo)(
|
|
977
|
+
() => transformOriginX !== void 0 || transformOriginY !== void 0 ? {
|
|
978
|
+
x: transformOriginX ?? 0,
|
|
979
|
+
y: transformOriginY ?? 0
|
|
980
|
+
} : void 0,
|
|
981
|
+
[transformOriginX, transformOriginY]
|
|
982
|
+
);
|
|
983
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
984
|
+
import_motion.Motion.View,
|
|
985
|
+
{
|
|
986
|
+
style: initialProps.style,
|
|
987
|
+
initial: initialProps.withPrefixStyle,
|
|
988
|
+
animate: animateProps2.withPrefixStyle,
|
|
989
|
+
transition,
|
|
990
|
+
whileTap: whileTapProps.withPrefixStyle,
|
|
991
|
+
transformOrigin,
|
|
992
|
+
children
|
|
993
|
+
}
|
|
994
|
+
);
|
|
995
|
+
return Object.keys(whileTapProps.withPrefixStyle).length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_motion.Motion.Pressable, { children: content }) : content;
|
|
996
|
+
}),
|
|
997
|
+
Text: (0, import_react6.memo)(function Text3({ transformOriginX, transformOriginY, children, ...props }) {
|
|
998
|
+
const initialProps = useComponentPropsGrouper(props, "initial");
|
|
999
|
+
const animateProps2 = useComponentPropsGrouper(props, "animate");
|
|
1000
|
+
const whileTapProps = useComponentPropsGrouper(props, "whileTap");
|
|
1001
|
+
const transitionProps = useComponentPropsGrouper(props, "transition");
|
|
1002
|
+
const transition = (0, import_react6.useMemo)(
|
|
1003
|
+
() => ({
|
|
1004
|
+
type: "timing",
|
|
1005
|
+
duration: defaultTransitionDuration,
|
|
1006
|
+
...transitionProps.withPrefixStyle
|
|
1007
|
+
}),
|
|
1008
|
+
[transitionProps.withPrefixStyle]
|
|
1009
|
+
);
|
|
1010
|
+
const transformOrigin = (0, import_react6.useMemo)(
|
|
1011
|
+
() => transformOriginX !== void 0 || transformOriginY !== void 0 ? {
|
|
1012
|
+
x: transformOriginX ?? 0,
|
|
1013
|
+
y: transformOriginY ?? 0
|
|
1014
|
+
} : void 0,
|
|
1015
|
+
[transformOriginX, transformOriginY]
|
|
1016
|
+
);
|
|
1017
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1018
|
+
import_motion.Motion.Text,
|
|
1019
|
+
{
|
|
1020
|
+
style: initialProps.style,
|
|
1013
1021
|
initial: initialProps.withPrefixStyle,
|
|
1014
1022
|
animate: animateProps2.withPrefixStyle,
|
|
1015
1023
|
transition,
|
|
@@ -1024,16 +1032,16 @@ var Animate = {
|
|
|
1024
1032
|
var Animate_default = Animate;
|
|
1025
1033
|
|
|
1026
1034
|
// src/components/Loader.tsx
|
|
1027
|
-
var
|
|
1028
|
-
var
|
|
1029
|
-
var
|
|
1035
|
+
var import_react7 = require("react");
|
|
1036
|
+
var import_react_native5 = require("react-native");
|
|
1037
|
+
var import_react_better_core6 = require("react-better-core");
|
|
1030
1038
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1031
1039
|
var LoaderComponent = function Loader({ size = "small", color, ...props }) {
|
|
1032
|
-
const theme2 = (0,
|
|
1033
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(View_default, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1040
|
+
const theme2 = (0, import_react_better_core6.useTheme)();
|
|
1041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(View_default, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_native5.ActivityIndicator, { size, color: color ?? theme2.colors.textPrimary }) });
|
|
1034
1042
|
};
|
|
1035
1043
|
LoaderComponent.box = function Box2({ text = "Loading...", size = "large", color, ...props }) {
|
|
1036
|
-
const theme2 = (0,
|
|
1044
|
+
const theme2 = (0, import_react_better_core6.useTheme)();
|
|
1037
1045
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1038
1046
|
View_default,
|
|
1039
1047
|
{
|
|
@@ -1050,7 +1058,7 @@ LoaderComponent.box = function Box2({ text = "Loading...", size = "large", color
|
|
|
1050
1058
|
);
|
|
1051
1059
|
};
|
|
1052
1060
|
LoaderComponent.text = function LoaderText({ text = "Loading...", size, color, ...props }) {
|
|
1053
|
-
const theme2 = (0,
|
|
1061
|
+
const theme2 = (0, import_react_better_core6.useTheme)();
|
|
1054
1062
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1055
1063
|
View_default,
|
|
1056
1064
|
{
|
|
@@ -1067,20 +1075,89 @@ LoaderComponent.text = function LoaderText({ text = "Loading...", size, color, .
|
|
|
1067
1075
|
}
|
|
1068
1076
|
);
|
|
1069
1077
|
};
|
|
1070
|
-
var Loader2 = (0,
|
|
1078
|
+
var Loader2 = (0, import_react7.memo)(LoaderComponent);
|
|
1071
1079
|
Loader2.box = LoaderComponent.box;
|
|
1072
1080
|
Loader2.text = LoaderComponent.text;
|
|
1073
1081
|
var Loader_default = Loader2;
|
|
1074
1082
|
|
|
1075
|
-
// src/components/
|
|
1083
|
+
// src/components/Image.tsx
|
|
1084
|
+
var import_react8 = require("react");
|
|
1085
|
+
var import_react_better_core7 = require("react-better-core");
|
|
1086
|
+
var import_react_native6 = require("react-native");
|
|
1076
1087
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1088
|
+
var ImageComponent = function Image({ name, source, withDevFittingMode, ...props }) {
|
|
1089
|
+
const { assets: assets2 } = (0, import_react_better_core7.useBetterCoreContext)();
|
|
1090
|
+
const style = (0, import_react8.useMemo)(
|
|
1091
|
+
() => ({
|
|
1092
|
+
width: 100,
|
|
1093
|
+
height: 100,
|
|
1094
|
+
...withDevFittingMode ? {
|
|
1095
|
+
borderWidth: 1,
|
|
1096
|
+
borderColor: "#eb39f7"
|
|
1097
|
+
} : {},
|
|
1098
|
+
...props
|
|
1099
|
+
}),
|
|
1100
|
+
[withDevFittingMode, props]
|
|
1101
|
+
);
|
|
1102
|
+
(0, import_react8.useEffect)(() => {
|
|
1103
|
+
if (!name) return;
|
|
1104
|
+
if (!assets2[name.toString()])
|
|
1105
|
+
console.warn(
|
|
1106
|
+
`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.`
|
|
1107
|
+
);
|
|
1108
|
+
}, [assets2, name]);
|
|
1109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native6.Image, { source: name ? assets2[name.toString()] : source, style, ...props });
|
|
1110
|
+
};
|
|
1111
|
+
ImageComponent.profileImage = function ProfileImage({
|
|
1112
|
+
size = 50,
|
|
1113
|
+
letters,
|
|
1114
|
+
color,
|
|
1115
|
+
backgroundColor,
|
|
1116
|
+
...props
|
|
1117
|
+
}) {
|
|
1118
|
+
const theme2 = (0, import_react_better_core7.useTheme)();
|
|
1119
|
+
return letters ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1120
|
+
View_default,
|
|
1121
|
+
{
|
|
1122
|
+
width: size,
|
|
1123
|
+
height: size,
|
|
1124
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
1125
|
+
borderWidth: 1,
|
|
1126
|
+
borderColor: theme2.colors.border,
|
|
1127
|
+
borderRadius: 999,
|
|
1128
|
+
alignItems: "center",
|
|
1129
|
+
justifyContent: "center",
|
|
1130
|
+
...props,
|
|
1131
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, color: color ?? theme2.colors.textPrimary, marginTop: 1, children: letters.toUpperCase().slice(0, 2) })
|
|
1132
|
+
}
|
|
1133
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1134
|
+
ImageComponent,
|
|
1135
|
+
{
|
|
1136
|
+
width: size,
|
|
1137
|
+
height: size,
|
|
1138
|
+
borderWidth: 1,
|
|
1139
|
+
borderColor: theme2.colors.border,
|
|
1140
|
+
borderRadius: 999,
|
|
1141
|
+
objectFit: "cover",
|
|
1142
|
+
...props
|
|
1143
|
+
}
|
|
1144
|
+
);
|
|
1145
|
+
};
|
|
1146
|
+
var Image2 = (0, import_react8.memo)(ImageComponent);
|
|
1147
|
+
Image2.profileImage = ImageComponent.profileImage;
|
|
1148
|
+
var Image_default = Image2;
|
|
1149
|
+
|
|
1150
|
+
// src/components/Button.tsx
|
|
1151
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1077
1152
|
var ButtonComponent = function Button({
|
|
1153
|
+
value,
|
|
1078
1154
|
text,
|
|
1079
1155
|
textFontSize = 16,
|
|
1080
1156
|
textFontWeight = 700,
|
|
1081
1157
|
textDecorationLine,
|
|
1082
1158
|
textColor,
|
|
1083
1159
|
icon,
|
|
1160
|
+
iconIOS,
|
|
1084
1161
|
iconPosition = "left",
|
|
1085
1162
|
iconColor,
|
|
1086
1163
|
iconSize,
|
|
@@ -1095,10 +1172,12 @@ var ButtonComponent = function Button({
|
|
|
1095
1172
|
flex,
|
|
1096
1173
|
alignSelf,
|
|
1097
1174
|
disabled,
|
|
1175
|
+
onPress,
|
|
1176
|
+
onPressWithValue,
|
|
1098
1177
|
...props
|
|
1099
1178
|
}) {
|
|
1100
|
-
const theme2 = (0,
|
|
1101
|
-
const isLoadingLoader = (0,
|
|
1179
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1180
|
+
const isLoadingLoader = (0, import_react_better_core8.useLoader)(loaderName);
|
|
1102
1181
|
const isLoadingElement = isLoading || isLoadingLoader;
|
|
1103
1182
|
const isDisabled = disabled || isLoadingElement;
|
|
1104
1183
|
const lineHeight = 20;
|
|
@@ -1106,7 +1185,24 @@ var ButtonComponent = function Button({
|
|
|
1106
1185
|
const paddingVertical = props.paddingVertical ? parseFloat(props.paddingVertical.toString()) : theme2.styles.space;
|
|
1107
1186
|
const paddingHorizontal = props.paddingHorizontal ? parseFloat(props.paddingHorizontal.toString()) : theme2.styles.space + theme2.styles.gap;
|
|
1108
1187
|
const buttonHeight = paddingVertical + lineHeight + paddingVertical;
|
|
1109
|
-
|
|
1188
|
+
const onPressElement = (0, import_react9.useCallback)(
|
|
1189
|
+
(event) => {
|
|
1190
|
+
onPress?.(event);
|
|
1191
|
+
onPressWithValue?.(value);
|
|
1192
|
+
},
|
|
1193
|
+
[onPress, onPressWithValue, value]
|
|
1194
|
+
);
|
|
1195
|
+
const iconComponent = icon ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(View_default, { height: 20, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1196
|
+
Icon_default,
|
|
1197
|
+
{
|
|
1198
|
+
name: icon,
|
|
1199
|
+
nameIOS: iconIOS,
|
|
1200
|
+
color: iconColor ?? textColor ?? theme2.colors.base,
|
|
1201
|
+
size: iconSize ?? textFontSize ?? 16
|
|
1202
|
+
}
|
|
1203
|
+
) }) : void 0;
|
|
1204
|
+
const imageComponent = image ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Image_default, { name: image, width: imageWidth ?? textFontSize ?? 16, height: imageHeight }) : void 0;
|
|
1205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1110
1206
|
Animate_default.View,
|
|
1111
1207
|
{
|
|
1112
1208
|
position: "relative",
|
|
@@ -1114,12 +1210,12 @@ var ButtonComponent = function Button({
|
|
|
1114
1210
|
alignSelf: alignSelf ?? (isSmall === "left" ? "flex-start" : isSmall === "right" ? "flex-end" : isSmall === "center" ? "center" : isSmall ? "baseline" : void 0),
|
|
1115
1211
|
initialOpacity: 1,
|
|
1116
1212
|
animateOpacity: animateOpacity ?? (disabled ? 0.6 : 1),
|
|
1117
|
-
children: /* @__PURE__ */ (0,
|
|
1213
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1118
1214
|
View_default,
|
|
1119
1215
|
{
|
|
1120
1216
|
position: "relative",
|
|
1121
1217
|
width: !isSmall ? "100%" : void 0,
|
|
1122
|
-
height:
|
|
1218
|
+
height: import_react_native7.Platform.OS === "android" ? buttonHeight : void 0,
|
|
1123
1219
|
alignItems: "center",
|
|
1124
1220
|
justifyContent: "center",
|
|
1125
1221
|
backgroundColor: theme2.colors.primary,
|
|
@@ -1127,22 +1223,29 @@ var ButtonComponent = function Button({
|
|
|
1127
1223
|
paddingVertical,
|
|
1128
1224
|
paddingHorizontal,
|
|
1129
1225
|
disabled: isDisabled,
|
|
1226
|
+
onPress: onPressElement,
|
|
1130
1227
|
...props,
|
|
1131
1228
|
children: [
|
|
1132
|
-
/* @__PURE__ */ (0,
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1229
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Animate_default.View, { initialOpacity: 1, animateOpacity: isLoadingElement ? 0 : 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(View_default, { isRow: true, alignItems: "center", justifyContent: "center", gap: theme2.styles.gap, children: [
|
|
1230
|
+
iconPosition === "left" && iconComponent,
|
|
1231
|
+
imagePosition === "left" && imageComponent,
|
|
1232
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1233
|
+
Text_default,
|
|
1234
|
+
{
|
|
1235
|
+
fontSize: textFontSize,
|
|
1236
|
+
fontWeight: textFontWeight,
|
|
1237
|
+
textDecorationLine,
|
|
1238
|
+
textDecorationColor: color,
|
|
1239
|
+
textAlign: "center",
|
|
1240
|
+
lineHeight,
|
|
1241
|
+
color,
|
|
1242
|
+
children: text
|
|
1243
|
+
}
|
|
1244
|
+
),
|
|
1245
|
+
iconPosition === "right" && iconComponent,
|
|
1246
|
+
imagePosition === "right" && imageComponent
|
|
1247
|
+
] }) }),
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1146
1249
|
Animate_default.View,
|
|
1147
1250
|
{
|
|
1148
1251
|
position: "absolute",
|
|
@@ -1153,7 +1256,7 @@ var ButtonComponent = function Button({
|
|
|
1153
1256
|
justifyContent: "center",
|
|
1154
1257
|
initialOpacity: 0,
|
|
1155
1258
|
animateOpacity: isLoadingElement ? 1 : 0,
|
|
1156
|
-
children: /* @__PURE__ */ (0,
|
|
1259
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loader_default, { color })
|
|
1157
1260
|
}
|
|
1158
1261
|
)
|
|
1159
1262
|
]
|
|
@@ -1161,54 +1264,374 @@ var ButtonComponent = function Button({
|
|
|
1161
1264
|
)
|
|
1162
1265
|
}
|
|
1163
1266
|
);
|
|
1164
|
-
};
|
|
1165
|
-
ButtonComponent.secondary = function Secondary(props) {
|
|
1166
|
-
const theme2 = (0,
|
|
1167
|
-
return /* @__PURE__ */ (0,
|
|
1168
|
-
ButtonComponent,
|
|
1169
|
-
{
|
|
1170
|
-
backgroundColor: theme2.colors.backgroundContent,
|
|
1171
|
-
borderWidth: 1,
|
|
1172
|
-
borderColor: theme2.colors.border,
|
|
1173
|
-
textColor: theme2.colors.textPrimary,
|
|
1174
|
-
pressStrength: pressStrength().p05,
|
|
1175
|
-
animateOpacity: props.disabled ? 0.4 : 1,
|
|
1176
|
-
...props
|
|
1177
|
-
}
|
|
1267
|
+
};
|
|
1268
|
+
ButtonComponent.secondary = function Secondary(props) {
|
|
1269
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1271
|
+
ButtonComponent,
|
|
1272
|
+
{
|
|
1273
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
1274
|
+
borderWidth: 1,
|
|
1275
|
+
borderColor: theme2.colors.border,
|
|
1276
|
+
textColor: theme2.colors.textPrimary,
|
|
1277
|
+
pressStrength: pressStrength().p05,
|
|
1278
|
+
animateOpacity: props.disabled ? 0.4 : 1,
|
|
1279
|
+
...props
|
|
1280
|
+
}
|
|
1281
|
+
);
|
|
1282
|
+
};
|
|
1283
|
+
ButtonComponent.destructive = function Destructive(props) {
|
|
1284
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ButtonComponent, { backgroundColor: theme2.colors.error, ...props });
|
|
1286
|
+
};
|
|
1287
|
+
ButtonComponent.text = function ButtonText(props) {
|
|
1288
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1290
|
+
ButtonComponent,
|
|
1291
|
+
{
|
|
1292
|
+
width: "auto",
|
|
1293
|
+
textFontWeight: 400,
|
|
1294
|
+
textColor: theme2.colors.textPrimary,
|
|
1295
|
+
textDecorationLine: "underline",
|
|
1296
|
+
backgroundColor: "transparent",
|
|
1297
|
+
paddingHorizontal: theme2.styles.space,
|
|
1298
|
+
paddingVertical: theme2.styles.gap,
|
|
1299
|
+
isSmall: true,
|
|
1300
|
+
pressType: "opacity",
|
|
1301
|
+
...props
|
|
1302
|
+
}
|
|
1303
|
+
);
|
|
1304
|
+
};
|
|
1305
|
+
ButtonComponent.icon = function ButtonIcon({ size = 16, ...props }) {
|
|
1306
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1307
|
+
const buttonSize = size + theme2.styles.space;
|
|
1308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1309
|
+
ButtonComponent,
|
|
1310
|
+
{
|
|
1311
|
+
width: buttonSize,
|
|
1312
|
+
height: buttonSize,
|
|
1313
|
+
textColor: theme2.colors.textPrimary,
|
|
1314
|
+
backgroundColor: "transparent",
|
|
1315
|
+
hitSlop: theme2.styles.gap / 2,
|
|
1316
|
+
borderRadius: 999,
|
|
1317
|
+
iconSize: size,
|
|
1318
|
+
paddingVertical: 0,
|
|
1319
|
+
paddingHorizontal: 0,
|
|
1320
|
+
pressType: "opacity",
|
|
1321
|
+
...props
|
|
1322
|
+
}
|
|
1323
|
+
);
|
|
1324
|
+
};
|
|
1325
|
+
var Button2 = (0, import_react9.memo)(ButtonComponent);
|
|
1326
|
+
Button2.secondary = ButtonComponent.secondary;
|
|
1327
|
+
Button2.destructive = ButtonComponent.destructive;
|
|
1328
|
+
Button2.text = ButtonComponent.text;
|
|
1329
|
+
Button2.icon = ButtonComponent.icon;
|
|
1330
|
+
var Button_default = Button2;
|
|
1331
|
+
|
|
1332
|
+
// src/components/alerts/Alert.tsx
|
|
1333
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1334
|
+
var getAlertDurationFromAuto = (duration, alert) => {
|
|
1335
|
+
if (duration === "auto") {
|
|
1336
|
+
const titleLength = alert.title?.length ?? 0;
|
|
1337
|
+
const messageLength = alert.message?.length ?? 0;
|
|
1338
|
+
return Math.max(defaultAlertDuration, (titleLength + messageLength) * 30);
|
|
1339
|
+
}
|
|
1340
|
+
return duration;
|
|
1341
|
+
};
|
|
1342
|
+
function Alert({ alert }) {
|
|
1343
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
1344
|
+
const device = useDevice();
|
|
1345
|
+
const alertControls2 = useAlertControls();
|
|
1346
|
+
const alertsPlugin2 = usePlugin("alerts");
|
|
1347
|
+
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
1348
|
+
const defaultAlertDurationNumber = getAlertDurationFromAuto(
|
|
1349
|
+
alert.duration ?? pluginConfig.defaultDuration ?? defaultAlertsPluginOptions.defaultDuration,
|
|
1350
|
+
alert
|
|
1351
|
+
);
|
|
1352
|
+
const defaultAlertDisplay = alert.display ?? pluginConfig.defaultDisplay?.[alert.type] ?? defaultAlertsPluginOptions.defaultDisplay[alert.type] ?? "default";
|
|
1353
|
+
const calledOnCloseRef = (0, import_react10.useRef)(false);
|
|
1354
|
+
const [isRemoved, setIsRemoved] = (0, import_react_better_core9.useBooleanState)();
|
|
1355
|
+
const onPressCloseAlert = (0, import_react10.useCallback)(() => {
|
|
1356
|
+
setIsRemoved.setTrue();
|
|
1357
|
+
setTimeout(() => {
|
|
1358
|
+
alertControls2.removeAlert(alert.id);
|
|
1359
|
+
if (!calledOnCloseRef.current) {
|
|
1360
|
+
alert.onClose?.(alert);
|
|
1361
|
+
calledOnCloseRef.current = true;
|
|
1362
|
+
}
|
|
1363
|
+
}, defaultTransitionDuration);
|
|
1364
|
+
}, [alert]);
|
|
1365
|
+
const alertData = (0, import_react10.useMemo)(
|
|
1366
|
+
() => ({
|
|
1367
|
+
info: {
|
|
1368
|
+
icon: "infoI",
|
|
1369
|
+
iconIOS: "info",
|
|
1370
|
+
backgroundColor: theme2.colors.info,
|
|
1371
|
+
title: "Info"
|
|
1372
|
+
},
|
|
1373
|
+
success: {
|
|
1374
|
+
icon: "check",
|
|
1375
|
+
backgroundColor: theme2.colors.success,
|
|
1376
|
+
title: "Success"
|
|
1377
|
+
},
|
|
1378
|
+
warning: {
|
|
1379
|
+
icon: "warningTriangle",
|
|
1380
|
+
backgroundColor: theme2.colors.warn,
|
|
1381
|
+
title: "Warning"
|
|
1382
|
+
},
|
|
1383
|
+
error: {
|
|
1384
|
+
icon: "XMark",
|
|
1385
|
+
backgroundColor: theme2.colors.error,
|
|
1386
|
+
title: "Error"
|
|
1387
|
+
}
|
|
1388
|
+
}),
|
|
1389
|
+
[theme2]
|
|
1390
|
+
);
|
|
1391
|
+
(0, import_react10.useEffect)(() => {
|
|
1392
|
+
const timeout = setTimeout(onPressCloseAlert, defaultAlertDurationNumber);
|
|
1393
|
+
return () => {
|
|
1394
|
+
clearTimeout(timeout);
|
|
1395
|
+
};
|
|
1396
|
+
}, [onPressCloseAlert, defaultAlertDurationNumber]);
|
|
1397
|
+
const iconSize = 16;
|
|
1398
|
+
const iconPadding = (theme2.styles.space + theme2.styles.gap) / 2;
|
|
1399
|
+
return defaultAlertDisplay === "prominent" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1400
|
+
Animate_default.View,
|
|
1401
|
+
{
|
|
1402
|
+
maxWidth: "100%",
|
|
1403
|
+
initialOpacity: 0,
|
|
1404
|
+
animateOpacity: isRemoved ? 0 : 1,
|
|
1405
|
+
initialX: 40,
|
|
1406
|
+
animateX: isRemoved ? 40 : 0,
|
|
1407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(View_default.box, { width: "auto", withShadow: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.space, children: [
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1409
|
+
View_default,
|
|
1410
|
+
{
|
|
1411
|
+
alignItems: "center",
|
|
1412
|
+
justifyContent: "center",
|
|
1413
|
+
backgroundColor: alertData[alert.type].backgroundColor,
|
|
1414
|
+
borderRadius: 999,
|
|
1415
|
+
padding: iconPadding,
|
|
1416
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1417
|
+
Icon_default,
|
|
1418
|
+
{
|
|
1419
|
+
name: alertData[alert.type].icon,
|
|
1420
|
+
nameIOS: alertData[alert.type].iconIOS,
|
|
1421
|
+
size: iconSize,
|
|
1422
|
+
color: alertData[alert.type].iconColor ?? theme2.colors.base
|
|
1423
|
+
}
|
|
1424
|
+
)
|
|
1425
|
+
}
|
|
1426
|
+
),
|
|
1427
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1428
|
+
View_default,
|
|
1429
|
+
{
|
|
1430
|
+
maxWidth: device.windowDimensions.width - theme2.styles.space - theme2.styles.space - (iconPadding + iconSize + iconPadding) - theme2.styles.space - 60 - theme2.styles.space - theme2.styles.space - theme2.styles.space,
|
|
1431
|
+
gap: theme2.styles.gap / 3,
|
|
1432
|
+
children: [
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text_default, { fontSize: 18, fontWeight: 700, children: alert.title ?? alertData[alert.type].title }),
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text_default.body, { children: alert.message })
|
|
1435
|
+
]
|
|
1436
|
+
}
|
|
1437
|
+
),
|
|
1438
|
+
pluginConfig.withCloseButton && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button_default.icon, { icon: "XMark", onPress: onPressCloseAlert })
|
|
1439
|
+
] }) })
|
|
1440
|
+
}
|
|
1441
|
+
);
|
|
1442
|
+
}
|
|
1443
|
+
var Alert_default = (0, import_react10.memo)(Alert);
|
|
1444
|
+
|
|
1445
|
+
// src/components/alerts/AlertsHolder.tsx
|
|
1446
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1447
|
+
function AlertsHolder() {
|
|
1448
|
+
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
1449
|
+
const device = useDevice();
|
|
1450
|
+
const alertsPlugin2 = usePlugin("alerts");
|
|
1451
|
+
const { alerts } = useBetterComponentsContextInternal();
|
|
1452
|
+
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
1453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1454
|
+
View_default,
|
|
1455
|
+
{
|
|
1456
|
+
position: "absolute",
|
|
1457
|
+
width: "100%",
|
|
1458
|
+
top: device.safeArea.afterCalculations.top + theme2.styles.gap / 2,
|
|
1459
|
+
left: 0,
|
|
1460
|
+
gap: theme2.styles.gap,
|
|
1461
|
+
alignItems: pluginConfig.align === "left" ? "flex-start" : pluginConfig.align === "center" ? "center" : pluginConfig.align === "right" ? "flex-end" : void 0,
|
|
1462
|
+
paddingHorizontal: theme2.styles.space,
|
|
1463
|
+
pointerEvents: "box-none",
|
|
1464
|
+
zIndex: 1e3,
|
|
1465
|
+
children: alerts.map((alert) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Alert_default, { alert }, alert.id))
|
|
1466
|
+
}
|
|
1467
|
+
);
|
|
1468
|
+
}
|
|
1469
|
+
var AlertsHolder_default = (0, import_react11.memo)(AlertsHolder);
|
|
1470
|
+
|
|
1471
|
+
// src/components/BetterComponentsProvider.tsx
|
|
1472
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1473
|
+
var betterComponentsContext = (0, import_react12.createContext)(void 0);
|
|
1474
|
+
var externalBetterCoreContextValue;
|
|
1475
|
+
var externalBetterComponentsContextValue;
|
|
1476
|
+
var useBetterComponentsContext = () => {
|
|
1477
|
+
const coreContext = (0, import_react_better_core11.useBetterCoreContext)();
|
|
1478
|
+
const context = (0, import_react12.useContext)(betterComponentsContext);
|
|
1479
|
+
if (context === void 0)
|
|
1480
|
+
throw new Error(
|
|
1481
|
+
"`useBetterComponentsContext()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1482
|
+
);
|
|
1483
|
+
const { plugins, componentsState, ...rest } = context;
|
|
1484
|
+
return {
|
|
1485
|
+
...coreContext,
|
|
1486
|
+
...rest
|
|
1487
|
+
};
|
|
1488
|
+
};
|
|
1489
|
+
var useBetterComponentsContextInternal = () => {
|
|
1490
|
+
const context = (0, import_react12.useContext)(betterComponentsContext);
|
|
1491
|
+
if (context === void 0)
|
|
1492
|
+
throw new Error(
|
|
1493
|
+
"`useBetterComponentsContextInternal()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1494
|
+
);
|
|
1495
|
+
return context;
|
|
1496
|
+
};
|
|
1497
|
+
var useAlertControls = () => {
|
|
1498
|
+
const context = (0, import_react12.useContext)(betterComponentsContext);
|
|
1499
|
+
if (context === void 0)
|
|
1500
|
+
throw new Error(
|
|
1501
|
+
"`useAlertControls()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1502
|
+
);
|
|
1503
|
+
const createAlert = (0, import_react12.useCallback)((alert) => {
|
|
1504
|
+
const readyAlert = {
|
|
1505
|
+
id: (0, import_react_better_core11.generateRandomString)(36),
|
|
1506
|
+
...alert
|
|
1507
|
+
};
|
|
1508
|
+
context.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
1509
|
+
return readyAlert;
|
|
1510
|
+
}, []);
|
|
1511
|
+
const removeAlert = (0, import_react12.useCallback)((alertId) => {
|
|
1512
|
+
context.setAlerts((oldValue) => oldValue.filter((alert) => alert.id !== alertId));
|
|
1513
|
+
}, []);
|
|
1514
|
+
return {
|
|
1515
|
+
createAlert,
|
|
1516
|
+
removeAlert
|
|
1517
|
+
};
|
|
1518
|
+
};
|
|
1519
|
+
var usePlugin = (pluginName) => {
|
|
1520
|
+
const context = (0, import_react12.useContext)(betterComponentsContext);
|
|
1521
|
+
if (context === void 0) {
|
|
1522
|
+
throw new Error(
|
|
1523
|
+
"`usePlugin()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1524
|
+
);
|
|
1525
|
+
}
|
|
1526
|
+
return (0, import_react12.useMemo)(
|
|
1527
|
+
() => context.plugins.find((plugin) => plugin.name === pluginName),
|
|
1528
|
+
[context.plugins, pluginName]
|
|
1529
|
+
);
|
|
1530
|
+
};
|
|
1531
|
+
function BetterComponentsProviderInternalContent({ children }) {
|
|
1532
|
+
const alertsPlugin2 = usePlugin("alerts");
|
|
1533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1534
|
+
children,
|
|
1535
|
+
alertsPlugin2 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AlertsHolder_default, {})
|
|
1536
|
+
] });
|
|
1537
|
+
}
|
|
1538
|
+
function BetterComponentsProviderInternal({
|
|
1539
|
+
config,
|
|
1540
|
+
plugins,
|
|
1541
|
+
children
|
|
1542
|
+
}) {
|
|
1543
|
+
const betterCoreContext = (0, import_react_better_core11.useBetterCoreContext)();
|
|
1544
|
+
const [alerts, setAlerts] = (0, import_react12.useState)([]);
|
|
1545
|
+
const readyConfig = (0, import_react12.useMemo)(
|
|
1546
|
+
() => ({
|
|
1547
|
+
app: {
|
|
1548
|
+
...appConfig,
|
|
1549
|
+
...config?.app
|
|
1550
|
+
},
|
|
1551
|
+
alerts,
|
|
1552
|
+
setAlerts,
|
|
1553
|
+
plugins: plugins ?? [],
|
|
1554
|
+
componentsState: {}
|
|
1555
|
+
}),
|
|
1556
|
+
[config, alerts, plugins]
|
|
1557
|
+
);
|
|
1558
|
+
(0, import_react12.useEffect)(() => {
|
|
1559
|
+
if (!plugins) return;
|
|
1560
|
+
plugins.forEach((plugin) => {
|
|
1561
|
+
plugin.initialize?.();
|
|
1562
|
+
});
|
|
1563
|
+
}, []);
|
|
1564
|
+
externalBetterCoreContextValue = betterCoreContext;
|
|
1565
|
+
externalBetterComponentsContextValue = readyConfig;
|
|
1566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(betterComponentsContext.Provider, { value: readyConfig, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BetterComponentsProviderInternalContent, { children }) });
|
|
1567
|
+
}
|
|
1568
|
+
function BetterComponentsProvider({ config, ...props }) {
|
|
1569
|
+
const coreConfig = (0, import_react12.useMemo)(
|
|
1570
|
+
() => ({
|
|
1571
|
+
theme: {
|
|
1572
|
+
...theme,
|
|
1573
|
+
...config?.theme
|
|
1574
|
+
},
|
|
1575
|
+
// colorTheme: config?.colorTheme ?? (localStorage.getItem("theme") === "dark" ? "dark" : "light"),
|
|
1576
|
+
colorTheme: config?.colorTheme ?? "light",
|
|
1577
|
+
icons: {
|
|
1578
|
+
...icons,
|
|
1579
|
+
...config?.icons
|
|
1580
|
+
},
|
|
1581
|
+
assets: {
|
|
1582
|
+
...assets,
|
|
1583
|
+
...config?.assets
|
|
1584
|
+
},
|
|
1585
|
+
loaders: config?.loaders
|
|
1586
|
+
}),
|
|
1587
|
+
[config]
|
|
1178
1588
|
);
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
ButtonComponent.text = function ButtonText(props) {
|
|
1185
|
-
const theme2 = (0, import_react_better_core6.useTheme)();
|
|
1186
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1187
|
-
ButtonComponent,
|
|
1188
|
-
{
|
|
1189
|
-
width: "auto",
|
|
1190
|
-
textColor: theme2.colors.textPrimary,
|
|
1191
|
-
textDecorationLine: "underline",
|
|
1192
|
-
backgroundColor: "transparent",
|
|
1193
|
-
paddingHorizontal: theme2.styles.space,
|
|
1194
|
-
paddingVertical: theme2.styles.gap,
|
|
1195
|
-
isSmall: true,
|
|
1196
|
-
pressType: "opacity",
|
|
1197
|
-
...props
|
|
1198
|
-
}
|
|
1589
|
+
const componentsConfig = (0, import_react12.useMemo)(
|
|
1590
|
+
() => ({
|
|
1591
|
+
app: config?.app
|
|
1592
|
+
}),
|
|
1593
|
+
[config]
|
|
1199
1594
|
);
|
|
1595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_better_core11.BetterCoreProvider, { config: coreConfig, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BetterComponentsProviderInternal, { config: componentsConfig, ...props }) });
|
|
1596
|
+
}
|
|
1597
|
+
var BetterComponentsProvider_default = (0, import_react12.memo)(BetterComponentsProvider);
|
|
1598
|
+
|
|
1599
|
+
// src/utils/functions.ts
|
|
1600
|
+
var getFormErrorObject = (formValues) => {
|
|
1601
|
+
return {};
|
|
1200
1602
|
};
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1603
|
+
|
|
1604
|
+
// src/utils/asyncStorage.ts
|
|
1605
|
+
var import_async_storage = __toESM(require("@react-native-async-storage/async-storage"));
|
|
1606
|
+
function generateAsyncStorage() {
|
|
1607
|
+
return {
|
|
1608
|
+
setItem: async (name, value) => {
|
|
1609
|
+
if (value) await import_async_storage.default.setItem(name.toString(), JSON.stringify(value));
|
|
1610
|
+
else await import_async_storage.default.removeItem(name.toString());
|
|
1611
|
+
},
|
|
1612
|
+
getItem: async (name) => {
|
|
1613
|
+
const item = await import_async_storage.default.getItem(name.toString());
|
|
1614
|
+
if (item === null) return void 0;
|
|
1615
|
+
try {
|
|
1616
|
+
return JSON.parse(item);
|
|
1617
|
+
} catch (error) {
|
|
1618
|
+
return void 0;
|
|
1619
|
+
}
|
|
1620
|
+
},
|
|
1621
|
+
removeItem: async (name) => {
|
|
1622
|
+
await import_async_storage.default.removeItem(name.toString());
|
|
1623
|
+
},
|
|
1624
|
+
removeAllItems: () => {
|
|
1625
|
+
import_async_storage.default.clear();
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
}
|
|
1206
1629
|
|
|
1207
1630
|
// src/components/ScreenHolder.tsx
|
|
1208
|
-
var
|
|
1209
|
-
var
|
|
1210
|
-
var
|
|
1211
|
-
var
|
|
1631
|
+
var import_react13 = require("react");
|
|
1632
|
+
var import_react_native8 = require("react-native");
|
|
1633
|
+
var import_react_better_core12 = require("react-better-core");
|
|
1634
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1212
1635
|
var ScreenHolderComponent = ({
|
|
1213
1636
|
noScroll,
|
|
1214
1637
|
noSideSpace,
|
|
@@ -1225,17 +1648,17 @@ var ScreenHolderComponent = ({
|
|
|
1225
1648
|
withNoHeader,
|
|
1226
1649
|
children
|
|
1227
1650
|
}) => {
|
|
1228
|
-
const theme2 = (0,
|
|
1651
|
+
const theme2 = (0, import_react_better_core12.useTheme)();
|
|
1229
1652
|
const device = useDevice();
|
|
1230
1653
|
const keyboard = useKeyboard();
|
|
1231
|
-
const [isRefreshing, setIsRefreshing] = (0,
|
|
1232
|
-
const keyboardAvoidingViewStyle = (0,
|
|
1654
|
+
const [isRefreshing, setIsRefreshing] = (0, import_react_better_core12.useBooleanState)();
|
|
1655
|
+
const keyboardAvoidingViewStyle = (0, import_react13.useMemo)(
|
|
1233
1656
|
() => ({
|
|
1234
1657
|
flex: 1
|
|
1235
1658
|
}),
|
|
1236
1659
|
[]
|
|
1237
1660
|
);
|
|
1238
|
-
const onRefreshElement = (0,
|
|
1661
|
+
const onRefreshElement = (0, import_react13.useCallback)(() => {
|
|
1239
1662
|
setIsRefreshing.setTrue();
|
|
1240
1663
|
onRefresh?.();
|
|
1241
1664
|
setTimeout(() => {
|
|
@@ -1243,36 +1666,36 @@ var ScreenHolderComponent = ({
|
|
|
1243
1666
|
onRefreshEnd?.();
|
|
1244
1667
|
}, refreshTimeout * 1e3);
|
|
1245
1668
|
}, [onRefresh, onRefreshEnd, refreshTimeout]);
|
|
1246
|
-
const content = /* @__PURE__ */ (0,
|
|
1669
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1247
1670
|
View_default,
|
|
1248
1671
|
{
|
|
1249
1672
|
flex: 1,
|
|
1250
1673
|
paddingHorizontal: !noSideSpace ? theme2.styles.space : void 0,
|
|
1251
1674
|
paddingTop: theme2.styles.gap + (insideTopSafeArea ? device.safeArea.afterCalculations.top : 0),
|
|
1252
|
-
paddingBottom:
|
|
1675
|
+
paddingBottom: import_react_native8.Platform.OS === "ios" && keyboard.isOpened ? device.safeArea.afterCalculations.top : bottomSpace + (insideBottomSafeArea ? device.safeArea.afterCalculations.bottom : 0),
|
|
1253
1676
|
children
|
|
1254
1677
|
}
|
|
1255
1678
|
);
|
|
1256
1679
|
const withRefresh = onRefresh || onRefreshEnd;
|
|
1257
|
-
return /* @__PURE__ */ (0,
|
|
1258
|
-
|
|
1680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(View_default, { flex: 1, backgroundColor: backgroundColor ?? theme2.colors.backgroundBase, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1681
|
+
import_react_native8.KeyboardAvoidingView,
|
|
1259
1682
|
{
|
|
1260
1683
|
style: keyboardAvoidingViewStyle,
|
|
1261
|
-
keyboardVerticalOffset: keyboardVerticalOffset ?? (withNoHeader ?
|
|
1262
|
-
behavior:
|
|
1684
|
+
keyboardVerticalOffset: keyboardVerticalOffset ?? (withNoHeader ? import_react_native8.Platform.OS === "ios" ? 0 : theme2.styles.gap : keepFooterOnKeyboardOpened ? import_react_native8.Platform.OS === "ios" ? device.safeArea.afterCalculations.bottom : theme2.styles.gap : void 0),
|
|
1685
|
+
behavior: import_react_native8.Platform.OS === "ios" ? "padding" : "height",
|
|
1263
1686
|
children: [
|
|
1264
|
-
/* @__PURE__ */ (0,
|
|
1265
|
-
|
|
1687
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(View_default, { flex: 1, children: noScroll ? content : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1688
|
+
import_react_native8.ScrollView,
|
|
1266
1689
|
{
|
|
1267
|
-
refreshControl: withRefresh ? /* @__PURE__ */ (0,
|
|
1690
|
+
refreshControl: withRefresh ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native8.RefreshControl, { refreshing: isRefreshing, onRefresh: onRefreshElement }) : void 0,
|
|
1268
1691
|
children: content
|
|
1269
1692
|
}
|
|
1270
1693
|
) }),
|
|
1271
|
-
keepFooterOnKeyboardOpened || (
|
|
1694
|
+
keepFooterOnKeyboardOpened || (import_react_native8.Platform.OS === "ios" ? !keyboard.willOpen : !keyboard.isOpened) ? footer && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(View_default, { children: footer }) : !withNoHeader && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1272
1695
|
View_default,
|
|
1273
1696
|
{
|
|
1274
1697
|
width: "100%",
|
|
1275
|
-
height: device.safeArea.afterCalculations.bottom + (
|
|
1698
|
+
height: device.safeArea.afterCalculations.bottom + (import_react_native8.Platform.OS === "android" ? theme2.styles.gap : 0)
|
|
1276
1699
|
}
|
|
1277
1700
|
)
|
|
1278
1701
|
]
|
|
@@ -1286,149 +1709,31 @@ ScreenHolderComponent.footer = function Footer({
|
|
|
1286
1709
|
withNoHeader,
|
|
1287
1710
|
children
|
|
1288
1711
|
}) {
|
|
1289
|
-
const theme2 = (0,
|
|
1712
|
+
const theme2 = (0, import_react_better_core12.useTheme)();
|
|
1290
1713
|
const device = useDevice();
|
|
1291
1714
|
const keyboard = useKeyboard();
|
|
1292
|
-
return /* @__PURE__ */ (0,
|
|
1715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1293
1716
|
View_default,
|
|
1294
1717
|
{
|
|
1295
1718
|
backgroundColor: backgroundColor ?? theme2.colors.backgroundBase,
|
|
1296
1719
|
paddingHorizontal: !noSideSpace ? theme2.styles.space : void 0,
|
|
1297
1720
|
paddingTop: theme2.styles.gap,
|
|
1298
|
-
paddingBottom: (
|
|
1721
|
+
paddingBottom: (import_react_native8.Platform.OS === "ios" ? keyboard.willOpen : keyboard.isOpened) && withNoHeader ? theme2.styles.gap : insideBottomSafeArea ? device.safeArea.afterCalculations.bottom : void 0,
|
|
1299
1722
|
children
|
|
1300
1723
|
}
|
|
1301
1724
|
);
|
|
1302
1725
|
};
|
|
1303
|
-
var ScreenHolder = (0,
|
|
1726
|
+
var ScreenHolder = (0, import_react13.memo)(ScreenHolderComponent);
|
|
1304
1727
|
ScreenHolder.footer = ScreenHolderComponent.footer;
|
|
1305
1728
|
var ScreenHolder_default = ScreenHolder;
|
|
1306
1729
|
|
|
1307
|
-
// src/components/Image.tsx
|
|
1308
|
-
var import_react9 = require("react");
|
|
1309
|
-
var import_react_better_core8 = require("react-better-core");
|
|
1310
|
-
var import_react_native7 = require("react-native");
|
|
1311
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1312
|
-
var ImageComponent = function Image({ name, source, withDevFittingMode, ...props }) {
|
|
1313
|
-
const { assets: assets2 } = (0, import_react_better_core8.useBetterCoreContext)();
|
|
1314
|
-
const style = (0, import_react9.useMemo)(
|
|
1315
|
-
() => ({
|
|
1316
|
-
width: 100,
|
|
1317
|
-
height: 100,
|
|
1318
|
-
...withDevFittingMode ? {
|
|
1319
|
-
borderWidth: 1,
|
|
1320
|
-
borderColor: "#eb39f7"
|
|
1321
|
-
} : {},
|
|
1322
|
-
...props
|
|
1323
|
-
}),
|
|
1324
|
-
[withDevFittingMode, props]
|
|
1325
|
-
);
|
|
1326
|
-
(0, import_react9.useEffect)(() => {
|
|
1327
|
-
if (!name) return;
|
|
1328
|
-
if (!assets2[name.toString()])
|
|
1329
|
-
console.warn(
|
|
1330
|
-
`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.`
|
|
1331
|
-
);
|
|
1332
|
-
}, [assets2, name]);
|
|
1333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native7.Image, { source: name ? assets2[name.toString()] : source, style, ...props });
|
|
1334
|
-
};
|
|
1335
|
-
ImageComponent.profileImage = function ProfileImage({
|
|
1336
|
-
size = 50,
|
|
1337
|
-
letters,
|
|
1338
|
-
color,
|
|
1339
|
-
backgroundColor,
|
|
1340
|
-
...props
|
|
1341
|
-
}) {
|
|
1342
|
-
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1343
|
-
return letters ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1344
|
-
View_default,
|
|
1345
|
-
{
|
|
1346
|
-
width: size,
|
|
1347
|
-
height: size,
|
|
1348
|
-
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
1349
|
-
borderWidth: 1,
|
|
1350
|
-
borderColor: theme2.colors.border,
|
|
1351
|
-
borderRadius: 999,
|
|
1352
|
-
alignItems: "center",
|
|
1353
|
-
justifyContent: "center",
|
|
1354
|
-
...props,
|
|
1355
|
-
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) })
|
|
1356
|
-
}
|
|
1357
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1358
|
-
ImageComponent,
|
|
1359
|
-
{
|
|
1360
|
-
width: size,
|
|
1361
|
-
height: size,
|
|
1362
|
-
borderWidth: 1,
|
|
1363
|
-
borderColor: theme2.colors.border,
|
|
1364
|
-
borderRadius: 999,
|
|
1365
|
-
objectFit: "cover",
|
|
1366
|
-
...props
|
|
1367
|
-
}
|
|
1368
|
-
);
|
|
1369
|
-
};
|
|
1370
|
-
var Image2 = (0, import_react9.memo)(ImageComponent);
|
|
1371
|
-
Image2.profileImage = ImageComponent.profileImage;
|
|
1372
|
-
var Image_default = Image2;
|
|
1373
|
-
|
|
1374
|
-
// src/components/Icon.tsx
|
|
1375
|
-
var import_react10 = require("react");
|
|
1376
|
-
var import_react_native8 = require("react-native");
|
|
1377
|
-
var import_react_native_svg = require("react-native-svg");
|
|
1378
|
-
var import_react_better_core9 = require("react-better-core");
|
|
1379
|
-
var import_expo_symbols = require("expo-symbols");
|
|
1380
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1381
|
-
var import_react11 = require("react");
|
|
1382
|
-
function Icon({ name, nameIOS, size = 16, color, ...props }) {
|
|
1383
|
-
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
1384
|
-
const { icons: icons2 } = (0, import_react_better_core9.useBetterCoreContext)();
|
|
1385
|
-
const svgColor = color ?? theme2.colors.textPrimary;
|
|
1386
|
-
(0, import_react10.useEffect)(() => {
|
|
1387
|
-
if (!icons2[name.toString()])
|
|
1388
|
-
console.warn(
|
|
1389
|
-
`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.`
|
|
1390
|
-
);
|
|
1391
|
-
}, [icons2, name]);
|
|
1392
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1393
|
-
View_default,
|
|
1394
|
-
{
|
|
1395
|
-
width: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingHorizontal?.toString() ?? "0") ?? 0),
|
|
1396
|
-
height: size + (parseFloat(props.padding?.toString() ?? "0") ?? 0) + (parseFloat(props.paddingVertical?.toString() ?? "0") ?? 0),
|
|
1397
|
-
alignItems: "center",
|
|
1398
|
-
justifyContent: "center",
|
|
1399
|
-
pressType: "opacity",
|
|
1400
|
-
pressStrength: pressStrength().p2,
|
|
1401
|
-
...props,
|
|
1402
|
-
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)(
|
|
1403
|
-
import_react_native_svg.Svg,
|
|
1404
|
-
{
|
|
1405
|
-
width: size,
|
|
1406
|
-
height: size,
|
|
1407
|
-
viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
|
|
1408
|
-
fill: "none",
|
|
1409
|
-
children: icons2[name.toString()]?.paths.map(({ type, ...path }) => /* @__PURE__ */ (0, import_react11.createElement)(
|
|
1410
|
-
import_react_native_svg.Path,
|
|
1411
|
-
{
|
|
1412
|
-
...path,
|
|
1413
|
-
fill: type === "fill" ? svgColor : void 0,
|
|
1414
|
-
stroke: type === "stroke" ? svgColor : void 0,
|
|
1415
|
-
key: path.d
|
|
1416
|
-
}
|
|
1417
|
-
))
|
|
1418
|
-
}
|
|
1419
|
-
)
|
|
1420
|
-
}
|
|
1421
|
-
);
|
|
1422
|
-
}
|
|
1423
|
-
var Icon_default = (0, import_react10.memo)(Icon);
|
|
1424
|
-
|
|
1425
1730
|
// src/components/InputField.tsx
|
|
1426
|
-
var
|
|
1731
|
+
var import_react14 = require("react");
|
|
1427
1732
|
var import_react_native9 = require("react-native");
|
|
1428
1733
|
var import_datetimepicker = __toESM(require("@react-native-community/datetimepicker"));
|
|
1429
|
-
var
|
|
1430
|
-
var
|
|
1431
|
-
var InputFieldComponent = (0,
|
|
1734
|
+
var import_react_better_core13 = require("react-better-core");
|
|
1735
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1736
|
+
var InputFieldComponent = (0, import_react14.forwardRef)(
|
|
1432
1737
|
({
|
|
1433
1738
|
flex,
|
|
1434
1739
|
placeholder,
|
|
@@ -1479,12 +1784,12 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1479
1784
|
onPressEnter,
|
|
1480
1785
|
...props
|
|
1481
1786
|
}, ref) => {
|
|
1482
|
-
const theme2 = (0,
|
|
1483
|
-
const { colorTheme } = (0,
|
|
1484
|
-
const textInputRef = (0,
|
|
1485
|
-
const [internalValue, setInternalValue] = (0,
|
|
1486
|
-
const [internalDateValue, setInternalDateValue] = (0,
|
|
1487
|
-
const [isFocused, setIsFocused] = (0,
|
|
1787
|
+
const theme2 = (0, import_react_better_core13.useTheme)();
|
|
1788
|
+
const { colorTheme } = (0, import_react_better_core13.useBetterCoreContext)();
|
|
1789
|
+
const textInputRef = (0, import_react14.useRef)(null);
|
|
1790
|
+
const [internalValue, setInternalValue] = (0, import_react14.useState)(value?.toString() || defaultValue || "");
|
|
1791
|
+
const [internalDateValue, setInternalDateValue] = (0, import_react14.useState)();
|
|
1792
|
+
const [isFocused, setIsFocused] = (0, import_react_better_core13.useBooleanState)();
|
|
1488
1793
|
const isIOSDateTime = import_react_native9.Platform.OS === "ios" && (type === "date" || type === "time");
|
|
1489
1794
|
const iconSize = 16;
|
|
1490
1795
|
const iconPadding = onPressRightIcon ? theme2.styles.gap : 0;
|
|
@@ -1493,14 +1798,14 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1493
1798
|
const readyPaddingHorizontal = paddingHorizontal ?? theme2.styles.space;
|
|
1494
1799
|
const readyPaddingVertical = paddingVertical ? parseFloat(paddingVertical.toString()) : (theme2.styles.space + theme2.styles.gap) / 2;
|
|
1495
1800
|
const readyHeight = height ?? isIOSDateTime ? void 0 : borderWidth + readyPaddingVertical + lineHeight + readyPaddingVertical + borderWidth + (import_react_native9.Platform.OS === "android" ? 2 : 0);
|
|
1496
|
-
const onChangeRNDateTimePicker = (0,
|
|
1801
|
+
const onChangeRNDateTimePicker = (0, import_react14.useCallback)(
|
|
1497
1802
|
(event, data) => {
|
|
1498
1803
|
setInternalDateValue(data);
|
|
1499
1804
|
onChange?.(data?.toISOString() ?? "");
|
|
1500
1805
|
},
|
|
1501
1806
|
[onChange]
|
|
1502
1807
|
);
|
|
1503
|
-
const onPressInputField = (0,
|
|
1808
|
+
const onPressInputField = (0, import_react14.useCallback)(
|
|
1504
1809
|
(event) => {
|
|
1505
1810
|
onPress?.(event);
|
|
1506
1811
|
if (type === "date" || type === "time") {
|
|
@@ -1528,22 +1833,22 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1528
1833
|
},
|
|
1529
1834
|
[onPress, type, internalDateValue, onChangeRNDateTimePicker]
|
|
1530
1835
|
);
|
|
1531
|
-
const onFocusElement = (0,
|
|
1836
|
+
const onFocusElement = (0, import_react14.useCallback)((event) => {
|
|
1532
1837
|
setIsFocused.setTrue();
|
|
1533
1838
|
onFocus?.(event);
|
|
1534
1839
|
}, []);
|
|
1535
|
-
const onBlurElement = (0,
|
|
1840
|
+
const onBlurElement = (0, import_react14.useCallback)((event) => {
|
|
1536
1841
|
setIsFocused.setFalse();
|
|
1537
1842
|
onBlur?.(event);
|
|
1538
1843
|
}, []);
|
|
1539
|
-
const onChangeText = (0,
|
|
1844
|
+
const onChangeText = (0, import_react14.useCallback)(
|
|
1540
1845
|
(text) => {
|
|
1541
1846
|
setInternalValue(text);
|
|
1542
1847
|
onChange?.(text);
|
|
1543
1848
|
},
|
|
1544
1849
|
[onChange]
|
|
1545
1850
|
);
|
|
1546
|
-
const textInputStyle = (0,
|
|
1851
|
+
const textInputStyle = (0, import_react14.useMemo)(
|
|
1547
1852
|
() => ({
|
|
1548
1853
|
flex: 1,
|
|
1549
1854
|
fontSize,
|
|
@@ -1568,14 +1873,14 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1568
1873
|
rightIcon
|
|
1569
1874
|
]
|
|
1570
1875
|
);
|
|
1571
|
-
const rnDateTimePickerStyle = (0,
|
|
1876
|
+
const rnDateTimePickerStyle = (0, import_react14.useMemo)(
|
|
1572
1877
|
() => ({
|
|
1573
1878
|
flex: iOSDateTimeFullSize ? 1 : void 0,
|
|
1574
1879
|
marginLeft: -8 + (iOSDateTimeFullSize ? 0 : theme2.styles.space)
|
|
1575
1880
|
}),
|
|
1576
1881
|
[iOSDateTimeFullSize]
|
|
1577
1882
|
);
|
|
1578
|
-
(0,
|
|
1883
|
+
(0, import_react14.useEffect)(() => {
|
|
1579
1884
|
if (value === void 0) return;
|
|
1580
1885
|
setInternalValue(value.toString());
|
|
1581
1886
|
try {
|
|
@@ -1583,7 +1888,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1583
1888
|
} catch (error) {
|
|
1584
1889
|
}
|
|
1585
1890
|
}, [value]);
|
|
1586
|
-
(0,
|
|
1891
|
+
(0, import_react14.useEffect)(() => {
|
|
1587
1892
|
if (type !== "date" && type !== "time") return;
|
|
1588
1893
|
const date = internalDateValue?.toISOString().split("T")[0] ?? "";
|
|
1589
1894
|
const hours = internalDateValue ? internalDateValue.getHours().toString() : "00";
|
|
@@ -1592,7 +1897,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1592
1897
|
type === "date" ? date : internalDateValue ? `${hours.length === 1 ? `0${hours}` : hours}:${minutes.length === 1 ? `0${minutes}` : minutes}` : ""
|
|
1593
1898
|
);
|
|
1594
1899
|
}, [internalDateValue]);
|
|
1595
|
-
(0,
|
|
1900
|
+
(0, import_react14.useImperativeHandle)(
|
|
1596
1901
|
ref,
|
|
1597
1902
|
() => {
|
|
1598
1903
|
return textInputRef.current;
|
|
@@ -1600,12 +1905,12 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1600
1905
|
[]
|
|
1601
1906
|
);
|
|
1602
1907
|
const withPressInputField = !!onPress || type === "date" || type === "time";
|
|
1603
|
-
const prefixSuffixBackgroundColor = colorTheme === "light" ? (0,
|
|
1604
|
-
const labelComponent = label && /* @__PURE__ */ (0,
|
|
1605
|
-
/* @__PURE__ */ (0,
|
|
1606
|
-
required && /* @__PURE__ */ (0,
|
|
1908
|
+
const prefixSuffixBackgroundColor = colorTheme === "light" ? (0, import_react_better_core13.darkenColor)(theme2.colors.backgroundContent, 0.03) : (0, import_react_better_core13.lightenColor)(theme2.colors.backgroundContent, 0.1);
|
|
1909
|
+
const labelComponent = label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(View_default, { isRow: true, alignItems: "center", gap: 2, children: [
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { fontSize: 14, color: isError ? theme2.colors.error : theme2.colors.textSecondary, children: label }),
|
|
1911
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { color: theme2.colors.error, children: "*" })
|
|
1607
1912
|
] });
|
|
1608
|
-
return /* @__PURE__ */ (0,
|
|
1913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1609
1914
|
Animate_default.View,
|
|
1610
1915
|
{
|
|
1611
1916
|
flex,
|
|
@@ -1615,8 +1920,8 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1615
1920
|
...props,
|
|
1616
1921
|
children: [
|
|
1617
1922
|
isIOSDateTime && !iOSDateTimeFullSize ? void 0 : labelComponent,
|
|
1618
|
-
/* @__PURE__ */ (0,
|
|
1619
|
-
prefix && /* @__PURE__ */ (0,
|
|
1923
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(View_default, { isRow: true, position: "relative", alignItems: "center", height: readyHeight, children: [
|
|
1924
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1620
1925
|
View_default,
|
|
1621
1926
|
{
|
|
1622
1927
|
isRow: true,
|
|
@@ -1631,7 +1936,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1631
1936
|
borderColor: theme2.colors.border,
|
|
1632
1937
|
paddingHorizontal: readyPaddingHorizontal,
|
|
1633
1938
|
onPress: onPressPrefix,
|
|
1634
|
-
children: typeof prefix === "string" ? /* @__PURE__ */ (0,
|
|
1939
|
+
children: typeof prefix === "string" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1635
1940
|
Text_default,
|
|
1636
1941
|
{
|
|
1637
1942
|
fontWeight: 700,
|
|
@@ -1642,9 +1947,9 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1642
1947
|
) : prefix
|
|
1643
1948
|
}
|
|
1644
1949
|
),
|
|
1645
|
-
isIOSDateTime ? /* @__PURE__ */ (0,
|
|
1950
|
+
isIOSDateTime ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1646
1951
|
!iOSDateTimeFullSize ? labelComponent : void 0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1952
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1648
1953
|
import_datetimepicker.default,
|
|
1649
1954
|
{
|
|
1650
1955
|
value: internalDateValue ?? /* @__PURE__ */ new Date(),
|
|
@@ -1656,7 +1961,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1656
1961
|
onChange: onChangeRNDateTimePicker
|
|
1657
1962
|
}
|
|
1658
1963
|
)
|
|
1659
|
-
] }) : /* @__PURE__ */ (0,
|
|
1964
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1660
1965
|
View_default,
|
|
1661
1966
|
{
|
|
1662
1967
|
flex: 1,
|
|
@@ -1667,7 +1972,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1667
1972
|
borderBottomRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1668
1973
|
pressStrength: 1,
|
|
1669
1974
|
onPress: import_react_native9.Platform.OS === "android" ? editable === false || withPressInputField ? onPressInputField : void 0 : void 0,
|
|
1670
|
-
children: /* @__PURE__ */ (0,
|
|
1975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1671
1976
|
Animate_default.View,
|
|
1672
1977
|
{
|
|
1673
1978
|
position: "relative",
|
|
@@ -1683,7 +1988,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1683
1988
|
animateBorderColor: isFocused ? theme2.colors.primary : isError ? theme2.colors.error : theme2.colors.border,
|
|
1684
1989
|
overflow: "hidden",
|
|
1685
1990
|
children: [
|
|
1686
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
1991
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1687
1992
|
Icon_default,
|
|
1688
1993
|
{
|
|
1689
1994
|
position: "absolute",
|
|
@@ -1696,7 +2001,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1696
2001
|
onPress: onPressLeftIcon
|
|
1697
2002
|
}
|
|
1698
2003
|
),
|
|
1699
|
-
/* @__PURE__ */ (0,
|
|
2004
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1700
2005
|
import_react_native9.TextInput,
|
|
1701
2006
|
{
|
|
1702
2007
|
style: textInputStyle,
|
|
@@ -1729,7 +2034,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1729
2034
|
ref: textInputRef
|
|
1730
2035
|
}
|
|
1731
2036
|
),
|
|
1732
|
-
rightIcon && /* @__PURE__ */ (0,
|
|
2037
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1733
2038
|
Icon_default,
|
|
1734
2039
|
{
|
|
1735
2040
|
position: "absolute",
|
|
@@ -1747,7 +2052,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1747
2052
|
)
|
|
1748
2053
|
}
|
|
1749
2054
|
),
|
|
1750
|
-
suffix && /* @__PURE__ */ (0,
|
|
2055
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1751
2056
|
View_default,
|
|
1752
2057
|
{
|
|
1753
2058
|
isRow: true,
|
|
@@ -1761,7 +2066,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1761
2066
|
borderColor: theme2.colors.border,
|
|
1762
2067
|
paddingHorizontal: readyPaddingHorizontal,
|
|
1763
2068
|
onPress: onPressSuffix,
|
|
1764
|
-
children: typeof suffix === "string" ? /* @__PURE__ */ (0,
|
|
2069
|
+
children: typeof suffix === "string" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1765
2070
|
Text_default,
|
|
1766
2071
|
{
|
|
1767
2072
|
fontWeight: 700,
|
|
@@ -1773,7 +2078,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1773
2078
|
}
|
|
1774
2079
|
)
|
|
1775
2080
|
] }),
|
|
1776
|
-
infoMessage && /* @__PURE__ */ (0,
|
|
2081
|
+
infoMessage && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1777
2082
|
Animate_default.Text,
|
|
1778
2083
|
{
|
|
1779
2084
|
fontSize: 14,
|
|
@@ -1785,7 +2090,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1785
2090
|
children: infoMessage
|
|
1786
2091
|
}
|
|
1787
2092
|
),
|
|
1788
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
2093
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1789
2094
|
Animate_default.Text,
|
|
1790
2095
|
{
|
|
1791
2096
|
fontSize: 14,
|
|
@@ -1802,8 +2107,8 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1802
2107
|
);
|
|
1803
2108
|
}
|
|
1804
2109
|
);
|
|
1805
|
-
InputFieldComponent.email = (0,
|
|
1806
|
-
return /* @__PURE__ */ (0,
|
|
2110
|
+
InputFieldComponent.email = (0, import_react14.forwardRef)(function Email(props, ref) {
|
|
2111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1807
2112
|
InputFieldComponent,
|
|
1808
2113
|
{
|
|
1809
2114
|
placeholder: "your@email.here",
|
|
@@ -1816,21 +2121,21 @@ InputFieldComponent.email = (0, import_react12.forwardRef)(function Email(props,
|
|
|
1816
2121
|
}
|
|
1817
2122
|
);
|
|
1818
2123
|
});
|
|
1819
|
-
InputFieldComponent.password = (0,
|
|
1820
|
-
const inputFieldRef = (0,
|
|
1821
|
-
const [showPassword, setShowPassword] = (0,
|
|
1822
|
-
const onPressEye = (0,
|
|
2124
|
+
InputFieldComponent.password = (0, import_react14.forwardRef)(function Password(props, ref) {
|
|
2125
|
+
const inputFieldRef = (0, import_react14.useRef)(null);
|
|
2126
|
+
const [showPassword, setShowPassword] = (0, import_react_better_core13.useBooleanState)();
|
|
2127
|
+
const onPressEye = (0, import_react14.useCallback)(() => {
|
|
1823
2128
|
setShowPassword.toggle();
|
|
1824
2129
|
inputFieldRef.current?.focus();
|
|
1825
2130
|
}, []);
|
|
1826
|
-
(0,
|
|
2131
|
+
(0, import_react14.useImperativeHandle)(
|
|
1827
2132
|
ref,
|
|
1828
2133
|
() => {
|
|
1829
2134
|
return inputFieldRef.current;
|
|
1830
2135
|
},
|
|
1831
2136
|
[]
|
|
1832
2137
|
);
|
|
1833
|
-
return /* @__PURE__ */ (0,
|
|
2138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1834
2139
|
InputFieldComponent,
|
|
1835
2140
|
{
|
|
1836
2141
|
secureTextEntry: !showPassword,
|
|
@@ -1845,12 +2150,12 @@ InputFieldComponent.password = (0, import_react12.forwardRef)(function Password(
|
|
|
1845
2150
|
}
|
|
1846
2151
|
);
|
|
1847
2152
|
});
|
|
1848
|
-
InputFieldComponent.search = (0,
|
|
1849
|
-
return /* @__PURE__ */ (0,
|
|
2153
|
+
InputFieldComponent.search = (0, import_react14.forwardRef)(function Search(props, ref) {
|
|
2154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(InputFieldComponent, { placeholder: "Search...", leftIcon: "magnifyingGlass", ...props, ref });
|
|
1850
2155
|
});
|
|
1851
|
-
InputFieldComponent.code = (0,
|
|
1852
|
-
const theme2 = (0,
|
|
1853
|
-
return /* @__PURE__ */ (0,
|
|
2156
|
+
InputFieldComponent.code = (0, import_react14.forwardRef)(function Password2({ isSmall, ...props }, ref) {
|
|
2157
|
+
const theme2 = (0, import_react_better_core13.useTheme)();
|
|
2158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1854
2159
|
InputFieldComponent,
|
|
1855
2160
|
{
|
|
1856
2161
|
flex: 1,
|
|
@@ -1865,7 +2170,7 @@ InputFieldComponent.code = (0, import_react12.forwardRef)(function Password2({ i
|
|
|
1865
2170
|
}
|
|
1866
2171
|
);
|
|
1867
2172
|
});
|
|
1868
|
-
var InputField = (0,
|
|
2173
|
+
var InputField = (0, import_react14.memo)(InputFieldComponent);
|
|
1869
2174
|
InputField.email = InputFieldComponent.email;
|
|
1870
2175
|
InputField.password = InputFieldComponent.password;
|
|
1871
2176
|
InputField.search = InputFieldComponent.search;
|
|
@@ -1873,32 +2178,32 @@ InputField.code = InputFieldComponent.code;
|
|
|
1873
2178
|
var InputField_default = InputField;
|
|
1874
2179
|
|
|
1875
2180
|
// src/components/Switch.tsx
|
|
1876
|
-
var
|
|
2181
|
+
var import_react15 = require("react");
|
|
1877
2182
|
var import_react_native10 = require("react-native");
|
|
1878
|
-
var
|
|
1879
|
-
var
|
|
2183
|
+
var import_react_better_core14 = require("react-better-core");
|
|
2184
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1880
2185
|
function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
1881
|
-
const theme2 = (0,
|
|
1882
|
-
const [enabled, setEnabled] = (0,
|
|
1883
|
-
const onPressElement = (0,
|
|
2186
|
+
const theme2 = (0, import_react_better_core14.useTheme)();
|
|
2187
|
+
const [enabled, setEnabled] = (0, import_react_better_core14.useBooleanState)(isEnabled ?? defaultIsEnabled);
|
|
2188
|
+
const onPressElement = (0, import_react15.useCallback)(() => {
|
|
1884
2189
|
onChange?.(!enabled);
|
|
1885
2190
|
setEnabled.toggle();
|
|
1886
2191
|
}, [onChange, enabled]);
|
|
1887
|
-
const trackColor = (0,
|
|
2192
|
+
const trackColor = (0, import_react15.useMemo)(
|
|
1888
2193
|
() => ({
|
|
1889
2194
|
false: theme2.colors.border,
|
|
1890
2195
|
true: theme2.colors.primary
|
|
1891
2196
|
}),
|
|
1892
2197
|
[theme2.colors]
|
|
1893
2198
|
);
|
|
1894
|
-
(0,
|
|
2199
|
+
(0, import_react15.useEffect)(() => {
|
|
1895
2200
|
if (isEnabled === void 0) return;
|
|
1896
2201
|
setEnabled.setState(isEnabled);
|
|
1897
2202
|
}, [isEnabled]);
|
|
1898
2203
|
const ballSize = 26;
|
|
1899
2204
|
const ballGap = 3;
|
|
1900
2205
|
const holderWidth = ballSize * 2.1;
|
|
1901
|
-
return import_react_native10.Platform.OS === "ios" ? /* @__PURE__ */ (0,
|
|
2206
|
+
return import_react_native10.Platform.OS === "ios" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1902
2207
|
import_react_native10.Switch,
|
|
1903
2208
|
{
|
|
1904
2209
|
trackColor,
|
|
@@ -1907,7 +2212,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1907
2212
|
value: enabled,
|
|
1908
2213
|
disabled
|
|
1909
2214
|
}
|
|
1910
|
-
) : /* @__PURE__ */ (0,
|
|
2215
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1911
2216
|
View_default,
|
|
1912
2217
|
{
|
|
1913
2218
|
width: holderWidth,
|
|
@@ -1915,7 +2220,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1915
2220
|
pressStrength: pressStrength().p05,
|
|
1916
2221
|
disabled,
|
|
1917
2222
|
onPress: !disabled ? onPressElement : void 0,
|
|
1918
|
-
children: /* @__PURE__ */ (0,
|
|
2223
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1919
2224
|
Animate_default.View,
|
|
1920
2225
|
{
|
|
1921
2226
|
width: "100%",
|
|
@@ -1925,7 +2230,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1925
2230
|
animateOpacity: disabled ? 0.6 : 1,
|
|
1926
2231
|
initialBackgroundColor: theme2.colors.border,
|
|
1927
2232
|
animateBackgroundColor: enabled ? theme2.colors.primary : theme2.colors.border,
|
|
1928
|
-
children: /* @__PURE__ */ (0,
|
|
2233
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1929
2234
|
Animate_default.View,
|
|
1930
2235
|
{
|
|
1931
2236
|
width: ballSize,
|
|
@@ -1942,16 +2247,16 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1942
2247
|
}
|
|
1943
2248
|
);
|
|
1944
2249
|
}
|
|
1945
|
-
var Switch_default = (0,
|
|
2250
|
+
var Switch_default = (0, import_react15.memo)(Switch);
|
|
1946
2251
|
|
|
1947
2252
|
// src/components/StatusBar.tsx
|
|
1948
|
-
var
|
|
1949
|
-
var
|
|
2253
|
+
var import_react16 = require("react");
|
|
2254
|
+
var import_react_better_core15 = require("react-better-core");
|
|
1950
2255
|
var import_react_native11 = require("react-native");
|
|
1951
|
-
var
|
|
2256
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1952
2257
|
function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }) {
|
|
1953
|
-
const theme2 = (0,
|
|
1954
|
-
return /* @__PURE__ */ (0,
|
|
2258
|
+
const theme2 = (0, import_react_better_core15.useTheme)();
|
|
2259
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1955
2260
|
import_react_native11.StatusBar,
|
|
1956
2261
|
{
|
|
1957
2262
|
backgroundColor: darkStatusBar ? theme2.colors.backgroundSecondary : void 0,
|
|
@@ -1960,29 +2265,31 @@ function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarSty
|
|
|
1960
2265
|
}
|
|
1961
2266
|
);
|
|
1962
2267
|
}
|
|
1963
|
-
var StatusBar_default = (0,
|
|
2268
|
+
var StatusBar_default = (0, import_react16.memo)(StatusBar);
|
|
1964
2269
|
|
|
1965
2270
|
// src/components/ListItem.tsx
|
|
1966
|
-
var
|
|
1967
|
-
var
|
|
1968
|
-
var
|
|
2271
|
+
var import_react17 = require("react");
|
|
2272
|
+
var import_react_better_core16 = require("react-better-core");
|
|
2273
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1969
2274
|
function ListItem({
|
|
1970
2275
|
icon,
|
|
1971
2276
|
iconIOS,
|
|
1972
2277
|
title,
|
|
1973
2278
|
description,
|
|
2279
|
+
descriptionSelectable,
|
|
1974
2280
|
rightElement,
|
|
1975
2281
|
backgroundColor,
|
|
1976
2282
|
insideScreenHolder,
|
|
1977
2283
|
onPress,
|
|
1978
|
-
|
|
2284
|
+
rightValue,
|
|
2285
|
+
rightValueSelectable,
|
|
1979
2286
|
switchIsEnabled,
|
|
1980
2287
|
switchOnChange
|
|
1981
2288
|
}) {
|
|
1982
|
-
const theme2 = (0,
|
|
2289
|
+
const theme2 = (0, import_react_better_core16.useTheme)();
|
|
1983
2290
|
const device = useDevice();
|
|
1984
2291
|
const sideSpace = theme2.styles.space;
|
|
1985
|
-
return /* @__PURE__ */ (0,
|
|
2292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1986
2293
|
View_default,
|
|
1987
2294
|
{
|
|
1988
2295
|
width: insideScreenHolder ? device.windowDimensions.width : "100%",
|
|
@@ -1992,41 +2299,28 @@ function ListItem({
|
|
|
1992
2299
|
paddingHorizontal: sideSpace,
|
|
1993
2300
|
pressStrength: pressStrength().p05,
|
|
1994
2301
|
onPress,
|
|
1995
|
-
children: /* @__PURE__ */ (0,
|
|
1996
|
-
icon && /* @__PURE__ */ (0,
|
|
1997
|
-
/* @__PURE__ */ (0,
|
|
1998
|
-
title && /* @__PURE__ */ (0,
|
|
1999
|
-
description && /* @__PURE__ */ (0,
|
|
2302
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.space, children: [
|
|
2303
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon_default, { name: icon, nameIOS: iconIOS, size: 22, color: theme2.colors.primary }),
|
|
2304
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(View_default, { flex: 1, flexDirection: "row", alignItems: "center", gap: theme2.styles.gap, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(View_default, { flex: 1, children: [
|
|
2305
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text_default, { fontSize: 20, fontWeight: 700, children: title }),
|
|
2306
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text_default.body, { selectable: descriptionSelectable, children: description })
|
|
2000
2307
|
] }) }),
|
|
2001
|
-
rightElement ? /* @__PURE__ */ (0,
|
|
2002
|
-
|
|
2003
|
-
/* @__PURE__ */ (0,
|
|
2308
|
+
rightElement ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: rightValue !== void 0 || rightElement === "arrow" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
2309
|
+
rightValue !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text_default, { fontSize: 14, fontWeight: 700, selectable: rightValueSelectable, children: rightValue }),
|
|
2310
|
+
rightElement === "arrow" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2004
2311
|
Icon_default,
|
|
2005
2312
|
{
|
|
2006
2313
|
name: "chevronRight",
|
|
2007
2314
|
nameIOS: "chevron.right",
|
|
2008
|
-
color:
|
|
2315
|
+
color: rightValue !== void 0 ? theme2.colors.textPrimary : theme2.colors.textSecondary
|
|
2009
2316
|
}
|
|
2010
2317
|
)
|
|
2011
|
-
] }) : rightElement === "switch" ? /* @__PURE__ */ (0,
|
|
2318
|
+
] }) : rightElement === "switch" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Switch_default, { isEnabled: switchIsEnabled, onChange: switchOnChange }) : void 0 }) : void 0
|
|
2012
2319
|
] })
|
|
2013
2320
|
}
|
|
2014
2321
|
);
|
|
2015
2322
|
}
|
|
2016
|
-
var ListItem_default = (0,
|
|
2017
|
-
|
|
2018
|
-
// src/plugins/asyncStorage.ts
|
|
2019
|
-
var defaultAsyncStoragePluginOptions = {};
|
|
2020
|
-
var asyncStoragePlugin = (options) => ({
|
|
2021
|
-
name: "asyncStorage",
|
|
2022
|
-
initialize: () => {
|
|
2023
|
-
console.log("asyncStorage plugin initialized");
|
|
2024
|
-
},
|
|
2025
|
-
getConfig: () => ({
|
|
2026
|
-
...defaultAsyncStoragePluginOptions,
|
|
2027
|
-
...options
|
|
2028
|
-
})
|
|
2029
|
-
});
|
|
2323
|
+
var ListItem_default = (0, import_react17.memo)(ListItem);
|
|
2030
2324
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2031
2325
|
0 && (module.exports = {
|
|
2032
2326
|
Animate,
|
|
@@ -2042,10 +2336,13 @@ var asyncStoragePlugin = (options) => ({
|
|
|
2042
2336
|
Switch,
|
|
2043
2337
|
Text,
|
|
2044
2338
|
View,
|
|
2339
|
+
alertControls,
|
|
2340
|
+
alertsPlugin,
|
|
2045
2341
|
asyncStoragePlugin,
|
|
2046
2342
|
colorThemeControls,
|
|
2047
2343
|
countries,
|
|
2048
2344
|
darkenColor,
|
|
2345
|
+
defaultAlertsPluginOptions,
|
|
2049
2346
|
defaultAsyncStoragePluginOptions,
|
|
2050
2347
|
desaturateColor,
|
|
2051
2348
|
eventPreventDefault,
|
|
@@ -2060,6 +2357,7 @@ var asyncStoragePlugin = (options) => ({
|
|
|
2060
2357
|
loaderControls,
|
|
2061
2358
|
pressStrength,
|
|
2062
2359
|
saturateColor,
|
|
2360
|
+
useAlertControls,
|
|
2063
2361
|
useBetterComponentsContext,
|
|
2064
2362
|
useBooleanState,
|
|
2065
2363
|
useDebounceState,
|