react-native-better-html 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +54 -7
- package/dist/index.d.ts +54 -7
- package/dist/index.js +875 -590
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +758 -474
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.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,361 @@ 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 alertControls2 = useAlertControls();
|
|
1345
|
+
const alertsPlugin2 = usePlugin("alerts");
|
|
1346
|
+
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
1347
|
+
const defaultAlertDurationNumber = getAlertDurationFromAuto(
|
|
1348
|
+
alert.duration ?? pluginConfig.defaultDuration ?? defaultAlertsPluginOptions.defaultDuration,
|
|
1349
|
+
alert
|
|
1350
|
+
);
|
|
1351
|
+
const defaultAlertDisplay = alert.display ?? pluginConfig.defaultDisplay?.[alert.type] ?? defaultAlertsPluginOptions.defaultDisplay[alert.type] ?? "default";
|
|
1352
|
+
const calledOnCloseRef = (0, import_react10.useRef)(false);
|
|
1353
|
+
const [isRemoved, setIsRemoved] = (0, import_react_better_core9.useBooleanState)();
|
|
1354
|
+
const onPressCloseAlert = (0, import_react10.useCallback)(() => {
|
|
1355
|
+
setIsRemoved.setTrue();
|
|
1356
|
+
setTimeout(() => {
|
|
1357
|
+
alertControls2.removeAlert(alert.id);
|
|
1358
|
+
if (!calledOnCloseRef.current) {
|
|
1359
|
+
alert.onClose?.(alert);
|
|
1360
|
+
calledOnCloseRef.current = true;
|
|
1361
|
+
}
|
|
1362
|
+
}, defaultTransitionDuration);
|
|
1363
|
+
}, [alert]);
|
|
1364
|
+
const alertData = (0, import_react10.useMemo)(
|
|
1365
|
+
() => ({
|
|
1366
|
+
info: {
|
|
1367
|
+
icon: "infoI",
|
|
1368
|
+
iconIOS: "info",
|
|
1369
|
+
backgroundColor: theme2.colors.info,
|
|
1370
|
+
title: "Info"
|
|
1371
|
+
},
|
|
1372
|
+
success: {
|
|
1373
|
+
icon: "check",
|
|
1374
|
+
backgroundColor: theme2.colors.success,
|
|
1375
|
+
title: "Success"
|
|
1376
|
+
},
|
|
1377
|
+
warning: {
|
|
1378
|
+
icon: "warningTriangle",
|
|
1379
|
+
backgroundColor: theme2.colors.warn,
|
|
1380
|
+
title: "Warning"
|
|
1381
|
+
},
|
|
1382
|
+
error: {
|
|
1383
|
+
icon: "XMark",
|
|
1384
|
+
backgroundColor: theme2.colors.error,
|
|
1385
|
+
title: "Error"
|
|
1386
|
+
}
|
|
1387
|
+
}),
|
|
1388
|
+
[theme2]
|
|
1389
|
+
);
|
|
1390
|
+
(0, import_react10.useEffect)(() => {
|
|
1391
|
+
const timeout = setTimeout(onPressCloseAlert, defaultAlertDurationNumber);
|
|
1392
|
+
return () => {
|
|
1393
|
+
clearTimeout(timeout);
|
|
1394
|
+
};
|
|
1395
|
+
}, [onPressCloseAlert, defaultAlertDurationNumber]);
|
|
1396
|
+
return defaultAlertDisplay === "prominent" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1397
|
+
Animate_default.View,
|
|
1398
|
+
{
|
|
1399
|
+
initialOpacity: 0,
|
|
1400
|
+
animateOpacity: isRemoved ? 0 : 1,
|
|
1401
|
+
initialX: 40,
|
|
1402
|
+
animateX: isRemoved ? 40 : 0,
|
|
1403
|
+
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: [
|
|
1404
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1405
|
+
View_default,
|
|
1406
|
+
{
|
|
1407
|
+
alignItems: "center",
|
|
1408
|
+
justifyContent: "center",
|
|
1409
|
+
backgroundColor: alertData[alert.type].backgroundColor,
|
|
1410
|
+
borderRadius: 999,
|
|
1411
|
+
padding: (theme2.styles.space + theme2.styles.gap) / 2,
|
|
1412
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1413
|
+
Icon_default,
|
|
1414
|
+
{
|
|
1415
|
+
name: alertData[alert.type].icon,
|
|
1416
|
+
color: alertData[alert.type].iconColor ?? theme2.colors.base
|
|
1417
|
+
}
|
|
1418
|
+
)
|
|
1419
|
+
}
|
|
1420
|
+
),
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(View_default, { children: [
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text_default, { fontSize: 18, fontWeight: 700, children: alert.title ?? alertData[alert.type].title }),
|
|
1423
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text_default.body, { children: alert.message })
|
|
1424
|
+
] }),
|
|
1425
|
+
pluginConfig.withCloseButton && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button_default.icon, { icon: "XMark", onPress: onPressCloseAlert })
|
|
1426
|
+
] }) })
|
|
1427
|
+
}
|
|
1428
|
+
);
|
|
1429
|
+
}
|
|
1430
|
+
var Alert_default = (0, import_react10.memo)(Alert);
|
|
1431
|
+
|
|
1432
|
+
// src/components/alerts/AlertsHolder.tsx
|
|
1433
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1434
|
+
function AlertsHolder() {
|
|
1435
|
+
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
1436
|
+
const device = useDevice();
|
|
1437
|
+
const alertsPlugin2 = usePlugin("alerts");
|
|
1438
|
+
const { alerts } = useBetterComponentsContextInternal();
|
|
1439
|
+
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
1440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1441
|
+
View_default,
|
|
1442
|
+
{
|
|
1443
|
+
position: "absolute",
|
|
1444
|
+
width: "100%",
|
|
1445
|
+
top: device.safeArea.afterCalculations.top + theme2.styles.gap / 2,
|
|
1446
|
+
left: 0,
|
|
1447
|
+
gap: theme2.styles.gap,
|
|
1448
|
+
alignItems: pluginConfig.align === "left" ? "flex-start" : pluginConfig.align === "center" ? "center" : pluginConfig.align === "right" ? "flex-end" : void 0,
|
|
1449
|
+
paddingHorizontal: theme2.styles.space,
|
|
1450
|
+
pointerEvents: "box-none",
|
|
1451
|
+
zIndex: 1e3,
|
|
1452
|
+
children: alerts.map((alert) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Alert_default, { alert }, alert.id))
|
|
1453
|
+
}
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
var AlertsHolder_default = (0, import_react11.memo)(AlertsHolder);
|
|
1457
|
+
|
|
1458
|
+
// src/components/BetterComponentsProvider.tsx
|
|
1459
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1460
|
+
var betterComponentsContext = (0, import_react12.createContext)(void 0);
|
|
1461
|
+
var externalBetterCoreContextValue;
|
|
1462
|
+
var externalBetterComponentsContextValue;
|
|
1463
|
+
var useBetterComponentsContext = () => {
|
|
1464
|
+
const coreContext = (0, import_react_better_core11.useBetterCoreContext)();
|
|
1465
|
+
const context = (0, import_react12.useContext)(betterComponentsContext);
|
|
1466
|
+
if (context === void 0)
|
|
1467
|
+
throw new Error(
|
|
1468
|
+
"`useBetterComponentsContext()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1469
|
+
);
|
|
1470
|
+
const { plugins, componentsState, ...rest } = context;
|
|
1471
|
+
return {
|
|
1472
|
+
...coreContext,
|
|
1473
|
+
...rest
|
|
1474
|
+
};
|
|
1475
|
+
};
|
|
1476
|
+
var useBetterComponentsContextInternal = () => {
|
|
1477
|
+
const context = (0, import_react12.useContext)(betterComponentsContext);
|
|
1478
|
+
if (context === void 0)
|
|
1479
|
+
throw new Error(
|
|
1480
|
+
"`useBetterComponentsContextInternal()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1481
|
+
);
|
|
1482
|
+
return context;
|
|
1483
|
+
};
|
|
1484
|
+
var useAlertControls = () => {
|
|
1485
|
+
const context = (0, import_react12.useContext)(betterComponentsContext);
|
|
1486
|
+
if (context === void 0)
|
|
1487
|
+
throw new Error(
|
|
1488
|
+
"`useAlertControls()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1489
|
+
);
|
|
1490
|
+
const createAlert = (0, import_react12.useCallback)((alert) => {
|
|
1491
|
+
const readyAlert = {
|
|
1492
|
+
id: (0, import_react_better_core11.generateRandomString)(36),
|
|
1493
|
+
...alert
|
|
1494
|
+
};
|
|
1495
|
+
context.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
1496
|
+
return readyAlert;
|
|
1497
|
+
}, []);
|
|
1498
|
+
const removeAlert = (0, import_react12.useCallback)((alertId) => {
|
|
1499
|
+
context.setAlerts((oldValue) => oldValue.filter((alert) => alert.id !== alertId));
|
|
1500
|
+
}, []);
|
|
1501
|
+
return {
|
|
1502
|
+
createAlert,
|
|
1503
|
+
removeAlert
|
|
1504
|
+
};
|
|
1505
|
+
};
|
|
1506
|
+
var usePlugin = (pluginName) => {
|
|
1507
|
+
const context = (0, import_react12.useContext)(betterComponentsContext);
|
|
1508
|
+
if (context === void 0) {
|
|
1509
|
+
throw new Error(
|
|
1510
|
+
"`usePlugin()` must be used within a `<BetterComponentsProvider>`. Make sure to add one at the root of your component tree."
|
|
1511
|
+
);
|
|
1512
|
+
}
|
|
1513
|
+
return (0, import_react12.useMemo)(
|
|
1514
|
+
() => context.plugins.find((plugin) => plugin.name === pluginName),
|
|
1515
|
+
[context.plugins, pluginName]
|
|
1516
|
+
);
|
|
1517
|
+
};
|
|
1518
|
+
function BetterComponentsProviderInternalContent({ children }) {
|
|
1519
|
+
const alertsPlugin2 = usePlugin("alerts");
|
|
1520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1521
|
+
children,
|
|
1522
|
+
alertsPlugin2 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AlertsHolder_default, {})
|
|
1523
|
+
] });
|
|
1524
|
+
}
|
|
1525
|
+
function BetterComponentsProviderInternal({
|
|
1526
|
+
config,
|
|
1527
|
+
plugins,
|
|
1528
|
+
children
|
|
1529
|
+
}) {
|
|
1530
|
+
const betterCoreContext = (0, import_react_better_core11.useBetterCoreContext)();
|
|
1531
|
+
const [alerts, setAlerts] = (0, import_react12.useState)([]);
|
|
1532
|
+
const readyConfig = (0, import_react12.useMemo)(
|
|
1533
|
+
() => ({
|
|
1534
|
+
app: {
|
|
1535
|
+
...appConfig,
|
|
1536
|
+
...config?.app
|
|
1537
|
+
},
|
|
1538
|
+
alerts,
|
|
1539
|
+
setAlerts,
|
|
1540
|
+
plugins: plugins ?? [],
|
|
1541
|
+
componentsState: {}
|
|
1542
|
+
}),
|
|
1543
|
+
[config, alerts, plugins]
|
|
1544
|
+
);
|
|
1545
|
+
(0, import_react12.useEffect)(() => {
|
|
1546
|
+
if (!plugins) return;
|
|
1547
|
+
plugins.forEach((plugin) => {
|
|
1548
|
+
plugin.initialize?.();
|
|
1549
|
+
});
|
|
1550
|
+
}, []);
|
|
1551
|
+
externalBetterCoreContextValue = betterCoreContext;
|
|
1552
|
+
externalBetterComponentsContextValue = readyConfig;
|
|
1553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(betterComponentsContext.Provider, { value: readyConfig, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BetterComponentsProviderInternalContent, { children }) });
|
|
1554
|
+
}
|
|
1555
|
+
function BetterComponentsProvider({ config, ...props }) {
|
|
1556
|
+
const coreConfig = (0, import_react12.useMemo)(
|
|
1557
|
+
() => ({
|
|
1558
|
+
theme: {
|
|
1559
|
+
...theme,
|
|
1560
|
+
...config?.theme
|
|
1561
|
+
},
|
|
1562
|
+
// colorTheme: config?.colorTheme ?? (localStorage.getItem("theme") === "dark" ? "dark" : "light"),
|
|
1563
|
+
colorTheme: config?.colorTheme ?? "light",
|
|
1564
|
+
icons: {
|
|
1565
|
+
...icons,
|
|
1566
|
+
...config?.icons
|
|
1567
|
+
},
|
|
1568
|
+
assets: {
|
|
1569
|
+
...assets,
|
|
1570
|
+
...config?.assets
|
|
1571
|
+
},
|
|
1572
|
+
loaders: config?.loaders
|
|
1573
|
+
}),
|
|
1574
|
+
[config]
|
|
1178
1575
|
);
|
|
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
|
-
}
|
|
1576
|
+
const componentsConfig = (0, import_react12.useMemo)(
|
|
1577
|
+
() => ({
|
|
1578
|
+
app: config?.app
|
|
1579
|
+
}),
|
|
1580
|
+
[config]
|
|
1199
1581
|
);
|
|
1582
|
+
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 }) });
|
|
1583
|
+
}
|
|
1584
|
+
var BetterComponentsProvider_default = (0, import_react12.memo)(BetterComponentsProvider);
|
|
1585
|
+
|
|
1586
|
+
// src/utils/functions.ts
|
|
1587
|
+
var getFormErrorObject = (formValues) => {
|
|
1588
|
+
return {};
|
|
1200
1589
|
};
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1590
|
+
|
|
1591
|
+
// src/utils/asyncStorage.ts
|
|
1592
|
+
var import_async_storage = __toESM(require("@react-native-async-storage/async-storage"));
|
|
1593
|
+
function generateAsyncStorage() {
|
|
1594
|
+
return {
|
|
1595
|
+
setItem: async (name, value) => {
|
|
1596
|
+
if (value) await import_async_storage.default.setItem(name.toString(), JSON.stringify(value));
|
|
1597
|
+
else await import_async_storage.default.removeItem(name.toString());
|
|
1598
|
+
},
|
|
1599
|
+
getItem: async (name) => {
|
|
1600
|
+
const item = await import_async_storage.default.getItem(name.toString());
|
|
1601
|
+
if (item === null) return void 0;
|
|
1602
|
+
try {
|
|
1603
|
+
return JSON.parse(item);
|
|
1604
|
+
} catch (error) {
|
|
1605
|
+
return void 0;
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
removeItem: async (name) => {
|
|
1609
|
+
await import_async_storage.default.removeItem(name.toString());
|
|
1610
|
+
},
|
|
1611
|
+
removeAllItems: () => {
|
|
1612
|
+
import_async_storage.default.clear();
|
|
1613
|
+
}
|
|
1614
|
+
};
|
|
1615
|
+
}
|
|
1206
1616
|
|
|
1207
1617
|
// src/components/ScreenHolder.tsx
|
|
1208
|
-
var
|
|
1209
|
-
var
|
|
1210
|
-
var
|
|
1211
|
-
var
|
|
1618
|
+
var import_react13 = require("react");
|
|
1619
|
+
var import_react_native8 = require("react-native");
|
|
1620
|
+
var import_react_better_core12 = require("react-better-core");
|
|
1621
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1212
1622
|
var ScreenHolderComponent = ({
|
|
1213
1623
|
noScroll,
|
|
1214
1624
|
noSideSpace,
|
|
@@ -1225,17 +1635,17 @@ var ScreenHolderComponent = ({
|
|
|
1225
1635
|
withNoHeader,
|
|
1226
1636
|
children
|
|
1227
1637
|
}) => {
|
|
1228
|
-
const theme2 = (0,
|
|
1638
|
+
const theme2 = (0, import_react_better_core12.useTheme)();
|
|
1229
1639
|
const device = useDevice();
|
|
1230
1640
|
const keyboard = useKeyboard();
|
|
1231
|
-
const [isRefreshing, setIsRefreshing] = (0,
|
|
1232
|
-
const keyboardAvoidingViewStyle = (0,
|
|
1641
|
+
const [isRefreshing, setIsRefreshing] = (0, import_react_better_core12.useBooleanState)();
|
|
1642
|
+
const keyboardAvoidingViewStyle = (0, import_react13.useMemo)(
|
|
1233
1643
|
() => ({
|
|
1234
1644
|
flex: 1
|
|
1235
1645
|
}),
|
|
1236
1646
|
[]
|
|
1237
1647
|
);
|
|
1238
|
-
const onRefreshElement = (0,
|
|
1648
|
+
const onRefreshElement = (0, import_react13.useCallback)(() => {
|
|
1239
1649
|
setIsRefreshing.setTrue();
|
|
1240
1650
|
onRefresh?.();
|
|
1241
1651
|
setTimeout(() => {
|
|
@@ -1243,36 +1653,36 @@ var ScreenHolderComponent = ({
|
|
|
1243
1653
|
onRefreshEnd?.();
|
|
1244
1654
|
}, refreshTimeout * 1e3);
|
|
1245
1655
|
}, [onRefresh, onRefreshEnd, refreshTimeout]);
|
|
1246
|
-
const content = /* @__PURE__ */ (0,
|
|
1656
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1247
1657
|
View_default,
|
|
1248
1658
|
{
|
|
1249
1659
|
flex: 1,
|
|
1250
1660
|
paddingHorizontal: !noSideSpace ? theme2.styles.space : void 0,
|
|
1251
1661
|
paddingTop: theme2.styles.gap + (insideTopSafeArea ? device.safeArea.afterCalculations.top : 0),
|
|
1252
|
-
paddingBottom:
|
|
1662
|
+
paddingBottom: import_react_native8.Platform.OS === "ios" && keyboard.isOpened ? device.safeArea.afterCalculations.top : bottomSpace + (insideBottomSafeArea ? device.safeArea.afterCalculations.bottom : 0),
|
|
1253
1663
|
children
|
|
1254
1664
|
}
|
|
1255
1665
|
);
|
|
1256
1666
|
const withRefresh = onRefresh || onRefreshEnd;
|
|
1257
|
-
return /* @__PURE__ */ (0,
|
|
1258
|
-
|
|
1667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(View_default, { flex: 1, backgroundColor: backgroundColor ?? theme2.colors.backgroundBase, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1668
|
+
import_react_native8.KeyboardAvoidingView,
|
|
1259
1669
|
{
|
|
1260
1670
|
style: keyboardAvoidingViewStyle,
|
|
1261
|
-
keyboardVerticalOffset: keyboardVerticalOffset ?? (withNoHeader ?
|
|
1262
|
-
behavior:
|
|
1671
|
+
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),
|
|
1672
|
+
behavior: import_react_native8.Platform.OS === "ios" ? "padding" : "height",
|
|
1263
1673
|
children: [
|
|
1264
|
-
/* @__PURE__ */ (0,
|
|
1265
|
-
|
|
1674
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(View_default, { flex: 1, children: noScroll ? content : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1675
|
+
import_react_native8.ScrollView,
|
|
1266
1676
|
{
|
|
1267
|
-
refreshControl: withRefresh ? /* @__PURE__ */ (0,
|
|
1677
|
+
refreshControl: withRefresh ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native8.RefreshControl, { refreshing: isRefreshing, onRefresh: onRefreshElement }) : void 0,
|
|
1268
1678
|
children: content
|
|
1269
1679
|
}
|
|
1270
1680
|
) }),
|
|
1271
|
-
keepFooterOnKeyboardOpened || (
|
|
1681
|
+
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
1682
|
View_default,
|
|
1273
1683
|
{
|
|
1274
1684
|
width: "100%",
|
|
1275
|
-
height: device.safeArea.afterCalculations.bottom + (
|
|
1685
|
+
height: device.safeArea.afterCalculations.bottom + (import_react_native8.Platform.OS === "android" ? theme2.styles.gap : 0)
|
|
1276
1686
|
}
|
|
1277
1687
|
)
|
|
1278
1688
|
]
|
|
@@ -1286,149 +1696,31 @@ ScreenHolderComponent.footer = function Footer({
|
|
|
1286
1696
|
withNoHeader,
|
|
1287
1697
|
children
|
|
1288
1698
|
}) {
|
|
1289
|
-
const theme2 = (0,
|
|
1699
|
+
const theme2 = (0, import_react_better_core12.useTheme)();
|
|
1290
1700
|
const device = useDevice();
|
|
1291
1701
|
const keyboard = useKeyboard();
|
|
1292
|
-
return /* @__PURE__ */ (0,
|
|
1702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1293
1703
|
View_default,
|
|
1294
1704
|
{
|
|
1295
1705
|
backgroundColor: backgroundColor ?? theme2.colors.backgroundBase,
|
|
1296
1706
|
paddingHorizontal: !noSideSpace ? theme2.styles.space : void 0,
|
|
1297
1707
|
paddingTop: theme2.styles.gap,
|
|
1298
|
-
paddingBottom: (
|
|
1708
|
+
paddingBottom: (import_react_native8.Platform.OS === "ios" ? keyboard.willOpen : keyboard.isOpened) && withNoHeader ? theme2.styles.gap : insideBottomSafeArea ? device.safeArea.afterCalculations.bottom : void 0,
|
|
1299
1709
|
children
|
|
1300
1710
|
}
|
|
1301
1711
|
);
|
|
1302
1712
|
};
|
|
1303
|
-
var ScreenHolder = (0,
|
|
1713
|
+
var ScreenHolder = (0, import_react13.memo)(ScreenHolderComponent);
|
|
1304
1714
|
ScreenHolder.footer = ScreenHolderComponent.footer;
|
|
1305
1715
|
var ScreenHolder_default = ScreenHolder;
|
|
1306
1716
|
|
|
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
1717
|
// src/components/InputField.tsx
|
|
1426
|
-
var
|
|
1718
|
+
var import_react14 = require("react");
|
|
1427
1719
|
var import_react_native9 = require("react-native");
|
|
1428
1720
|
var import_datetimepicker = __toESM(require("@react-native-community/datetimepicker"));
|
|
1429
|
-
var
|
|
1430
|
-
var
|
|
1431
|
-
var InputFieldComponent = (0,
|
|
1721
|
+
var import_react_better_core13 = require("react-better-core");
|
|
1722
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1723
|
+
var InputFieldComponent = (0, import_react14.forwardRef)(
|
|
1432
1724
|
({
|
|
1433
1725
|
flex,
|
|
1434
1726
|
placeholder,
|
|
@@ -1479,12 +1771,12 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1479
1771
|
onPressEnter,
|
|
1480
1772
|
...props
|
|
1481
1773
|
}, 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,
|
|
1774
|
+
const theme2 = (0, import_react_better_core13.useTheme)();
|
|
1775
|
+
const { colorTheme } = (0, import_react_better_core13.useBetterCoreContext)();
|
|
1776
|
+
const textInputRef = (0, import_react14.useRef)(null);
|
|
1777
|
+
const [internalValue, setInternalValue] = (0, import_react14.useState)(value?.toString() || defaultValue || "");
|
|
1778
|
+
const [internalDateValue, setInternalDateValue] = (0, import_react14.useState)();
|
|
1779
|
+
const [isFocused, setIsFocused] = (0, import_react_better_core13.useBooleanState)();
|
|
1488
1780
|
const isIOSDateTime = import_react_native9.Platform.OS === "ios" && (type === "date" || type === "time");
|
|
1489
1781
|
const iconSize = 16;
|
|
1490
1782
|
const iconPadding = onPressRightIcon ? theme2.styles.gap : 0;
|
|
@@ -1493,14 +1785,14 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1493
1785
|
const readyPaddingHorizontal = paddingHorizontal ?? theme2.styles.space;
|
|
1494
1786
|
const readyPaddingVertical = paddingVertical ? parseFloat(paddingVertical.toString()) : (theme2.styles.space + theme2.styles.gap) / 2;
|
|
1495
1787
|
const readyHeight = height ?? isIOSDateTime ? void 0 : borderWidth + readyPaddingVertical + lineHeight + readyPaddingVertical + borderWidth + (import_react_native9.Platform.OS === "android" ? 2 : 0);
|
|
1496
|
-
const onChangeRNDateTimePicker = (0,
|
|
1788
|
+
const onChangeRNDateTimePicker = (0, import_react14.useCallback)(
|
|
1497
1789
|
(event, data) => {
|
|
1498
1790
|
setInternalDateValue(data);
|
|
1499
1791
|
onChange?.(data?.toISOString() ?? "");
|
|
1500
1792
|
},
|
|
1501
1793
|
[onChange]
|
|
1502
1794
|
);
|
|
1503
|
-
const onPressInputField = (0,
|
|
1795
|
+
const onPressInputField = (0, import_react14.useCallback)(
|
|
1504
1796
|
(event) => {
|
|
1505
1797
|
onPress?.(event);
|
|
1506
1798
|
if (type === "date" || type === "time") {
|
|
@@ -1528,22 +1820,22 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1528
1820
|
},
|
|
1529
1821
|
[onPress, type, internalDateValue, onChangeRNDateTimePicker]
|
|
1530
1822
|
);
|
|
1531
|
-
const onFocusElement = (0,
|
|
1823
|
+
const onFocusElement = (0, import_react14.useCallback)((event) => {
|
|
1532
1824
|
setIsFocused.setTrue();
|
|
1533
1825
|
onFocus?.(event);
|
|
1534
1826
|
}, []);
|
|
1535
|
-
const onBlurElement = (0,
|
|
1827
|
+
const onBlurElement = (0, import_react14.useCallback)((event) => {
|
|
1536
1828
|
setIsFocused.setFalse();
|
|
1537
1829
|
onBlur?.(event);
|
|
1538
1830
|
}, []);
|
|
1539
|
-
const onChangeText = (0,
|
|
1831
|
+
const onChangeText = (0, import_react14.useCallback)(
|
|
1540
1832
|
(text) => {
|
|
1541
1833
|
setInternalValue(text);
|
|
1542
1834
|
onChange?.(text);
|
|
1543
1835
|
},
|
|
1544
1836
|
[onChange]
|
|
1545
1837
|
);
|
|
1546
|
-
const textInputStyle = (0,
|
|
1838
|
+
const textInputStyle = (0, import_react14.useMemo)(
|
|
1547
1839
|
() => ({
|
|
1548
1840
|
flex: 1,
|
|
1549
1841
|
fontSize,
|
|
@@ -1568,14 +1860,14 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1568
1860
|
rightIcon
|
|
1569
1861
|
]
|
|
1570
1862
|
);
|
|
1571
|
-
const rnDateTimePickerStyle = (0,
|
|
1863
|
+
const rnDateTimePickerStyle = (0, import_react14.useMemo)(
|
|
1572
1864
|
() => ({
|
|
1573
1865
|
flex: iOSDateTimeFullSize ? 1 : void 0,
|
|
1574
1866
|
marginLeft: -8 + (iOSDateTimeFullSize ? 0 : theme2.styles.space)
|
|
1575
1867
|
}),
|
|
1576
1868
|
[iOSDateTimeFullSize]
|
|
1577
1869
|
);
|
|
1578
|
-
(0,
|
|
1870
|
+
(0, import_react14.useEffect)(() => {
|
|
1579
1871
|
if (value === void 0) return;
|
|
1580
1872
|
setInternalValue(value.toString());
|
|
1581
1873
|
try {
|
|
@@ -1583,7 +1875,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1583
1875
|
} catch (error) {
|
|
1584
1876
|
}
|
|
1585
1877
|
}, [value]);
|
|
1586
|
-
(0,
|
|
1878
|
+
(0, import_react14.useEffect)(() => {
|
|
1587
1879
|
if (type !== "date" && type !== "time") return;
|
|
1588
1880
|
const date = internalDateValue?.toISOString().split("T")[0] ?? "";
|
|
1589
1881
|
const hours = internalDateValue ? internalDateValue.getHours().toString() : "00";
|
|
@@ -1592,7 +1884,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1592
1884
|
type === "date" ? date : internalDateValue ? `${hours.length === 1 ? `0${hours}` : hours}:${minutes.length === 1 ? `0${minutes}` : minutes}` : ""
|
|
1593
1885
|
);
|
|
1594
1886
|
}, [internalDateValue]);
|
|
1595
|
-
(0,
|
|
1887
|
+
(0, import_react14.useImperativeHandle)(
|
|
1596
1888
|
ref,
|
|
1597
1889
|
() => {
|
|
1598
1890
|
return textInputRef.current;
|
|
@@ -1600,12 +1892,12 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1600
1892
|
[]
|
|
1601
1893
|
);
|
|
1602
1894
|
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,
|
|
1895
|
+
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);
|
|
1896
|
+
const labelComponent = label && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(View_default, { isRow: true, alignItems: "center", gap: 2, children: [
|
|
1897
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { fontSize: 14, color: isError ? theme2.colors.error : theme2.colors.textSecondary, children: label }),
|
|
1898
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { color: theme2.colors.error, children: "*" })
|
|
1607
1899
|
] });
|
|
1608
|
-
return /* @__PURE__ */ (0,
|
|
1900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1609
1901
|
Animate_default.View,
|
|
1610
1902
|
{
|
|
1611
1903
|
flex,
|
|
@@ -1615,8 +1907,8 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1615
1907
|
...props,
|
|
1616
1908
|
children: [
|
|
1617
1909
|
isIOSDateTime && !iOSDateTimeFullSize ? void 0 : labelComponent,
|
|
1618
|
-
/* @__PURE__ */ (0,
|
|
1619
|
-
prefix && /* @__PURE__ */ (0,
|
|
1910
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(View_default, { isRow: true, position: "relative", alignItems: "center", height: readyHeight, children: [
|
|
1911
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1620
1912
|
View_default,
|
|
1621
1913
|
{
|
|
1622
1914
|
isRow: true,
|
|
@@ -1631,7 +1923,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1631
1923
|
borderColor: theme2.colors.border,
|
|
1632
1924
|
paddingHorizontal: readyPaddingHorizontal,
|
|
1633
1925
|
onPress: onPressPrefix,
|
|
1634
|
-
children: typeof prefix === "string" ? /* @__PURE__ */ (0,
|
|
1926
|
+
children: typeof prefix === "string" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1635
1927
|
Text_default,
|
|
1636
1928
|
{
|
|
1637
1929
|
fontWeight: 700,
|
|
@@ -1642,9 +1934,9 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1642
1934
|
) : prefix
|
|
1643
1935
|
}
|
|
1644
1936
|
),
|
|
1645
|
-
isIOSDateTime ? /* @__PURE__ */ (0,
|
|
1937
|
+
isIOSDateTime ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1646
1938
|
!iOSDateTimeFullSize ? labelComponent : void 0,
|
|
1647
|
-
/* @__PURE__ */ (0,
|
|
1939
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1648
1940
|
import_datetimepicker.default,
|
|
1649
1941
|
{
|
|
1650
1942
|
value: internalDateValue ?? /* @__PURE__ */ new Date(),
|
|
@@ -1656,7 +1948,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1656
1948
|
onChange: onChangeRNDateTimePicker
|
|
1657
1949
|
}
|
|
1658
1950
|
)
|
|
1659
|
-
] }) : /* @__PURE__ */ (0,
|
|
1951
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1660
1952
|
View_default,
|
|
1661
1953
|
{
|
|
1662
1954
|
flex: 1,
|
|
@@ -1667,7 +1959,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1667
1959
|
borderBottomRightRadius: suffix ? 0 : theme2.styles.borderRadius,
|
|
1668
1960
|
pressStrength: 1,
|
|
1669
1961
|
onPress: import_react_native9.Platform.OS === "android" ? editable === false || withPressInputField ? onPressInputField : void 0 : void 0,
|
|
1670
|
-
children: /* @__PURE__ */ (0,
|
|
1962
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1671
1963
|
Animate_default.View,
|
|
1672
1964
|
{
|
|
1673
1965
|
position: "relative",
|
|
@@ -1683,7 +1975,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1683
1975
|
animateBorderColor: isFocused ? theme2.colors.primary : isError ? theme2.colors.error : theme2.colors.border,
|
|
1684
1976
|
overflow: "hidden",
|
|
1685
1977
|
children: [
|
|
1686
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
1978
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1687
1979
|
Icon_default,
|
|
1688
1980
|
{
|
|
1689
1981
|
position: "absolute",
|
|
@@ -1696,7 +1988,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1696
1988
|
onPress: onPressLeftIcon
|
|
1697
1989
|
}
|
|
1698
1990
|
),
|
|
1699
|
-
/* @__PURE__ */ (0,
|
|
1991
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1700
1992
|
import_react_native9.TextInput,
|
|
1701
1993
|
{
|
|
1702
1994
|
style: textInputStyle,
|
|
@@ -1729,7 +2021,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1729
2021
|
ref: textInputRef
|
|
1730
2022
|
}
|
|
1731
2023
|
),
|
|
1732
|
-
rightIcon && /* @__PURE__ */ (0,
|
|
2024
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1733
2025
|
Icon_default,
|
|
1734
2026
|
{
|
|
1735
2027
|
position: "absolute",
|
|
@@ -1747,7 +2039,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1747
2039
|
)
|
|
1748
2040
|
}
|
|
1749
2041
|
),
|
|
1750
|
-
suffix && /* @__PURE__ */ (0,
|
|
2042
|
+
suffix && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1751
2043
|
View_default,
|
|
1752
2044
|
{
|
|
1753
2045
|
isRow: true,
|
|
@@ -1761,7 +2053,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1761
2053
|
borderColor: theme2.colors.border,
|
|
1762
2054
|
paddingHorizontal: readyPaddingHorizontal,
|
|
1763
2055
|
onPress: onPressSuffix,
|
|
1764
|
-
children: typeof suffix === "string" ? /* @__PURE__ */ (0,
|
|
2056
|
+
children: typeof suffix === "string" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1765
2057
|
Text_default,
|
|
1766
2058
|
{
|
|
1767
2059
|
fontWeight: 700,
|
|
@@ -1773,7 +2065,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1773
2065
|
}
|
|
1774
2066
|
)
|
|
1775
2067
|
] }),
|
|
1776
|
-
infoMessage && /* @__PURE__ */ (0,
|
|
2068
|
+
infoMessage && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1777
2069
|
Animate_default.Text,
|
|
1778
2070
|
{
|
|
1779
2071
|
fontSize: 14,
|
|
@@ -1785,7 +2077,7 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1785
2077
|
children: infoMessage
|
|
1786
2078
|
}
|
|
1787
2079
|
),
|
|
1788
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
2080
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1789
2081
|
Animate_default.Text,
|
|
1790
2082
|
{
|
|
1791
2083
|
fontSize: 14,
|
|
@@ -1802,8 +2094,8 @@ var InputFieldComponent = (0, import_react12.forwardRef)(
|
|
|
1802
2094
|
);
|
|
1803
2095
|
}
|
|
1804
2096
|
);
|
|
1805
|
-
InputFieldComponent.email = (0,
|
|
1806
|
-
return /* @__PURE__ */ (0,
|
|
2097
|
+
InputFieldComponent.email = (0, import_react14.forwardRef)(function Email(props, ref) {
|
|
2098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1807
2099
|
InputFieldComponent,
|
|
1808
2100
|
{
|
|
1809
2101
|
placeholder: "your@email.here",
|
|
@@ -1816,21 +2108,21 @@ InputFieldComponent.email = (0, import_react12.forwardRef)(function Email(props,
|
|
|
1816
2108
|
}
|
|
1817
2109
|
);
|
|
1818
2110
|
});
|
|
1819
|
-
InputFieldComponent.password = (0,
|
|
1820
|
-
const inputFieldRef = (0,
|
|
1821
|
-
const [showPassword, setShowPassword] = (0,
|
|
1822
|
-
const onPressEye = (0,
|
|
2111
|
+
InputFieldComponent.password = (0, import_react14.forwardRef)(function Password(props, ref) {
|
|
2112
|
+
const inputFieldRef = (0, import_react14.useRef)(null);
|
|
2113
|
+
const [showPassword, setShowPassword] = (0, import_react_better_core13.useBooleanState)();
|
|
2114
|
+
const onPressEye = (0, import_react14.useCallback)(() => {
|
|
1823
2115
|
setShowPassword.toggle();
|
|
1824
2116
|
inputFieldRef.current?.focus();
|
|
1825
2117
|
}, []);
|
|
1826
|
-
(0,
|
|
2118
|
+
(0, import_react14.useImperativeHandle)(
|
|
1827
2119
|
ref,
|
|
1828
2120
|
() => {
|
|
1829
2121
|
return inputFieldRef.current;
|
|
1830
2122
|
},
|
|
1831
2123
|
[]
|
|
1832
2124
|
);
|
|
1833
|
-
return /* @__PURE__ */ (0,
|
|
2125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1834
2126
|
InputFieldComponent,
|
|
1835
2127
|
{
|
|
1836
2128
|
secureTextEntry: !showPassword,
|
|
@@ -1845,12 +2137,12 @@ InputFieldComponent.password = (0, import_react12.forwardRef)(function Password(
|
|
|
1845
2137
|
}
|
|
1846
2138
|
);
|
|
1847
2139
|
});
|
|
1848
|
-
InputFieldComponent.search = (0,
|
|
1849
|
-
return /* @__PURE__ */ (0,
|
|
2140
|
+
InputFieldComponent.search = (0, import_react14.forwardRef)(function Search(props, ref) {
|
|
2141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(InputFieldComponent, { placeholder: "Search...", leftIcon: "magnifyingGlass", ...props, ref });
|
|
1850
2142
|
});
|
|
1851
|
-
InputFieldComponent.code = (0,
|
|
1852
|
-
const theme2 = (0,
|
|
1853
|
-
return /* @__PURE__ */ (0,
|
|
2143
|
+
InputFieldComponent.code = (0, import_react14.forwardRef)(function Password2({ isSmall, ...props }, ref) {
|
|
2144
|
+
const theme2 = (0, import_react_better_core13.useTheme)();
|
|
2145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1854
2146
|
InputFieldComponent,
|
|
1855
2147
|
{
|
|
1856
2148
|
flex: 1,
|
|
@@ -1865,7 +2157,7 @@ InputFieldComponent.code = (0, import_react12.forwardRef)(function Password2({ i
|
|
|
1865
2157
|
}
|
|
1866
2158
|
);
|
|
1867
2159
|
});
|
|
1868
|
-
var InputField = (0,
|
|
2160
|
+
var InputField = (0, import_react14.memo)(InputFieldComponent);
|
|
1869
2161
|
InputField.email = InputFieldComponent.email;
|
|
1870
2162
|
InputField.password = InputFieldComponent.password;
|
|
1871
2163
|
InputField.search = InputFieldComponent.search;
|
|
@@ -1873,32 +2165,32 @@ InputField.code = InputFieldComponent.code;
|
|
|
1873
2165
|
var InputField_default = InputField;
|
|
1874
2166
|
|
|
1875
2167
|
// src/components/Switch.tsx
|
|
1876
|
-
var
|
|
2168
|
+
var import_react15 = require("react");
|
|
1877
2169
|
var import_react_native10 = require("react-native");
|
|
1878
|
-
var
|
|
1879
|
-
var
|
|
2170
|
+
var import_react_better_core14 = require("react-better-core");
|
|
2171
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1880
2172
|
function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
1881
|
-
const theme2 = (0,
|
|
1882
|
-
const [enabled, setEnabled] = (0,
|
|
1883
|
-
const onPressElement = (0,
|
|
2173
|
+
const theme2 = (0, import_react_better_core14.useTheme)();
|
|
2174
|
+
const [enabled, setEnabled] = (0, import_react_better_core14.useBooleanState)(isEnabled ?? defaultIsEnabled);
|
|
2175
|
+
const onPressElement = (0, import_react15.useCallback)(() => {
|
|
1884
2176
|
onChange?.(!enabled);
|
|
1885
2177
|
setEnabled.toggle();
|
|
1886
2178
|
}, [onChange, enabled]);
|
|
1887
|
-
const trackColor = (0,
|
|
2179
|
+
const trackColor = (0, import_react15.useMemo)(
|
|
1888
2180
|
() => ({
|
|
1889
2181
|
false: theme2.colors.border,
|
|
1890
2182
|
true: theme2.colors.primary
|
|
1891
2183
|
}),
|
|
1892
2184
|
[theme2.colors]
|
|
1893
2185
|
);
|
|
1894
|
-
(0,
|
|
2186
|
+
(0, import_react15.useEffect)(() => {
|
|
1895
2187
|
if (isEnabled === void 0) return;
|
|
1896
2188
|
setEnabled.setState(isEnabled);
|
|
1897
2189
|
}, [isEnabled]);
|
|
1898
2190
|
const ballSize = 26;
|
|
1899
2191
|
const ballGap = 3;
|
|
1900
2192
|
const holderWidth = ballSize * 2.1;
|
|
1901
|
-
return import_react_native10.Platform.OS === "ios" ? /* @__PURE__ */ (0,
|
|
2193
|
+
return import_react_native10.Platform.OS === "ios" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1902
2194
|
import_react_native10.Switch,
|
|
1903
2195
|
{
|
|
1904
2196
|
trackColor,
|
|
@@ -1907,7 +2199,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1907
2199
|
value: enabled,
|
|
1908
2200
|
disabled
|
|
1909
2201
|
}
|
|
1910
|
-
) : /* @__PURE__ */ (0,
|
|
2202
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1911
2203
|
View_default,
|
|
1912
2204
|
{
|
|
1913
2205
|
width: holderWidth,
|
|
@@ -1915,7 +2207,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1915
2207
|
pressStrength: pressStrength().p05,
|
|
1916
2208
|
disabled,
|
|
1917
2209
|
onPress: !disabled ? onPressElement : void 0,
|
|
1918
|
-
children: /* @__PURE__ */ (0,
|
|
2210
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1919
2211
|
Animate_default.View,
|
|
1920
2212
|
{
|
|
1921
2213
|
width: "100%",
|
|
@@ -1925,7 +2217,7 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1925
2217
|
animateOpacity: disabled ? 0.6 : 1,
|
|
1926
2218
|
initialBackgroundColor: theme2.colors.border,
|
|
1927
2219
|
animateBackgroundColor: enabled ? theme2.colors.primary : theme2.colors.border,
|
|
1928
|
-
children: /* @__PURE__ */ (0,
|
|
2220
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1929
2221
|
Animate_default.View,
|
|
1930
2222
|
{
|
|
1931
2223
|
width: ballSize,
|
|
@@ -1942,16 +2234,16 @@ function Switch({ isEnabled, defaultIsEnabled, disabled, onChange }) {
|
|
|
1942
2234
|
}
|
|
1943
2235
|
);
|
|
1944
2236
|
}
|
|
1945
|
-
var Switch_default = (0,
|
|
2237
|
+
var Switch_default = (0, import_react15.memo)(Switch);
|
|
1946
2238
|
|
|
1947
2239
|
// src/components/StatusBar.tsx
|
|
1948
|
-
var
|
|
1949
|
-
var
|
|
2240
|
+
var import_react16 = require("react");
|
|
2241
|
+
var import_react_better_core15 = require("react-better-core");
|
|
1950
2242
|
var import_react_native11 = require("react-native");
|
|
1951
|
-
var
|
|
2243
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1952
2244
|
function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarStyle }) {
|
|
1953
|
-
const theme2 = (0,
|
|
1954
|
-
return /* @__PURE__ */ (0,
|
|
2245
|
+
const theme2 = (0, import_react_better_core15.useTheme)();
|
|
2246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1955
2247
|
import_react_native11.StatusBar,
|
|
1956
2248
|
{
|
|
1957
2249
|
backgroundColor: darkStatusBar ? theme2.colors.backgroundSecondary : void 0,
|
|
@@ -1960,29 +2252,31 @@ function StatusBar({ darkStatusBar, hidden, barStyle, androidBarStyle, iOSBarSty
|
|
|
1960
2252
|
}
|
|
1961
2253
|
);
|
|
1962
2254
|
}
|
|
1963
|
-
var StatusBar_default = (0,
|
|
2255
|
+
var StatusBar_default = (0, import_react16.memo)(StatusBar);
|
|
1964
2256
|
|
|
1965
2257
|
// src/components/ListItem.tsx
|
|
1966
|
-
var
|
|
1967
|
-
var
|
|
1968
|
-
var
|
|
2258
|
+
var import_react17 = require("react");
|
|
2259
|
+
var import_react_better_core16 = require("react-better-core");
|
|
2260
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1969
2261
|
function ListItem({
|
|
1970
2262
|
icon,
|
|
1971
2263
|
iconIOS,
|
|
1972
2264
|
title,
|
|
1973
2265
|
description,
|
|
2266
|
+
descriptionSelectable,
|
|
1974
2267
|
rightElement,
|
|
1975
2268
|
backgroundColor,
|
|
1976
2269
|
insideScreenHolder,
|
|
1977
2270
|
onPress,
|
|
1978
|
-
|
|
2271
|
+
rightValue,
|
|
2272
|
+
rightValueSelectable,
|
|
1979
2273
|
switchIsEnabled,
|
|
1980
2274
|
switchOnChange
|
|
1981
2275
|
}) {
|
|
1982
|
-
const theme2 = (0,
|
|
2276
|
+
const theme2 = (0, import_react_better_core16.useTheme)();
|
|
1983
2277
|
const device = useDevice();
|
|
1984
2278
|
const sideSpace = theme2.styles.space;
|
|
1985
|
-
return /* @__PURE__ */ (0,
|
|
2279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1986
2280
|
View_default,
|
|
1987
2281
|
{
|
|
1988
2282
|
width: insideScreenHolder ? device.windowDimensions.width : "100%",
|
|
@@ -1992,41 +2286,28 @@ function ListItem({
|
|
|
1992
2286
|
paddingHorizontal: sideSpace,
|
|
1993
2287
|
pressStrength: pressStrength().p05,
|
|
1994
2288
|
onPress,
|
|
1995
|
-
children: /* @__PURE__ */ (0,
|
|
1996
|
-
icon && /* @__PURE__ */ (0,
|
|
1997
|
-
/* @__PURE__ */ (0,
|
|
1998
|
-
title && /* @__PURE__ */ (0,
|
|
1999
|
-
description && /* @__PURE__ */ (0,
|
|
2289
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.space, children: [
|
|
2290
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon_default, { name: icon, nameIOS: iconIOS, size: 22, color: theme2.colors.primary }),
|
|
2291
|
+
/* @__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: [
|
|
2292
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text_default, { fontSize: 20, fontWeight: 700, children: title }),
|
|
2293
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text_default.body, { selectable: descriptionSelectable, children: description })
|
|
2000
2294
|
] }) }),
|
|
2001
|
-
rightElement ? /* @__PURE__ */ (0,
|
|
2002
|
-
|
|
2003
|
-
/* @__PURE__ */ (0,
|
|
2295
|
+
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: [
|
|
2296
|
+
rightValue !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Text_default, { fontSize: 14, fontWeight: 700, selectable: rightValueSelectable, children: rightValue }),
|
|
2297
|
+
rightElement === "arrow" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2004
2298
|
Icon_default,
|
|
2005
2299
|
{
|
|
2006
2300
|
name: "chevronRight",
|
|
2007
2301
|
nameIOS: "chevron.right",
|
|
2008
|
-
color:
|
|
2302
|
+
color: rightValue !== void 0 ? theme2.colors.textPrimary : theme2.colors.textSecondary
|
|
2009
2303
|
}
|
|
2010
2304
|
)
|
|
2011
|
-
] }) : rightElement === "switch" ? /* @__PURE__ */ (0,
|
|
2305
|
+
] }) : rightElement === "switch" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Switch_default, { isEnabled: switchIsEnabled, onChange: switchOnChange }) : void 0 }) : void 0
|
|
2012
2306
|
] })
|
|
2013
2307
|
}
|
|
2014
2308
|
);
|
|
2015
2309
|
}
|
|
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
|
-
});
|
|
2310
|
+
var ListItem_default = (0, import_react17.memo)(ListItem);
|
|
2030
2311
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2031
2312
|
0 && (module.exports = {
|
|
2032
2313
|
Animate,
|
|
@@ -2042,10 +2323,13 @@ var asyncStoragePlugin = (options) => ({
|
|
|
2042
2323
|
Switch,
|
|
2043
2324
|
Text,
|
|
2044
2325
|
View,
|
|
2326
|
+
alertControls,
|
|
2327
|
+
alertsPlugin,
|
|
2045
2328
|
asyncStoragePlugin,
|
|
2046
2329
|
colorThemeControls,
|
|
2047
2330
|
countries,
|
|
2048
2331
|
darkenColor,
|
|
2332
|
+
defaultAlertsPluginOptions,
|
|
2049
2333
|
defaultAsyncStoragePluginOptions,
|
|
2050
2334
|
desaturateColor,
|
|
2051
2335
|
eventPreventDefault,
|
|
@@ -2060,6 +2344,7 @@ var asyncStoragePlugin = (options) => ({
|
|
|
2060
2344
|
loaderControls,
|
|
2061
2345
|
pressStrength,
|
|
2062
2346
|
saturateColor,
|
|
2347
|
+
useAlertControls,
|
|
2063
2348
|
useBetterComponentsContext,
|
|
2064
2349
|
useBooleanState,
|
|
2065
2350
|
useDebounceState,
|