@codeleap/mobile 4.2.8 → 4.2.10
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/Registry.js +28 -53
- package/dist/Registry.js.map +1 -1
- package/dist/components/ActionIcon/index.js +27 -67
- package/dist/components/ActionIcon/index.js.map +1 -1
- package/dist/components/ActionIcon/styles.js +1 -2
- package/dist/components/ActionIcon/types.js +1 -2
- package/dist/components/ActivityIndicator/index.js +22 -62
- package/dist/components/ActivityIndicator/index.js.map +1 -1
- package/dist/components/ActivityIndicator/styles.js +1 -2
- package/dist/components/ActivityIndicator/types.js +1 -2
- package/dist/components/Autocomplete/index.js +73 -121
- package/dist/components/Autocomplete/index.js.map +1 -1
- package/dist/components/Autocomplete/styles.js +1 -2
- package/dist/components/Autocomplete/types.js +1 -2
- package/dist/components/Avatar/index.js +49 -90
- package/dist/components/Avatar/index.js.map +1 -1
- package/dist/components/Avatar/styles.js +1 -2
- package/dist/components/Avatar/types.js +1 -2
- package/dist/components/AvatarGroup/index.js +30 -75
- package/dist/components/AvatarGroup/index.js.map +1 -1
- package/dist/components/AvatarGroup/styles.js +1 -2
- package/dist/components/AvatarGroup/types.js +1 -2
- package/dist/components/Backdrop/index.js +26 -66
- package/dist/components/Backdrop/index.js.map +1 -1
- package/dist/components/Backdrop/styles.js +1 -2
- package/dist/components/Backdrop/types.js +1 -2
- package/dist/components/Badge/index.js +44 -85
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Badge/styles.js +1 -2
- package/dist/components/Badge/types.js +1 -2
- package/dist/components/Button/index.js +49 -98
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Button/styles.js +1 -2
- package/dist/components/Button/types.js +1 -2
- package/dist/components/Calendar/index.js +27 -68
- package/dist/components/Calendar/index.js.map +1 -1
- package/dist/components/Calendar/types.d.ts +1 -2
- package/dist/components/Calendar/types.js +1 -2
- package/dist/components/Checkbox/index.js +52 -85
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/styles.js +1 -2
- package/dist/components/Checkbox/types.js +1 -2
- package/dist/components/DatePickerModal/index.js +61 -113
- package/dist/components/DatePickerModal/index.js.map +1 -1
- package/dist/components/DatePickerModal/styles.js +1 -2
- package/dist/components/DatePickerModal/types.js +1 -2
- package/dist/components/EmptyPlaceholder/index.js +40 -69
- package/dist/components/EmptyPlaceholder/index.js.map +1 -1
- package/dist/components/EmptyPlaceholder/styles.js +1 -2
- package/dist/components/EmptyPlaceholder/types.js +1 -2
- package/dist/components/FileInput/index.js +112 -178
- package/dist/components/FileInput/index.js.map +1 -1
- package/dist/components/FileInput/types.js +1 -2
- package/dist/components/Grid/index.js +47 -97
- package/dist/components/Grid/index.js.map +1 -1
- package/dist/components/Grid/styles.js +1 -2
- package/dist/components/Grid/types.js +1 -2
- package/dist/components/Icon/index.js +34 -75
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/Icon/styles.js +1 -2
- package/dist/components/Icon/types.js +1 -2
- package/dist/components/Image/index.js +53 -96
- package/dist/components/Image/index.js.map +1 -1
- package/dist/components/Image/styles.js +1 -2
- package/dist/components/Image/types.js +1 -2
- package/dist/components/ImageView/Spotlight.js +75 -131
- package/dist/components/ImageView/Spotlight.js.map +1 -1
- package/dist/components/ImageView/component.js +8 -15
- package/dist/components/ImageView/component.js.map +1 -1
- package/dist/components/ImageView/index.js +2 -18
- package/dist/components/ImageView/index.js.map +1 -1
- package/dist/components/InputBase/index.js +35 -75
- package/dist/components/InputBase/index.js.map +1 -1
- package/dist/components/InputBase/styles.d.ts +3 -3
- package/dist/components/InputBase/styles.js +49 -50
- package/dist/components/InputBase/styles.js.map +1 -1
- package/dist/components/InputBase/types.d.ts +1 -0
- package/dist/components/InputBase/types.js +1 -2
- package/dist/components/InputBase/utils.js +4 -19
- package/dist/components/InputBase/utils.js.map +1 -1
- package/dist/components/List/index.js +46 -86
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/List/styles.js +1 -2
- package/dist/components/List/types.js +1 -2
- package/dist/components/LoadingOverlay/index.js +28 -66
- package/dist/components/LoadingOverlay/index.js.map +1 -1
- package/dist/components/LoadingOverlay/styles.js +1 -2
- package/dist/components/LoadingOverlay/types.js +1 -2
- package/dist/components/Modal/index.js +77 -113
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/styles.js +1 -2
- package/dist/components/Modal/types.js +1 -2
- package/dist/components/Navigation/Navigation.js +23 -66
- package/dist/components/Navigation/Navigation.js.map +1 -1
- package/dist/components/Navigation/constants.js +7 -10
- package/dist/components/Navigation/constants.js.map +1 -1
- package/dist/components/Navigation/index.js +3 -19
- package/dist/components/Navigation/index.js.map +1 -1
- package/dist/components/Navigation/types.js +1 -2
- package/dist/components/Navigation/utils.js +24 -59
- package/dist/components/Navigation/utils.js.map +1 -1
- package/dist/components/NumberIncrement/index.js +132 -165
- package/dist/components/NumberIncrement/index.js.map +1 -1
- package/dist/components/NumberIncrement/styles.js +1 -2
- package/dist/components/NumberIncrement/types.d.ts +2 -2
- package/dist/components/NumberIncrement/types.js +1 -2
- package/dist/components/NumberIncrement/utils.js +8 -12
- package/dist/components/NumberIncrement/utils.js.map +1 -1
- package/dist/components/Pager/PagerDots.js +17 -54
- package/dist/components/Pager/PagerDots.js.map +1 -1
- package/dist/components/Pager/index.js +43 -97
- package/dist/components/Pager/index.js.map +1 -1
- package/dist/components/Pager/styles.js +1 -2
- package/dist/components/Pager/types.js +1 -2
- package/dist/components/PaginationIndicator/index.js +23 -38
- package/dist/components/PaginationIndicator/index.js.map +1 -1
- package/dist/components/PaginationIndicator/styles.js +1 -2
- package/dist/components/PaginationIndicator/types.js +1 -2
- package/dist/components/PlacesAutocomplete/index.js +55 -106
- package/dist/components/PlacesAutocomplete/index.js.map +1 -1
- package/dist/components/PlacesAutocomplete/styles.js +1 -2
- package/dist/components/PlacesAutocomplete/types.js +1 -2
- package/dist/components/RadioInput/index.js +46 -84
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/styles.js +1 -2
- package/dist/components/RadioInput/types.js +1 -2
- package/dist/components/RefreshControl/index.js +22 -63
- package/dist/components/RefreshControl/index.js.map +1 -1
- package/dist/components/RefreshControl/styles.js +1 -2
- package/dist/components/RefreshControl/types.js +1 -2
- package/dist/components/Scroll/index.js +33 -81
- package/dist/components/Scroll/index.js.map +1 -1
- package/dist/components/Scroll/styles.js +1 -2
- package/dist/components/Scroll/types.js +1 -2
- package/dist/components/SearchInput/index.js +22 -69
- package/dist/components/SearchInput/index.js.map +1 -1
- package/dist/components/SectionFilters/context.d.ts +6 -0
- package/dist/components/SectionFilters/context.js +4 -8
- package/dist/components/SectionFilters/context.js.map +1 -1
- package/dist/components/SectionFilters/index.js +33 -76
- package/dist/components/SectionFilters/index.js.map +1 -1
- package/dist/components/SectionFilters/types.js +1 -2
- package/dist/components/SectionFilters/useSectionFilters.d.ts +3 -0
- package/dist/components/SectionFilters/useSectionFilters.js +71 -73
- package/dist/components/SectionFilters/useSectionFilters.js.map +1 -1
- package/dist/components/Sections/index.d.ts +8 -8
- package/dist/components/Sections/index.js +61 -106
- package/dist/components/Sections/index.js.map +1 -1
- package/dist/components/Sections/styles.d.ts +1 -1
- package/dist/components/Sections/styles.js +1 -2
- package/dist/components/Sections/types.js +1 -2
- package/dist/components/SegmentedControl/Option.js +13 -31
- package/dist/components/SegmentedControl/Option.js.map +1 -1
- package/dist/components/SegmentedControl/index.js +71 -114
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/SegmentedControl/styles.js +1 -2
- package/dist/components/SegmentedControl/types.js +1 -2
- package/dist/components/Select/index.js +94 -157
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.js +1 -2
- package/dist/components/Select/types.js +1 -2
- package/dist/components/Slider/index.js +89 -129
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/styles.d.ts +0 -6
- package/dist/components/Slider/styles.js +1 -2
- package/dist/components/Slider/types.js +1 -2
- package/dist/components/SortablePhotos/index.js +58 -91
- package/dist/components/SortablePhotos/index.js.map +1 -1
- package/dist/components/SortablePhotos/styles.js +1 -2
- package/dist/components/SortablePhotos/types.js +1 -2
- package/dist/components/SortablePhotos/useSortablePhotos.js +93 -157
- package/dist/components/SortablePhotos/useSortablePhotos.js.map +1 -1
- package/dist/components/Switch/index.js +51 -84
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/styles.js +1 -2
- package/dist/components/Switch/types.js +1 -2
- package/dist/components/Text/index.js +40 -88
- package/dist/components/Text/index.js.map +1 -1
- package/dist/components/Text/styles.js +1 -2
- package/dist/components/Text/types.js +1 -2
- package/dist/components/TextInput/index.js +83 -131
- package/dist/components/TextInput/index.js.map +1 -1
- package/dist/components/TextInput/styles.js +1 -2
- package/dist/components/TextInput/types.js +1 -2
- package/dist/components/Touchable/index.js +69 -122
- package/dist/components/Touchable/index.js.map +1 -1
- package/dist/components/Touchable/styles.js +1 -2
- package/dist/components/Touchable/types.js +1 -2
- package/dist/components/View/index.js +19 -51
- package/dist/components/View/index.js.map +1 -1
- package/dist/components/View/styles.js +1 -2
- package/dist/components/View/types.js +1 -2
- package/dist/components/components.js +43 -59
- package/dist/components/components.js.map +1 -1
- package/dist/hooks/index.js +7 -11
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.js +8 -43
- package/dist/index.js.map +1 -1
- package/dist/modules/PressableRipple/index.js +2 -8
- package/dist/modules/PressableRipple/index.js.map +1 -1
- package/dist/modules/PressableRipple/ripple.js +125 -163
- package/dist/modules/PressableRipple/ripple.js.map +1 -1
- package/dist/modules/PressableRipple/styles.js +9 -20
- package/dist/modules/PressableRipple/styles.js.map +1 -1
- package/dist/modules/PressableRipple/type.js +1 -2
- package/dist/modules/reactNavigation.js +10 -21
- package/dist/modules/reactNavigation.js.map +1 -1
- package/dist/modules/textInputMask.js +3 -20
- package/dist/modules/textInputMask.js.map +1 -1
- package/dist/modules/types/textInputMask.js +1 -2
- package/dist/types/index.js +1 -17
- package/dist/types/index.js.map +1 -1
- package/dist/types/utility.js +1 -2
- package/dist/utils/KeyboardAware/context.js +5 -14
- package/dist/utils/KeyboardAware/context.js.map +1 -1
- package/dist/utils/KeyboardAware/index.js +3 -19
- package/dist/utils/KeyboardAware/index.js.map +1 -1
- package/dist/utils/KeyboardAware/keyboardHooks.js +36 -41
- package/dist/utils/KeyboardAware/keyboardHooks.js.map +1 -1
- package/dist/utils/KeyboardAware/types.js +1 -2
- package/dist/utils/KeyboardAware/types.js.map +1 -1
- package/dist/utils/ModalManager/components.js +24 -54
- package/dist/utils/ModalManager/components.js.map +1 -1
- package/dist/utils/ModalManager/context.js +94 -89
- package/dist/utils/ModalManager/context.js.map +1 -1
- package/dist/utils/ModalManager/index.js +7 -10
- package/dist/utils/ModalManager/index.js.map +1 -1
- package/dist/utils/NotificationManager/index.js +115 -245
- package/dist/utils/NotificationManager/index.js.map +1 -1
- package/dist/utils/NotificationManager/types.js +1 -2
- package/dist/utils/OSAlert.js +32 -48
- package/dist/utils/OSAlert.js.map +1 -1
- package/dist/utils/PermissionManager/context.js +138 -255
- package/dist/utils/PermissionManager/context.js.map +1 -1
- package/dist/utils/PermissionManager/index.js +2 -8
- package/dist/utils/PermissionManager/index.js.map +1 -1
- package/dist/utils/PermissionManager/types.js +1 -2
- package/dist/utils/StorageManager.js +39 -46
- package/dist/utils/StorageManager.js.map +1 -1
- package/dist/utils/Subscription.js +30 -54
- package/dist/utils/Subscription.js.map +1 -1
- package/dist/utils/deprecated/notifications.js +143 -250
- package/dist/utils/deprecated/notifications.js.map +1 -1
- package/dist/utils/hooks.js +101 -120
- package/dist/utils/hooks.js.map +1 -1
- package/dist/utils/index.js +14 -43
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/input.js +15 -19
- package/dist/utils/input.js.map +1 -1
- package/dist/utils/locale.js +5 -9
- package/dist/utils/locale.js.map +1 -1
- package/dist/utils/misc.js +25 -40
- package/dist/utils/misc.js.map +1 -1
- package/dist/utils/theme.js +24 -33
- package/dist/utils/theme.js.map +1 -1
- package/dist/utils/useQueryListRefresh.js +16 -26
- package/dist/utils/useQueryListRefresh.js.map +1 -1
- package/package.json +6 -6
- package/package.json.bak +2 -2
- package/src/components/Calendar/types.ts +3 -3
- package/src/components/InputBase/styles.ts +35 -23
- package/src/components/InputBase/types.ts +1 -0
- package/src/components/NumberIncrement/index.tsx +8 -2
- package/src/components/NumberIncrement/types.ts +3 -3
- package/src/components/RadioInput/index.tsx +4 -0
- package/src/components/SectionFilters/useSectionFilters.tsx +31 -1
- package/src/components/Sections/index.tsx +3 -2
- package/src/components/Sections/styles.ts +2 -2
- package/src/components/Slider/index.tsx +9 -1
- package/src/components/Slider/styles.ts +0 -6
- package/src/components/TextInput/index.tsx +5 -0
package/dist/utils/misc.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getFileInfo = exports.getFileMimeType = exports.toMultipart = exports.isFile = exports.toMultipartFile = exports.stringToFile = void 0;
|
|
4
|
-
var common_1 = require("@codeleap/common");
|
|
5
|
-
var stringToFile = function (str) {
|
|
1
|
+
import { parseFilePathData, TypeGuards } from '@codeleap/common';
|
|
2
|
+
export const stringToFile = (str) => {
|
|
6
3
|
if (!str) {
|
|
7
4
|
return {
|
|
8
5
|
file: null,
|
|
9
6
|
preview: null,
|
|
10
7
|
};
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const fileData = parseFilePathData(str);
|
|
10
|
+
const data = {
|
|
14
11
|
name: fileData.name,
|
|
15
12
|
type: 'image/' + fileData.extension,
|
|
16
13
|
size: 1000,
|
|
@@ -22,11 +19,10 @@ var stringToFile = function (str) {
|
|
|
22
19
|
preview: data.uri,
|
|
23
20
|
};
|
|
24
21
|
};
|
|
25
|
-
|
|
26
|
-
function toMultipartFile(file) {
|
|
22
|
+
export function toMultipartFile(file) {
|
|
27
23
|
// const inputFile = file as MobileInputFile
|
|
28
|
-
|
|
29
|
-
if (!!
|
|
24
|
+
const withPreview = file;
|
|
25
|
+
if (!!withPreview?.file) {
|
|
30
26
|
return withPreview.file;
|
|
31
27
|
}
|
|
32
28
|
return file;
|
|
@@ -44,39 +40,35 @@ function toMultipartFile(file) {
|
|
|
44
40
|
// // return fileData as unknown as Blob
|
|
45
41
|
// // }
|
|
46
42
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var file = param;
|
|
43
|
+
export function isFile(param) {
|
|
44
|
+
let file = param;
|
|
50
45
|
try {
|
|
51
|
-
if (typeof
|
|
46
|
+
if (typeof param?.preview !== 'undefined' && typeof param?.file !== 'undefined') {
|
|
52
47
|
file = param.file;
|
|
53
48
|
}
|
|
54
|
-
|
|
55
|
-
return ['uri', 'name', 'type'].every(
|
|
49
|
+
const keys = Object.keys(file);
|
|
50
|
+
return ['uri', 'name', 'type'].every(key => keys.includes(key));
|
|
56
51
|
}
|
|
57
52
|
catch (e) {
|
|
58
53
|
return false;
|
|
59
54
|
}
|
|
60
55
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var _loop_1 = function (key, value) {
|
|
66
|
-
var formValue = null;
|
|
56
|
+
export function toMultipart(body, defaultFileValue = 'null') {
|
|
57
|
+
const form = new FormData();
|
|
58
|
+
for (const [key, value] of Object.entries(body)) {
|
|
59
|
+
let formValue = null;
|
|
67
60
|
if (Array.isArray(value) && value.every(isFile)) {
|
|
68
|
-
formValue = value.map(
|
|
61
|
+
formValue = value.map((file) => form.append(key, toMultipartFile(file)));
|
|
69
62
|
}
|
|
70
63
|
else if (isFile(value)) {
|
|
71
64
|
formValue = toMultipartFile(value);
|
|
72
65
|
}
|
|
73
66
|
else if (key === 'files' && typeof value === 'object') {
|
|
74
|
-
if (
|
|
67
|
+
if (TypeGuards.isNil(value)) {
|
|
75
68
|
form.append(key, defaultFileValue);
|
|
76
69
|
}
|
|
77
70
|
else {
|
|
78
|
-
for (
|
|
79
|
-
var _e = _d[_c], filename = _e[0], file = _e[1];
|
|
71
|
+
for (const [filename, file] of Object.entries(value)) {
|
|
80
72
|
form.append(filename, toMultipartFile(file));
|
|
81
73
|
}
|
|
82
74
|
}
|
|
@@ -88,17 +80,12 @@ function toMultipart(body, defaultFileValue) {
|
|
|
88
80
|
formValue = String(value);
|
|
89
81
|
}
|
|
90
82
|
form.append(key, formValue);
|
|
91
|
-
};
|
|
92
|
-
for (var _i = 0, _a = Object.entries(body); _i < _a.length; _i++) {
|
|
93
|
-
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
94
|
-
_loop_1(key, value);
|
|
95
83
|
}
|
|
96
84
|
return form;
|
|
97
85
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var mimeTypes = {
|
|
86
|
+
export function getFileMimeType(uri) {
|
|
87
|
+
const extension = uri.split('.').pop().toLowerCase();
|
|
88
|
+
const mimeTypes = {
|
|
102
89
|
jpg: 'image/jpeg',
|
|
103
90
|
jpeg: 'image/jpeg',
|
|
104
91
|
png: 'image/png',
|
|
@@ -110,15 +97,13 @@ function getFileMimeType(uri) {
|
|
|
110
97
|
};
|
|
111
98
|
return mimeTypes[extension] || 'application/octet-stream';
|
|
112
99
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
var fileType = getFileMimeType(fileName);
|
|
100
|
+
export function getFileInfo(uri) {
|
|
101
|
+
const fileName = uri.split('/').pop();
|
|
102
|
+
const fileType = getFileMimeType(fileName);
|
|
117
103
|
return {
|
|
118
104
|
name: fileName,
|
|
119
105
|
type: fileType,
|
|
120
106
|
uri: uri,
|
|
121
107
|
};
|
|
122
108
|
}
|
|
123
|
-
exports.getFileInfo = getFileInfo;
|
|
124
109
|
//# sourceMappingURL=misc.js.map
|
package/dist/utils/misc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"misc.js","sourceRoot":"","sources":["../../src/utils/misc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file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10
|
-
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getMobileThemeValues = void 0;
|
|
18
|
-
var react_native_1 = require("react-native");
|
|
19
|
-
var react_native_device_info_1 = __importDefault(require("react-native-device-info"));
|
|
20
|
-
function getMobileThemeValues(initialWindowMetrics, options) {
|
|
21
|
-
var _a, _b, _c, _d;
|
|
22
|
-
if (options === void 0) { options = {}; }
|
|
23
|
-
var screenDimensions = react_native_1.Dimensions.get('screen');
|
|
24
|
-
var hasNotch = react_native_device_info_1.default.hasNotch();
|
|
25
|
-
var hasIsland = react_native_device_info_1.default.hasDynamicIsland();
|
|
26
|
-
var bottomNavHeight = react_native_1.Platform.OS === 'android' ? (_b = (_a = options === null || options === void 0 ? void 0 : options.getAndroidNavbarHeight) === null || _a === void 0 ? void 0 : _a.call(options)) !== null && _b !== void 0 ? _b : 0 : 0;
|
|
27
|
-
var prefersConstantNavigationBar = bottomNavHeight > 0;
|
|
28
|
-
var safeAreaTop = react_native_1.Platform.OS === 'ios' ? (hasNotch ? 34 + (hasIsland ? 12 : 0) : 20) : (((_c = options === null || options === void 0 ? void 0 : options.getStatusBarHeight) === null || _c === void 0 ? void 0 : _c.call(options)) || 0);
|
|
29
|
-
var safeAreaBottom = react_native_1.Platform.select({
|
|
1
|
+
import { Platform, Dimensions, StyleSheet } from 'react-native';
|
|
2
|
+
import DeviceInfo from 'react-native-device-info';
|
|
3
|
+
export function getMobileThemeValues(initialWindowMetrics, options = {}) {
|
|
4
|
+
const screenDimensions = Dimensions.get('screen');
|
|
5
|
+
const hasNotch = DeviceInfo.hasNotch();
|
|
6
|
+
const hasIsland = DeviceInfo.hasDynamicIsland();
|
|
7
|
+
const bottomNavHeight = Platform.OS === 'android' ? options?.getAndroidNavbarHeight?.() ?? 0 : 0;
|
|
8
|
+
const prefersConstantNavigationBar = bottomNavHeight > 0;
|
|
9
|
+
const safeAreaTop = Platform.OS === 'ios' ? (hasNotch ? 34 + (hasIsland ? 12 : 0) : 20) : (options?.getStatusBarHeight?.() || 0);
|
|
10
|
+
const safeAreaBottom = Platform.select({
|
|
30
11
|
ios: hasNotch && !prefersConstantNavigationBar ? 20 : 0,
|
|
31
|
-
android:
|
|
12
|
+
android: bottomNavHeight ?? initialWindowMetrics?.insets.bottom ?? 0,
|
|
32
13
|
});
|
|
33
|
-
return
|
|
14
|
+
return {
|
|
15
|
+
...screenDimensions,
|
|
16
|
+
pixel: StyleSheet.hairlineWidth,
|
|
17
|
+
hasNotch,
|
|
18
|
+
hasIsland,
|
|
19
|
+
prefersConstantNavigationBar,
|
|
20
|
+
safeAreaTop,
|
|
21
|
+
safeAreaBottom,
|
|
22
|
+
keyboardVerticalOffset: Platform.OS === 'ios' ? 57 : 47,
|
|
23
|
+
bottomNavHeight,
|
|
24
|
+
get window() {
|
|
34
25
|
return {
|
|
35
26
|
height: screenDimensions.height - (safeAreaBottom + safeAreaTop),
|
|
36
27
|
width: screenDimensions.width,
|
|
37
28
|
};
|
|
38
|
-
}
|
|
29
|
+
},
|
|
30
|
+
};
|
|
39
31
|
}
|
|
40
|
-
exports.getMobileThemeValues = getMobileThemeValues;
|
|
41
32
|
//# sourceMappingURL=theme.js.map
|
package/dist/utils/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,UAAU,MAAM,0BAA0B,CAAA;AAOjD,MAAM,UAAU,oBAAoB,CAA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,gBAAgB,CAAC,MAAM,GAAG,CAAC,cAAc,GAAG,WAAW,CAAC;gBAChE,KAAK,EAAE,gBAAgB,CAAC,KAAK;aAC9B,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,42 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var common_1 = require("@codeleap/common");
|
|
10
|
-
var useQueryListRefresh = function (listQuery, options) {
|
|
11
|
-
var _a;
|
|
12
|
-
if (options === void 0) { options = {}; }
|
|
13
|
-
var _b = options.staleTime, staleTime = _b === void 0 ? 5000 : _b, _c = options.initialStale, initialStale = _c === void 0 ? (_a = listQuery === null || listQuery === void 0 ? void 0 : listQuery.query) === null || _a === void 0 ? void 0 : _a.isStale : _c, _d = options.cancelQueryEnabled, cancelQueryEnabled = _d === void 0 ? true : _d, _e = options.refreshQueryEnabled, refreshQueryEnabled = _e === void 0 ? true : _e, _f = options.silentRefresh, silentRefresh = _f === void 0 ? false : _f, onFocus = options.onFocus, onBlur = options.onBlur;
|
|
14
|
-
var staleRefetch = react_1.default.useRef(initialStale);
|
|
15
|
-
var staleTimeout = react_1.default.useRef(null);
|
|
16
|
-
(0, native_1.useFocusEffect)(react_1.default.useCallback(function () {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useFocusEffect } from '@react-navigation/native';
|
|
3
|
+
import { TypeGuards } from '@codeleap/common';
|
|
4
|
+
export const useQueryListRefresh = (listQuery, options = {}) => {
|
|
5
|
+
const { staleTime = 5000, initialStale = listQuery?.query?.isStale, cancelQueryEnabled = true, refreshQueryEnabled = true, silentRefresh = false, onFocus, onBlur, } = options;
|
|
6
|
+
const staleRefetch = React.useRef(initialStale);
|
|
7
|
+
const staleTimeout = React.useRef(null);
|
|
8
|
+
useFocusEffect(React.useCallback(() => {
|
|
17
9
|
if (staleRefetch.current && refreshQueryEnabled) {
|
|
18
|
-
listQuery
|
|
10
|
+
listQuery?.refreshQuery(silentRefresh);
|
|
19
11
|
}
|
|
20
|
-
if (
|
|
21
|
-
onFocus
|
|
12
|
+
if (TypeGuards.isFunction(onFocus)) {
|
|
13
|
+
onFocus?.();
|
|
22
14
|
}
|
|
23
|
-
return
|
|
24
|
-
var _a;
|
|
15
|
+
return () => {
|
|
25
16
|
if (cancelQueryEnabled)
|
|
26
|
-
|
|
17
|
+
listQuery?.cancelQuery?.();
|
|
27
18
|
staleRefetch.current = false;
|
|
28
19
|
if (staleTimeout.current == null) {
|
|
29
|
-
staleTimeout.current = setTimeout(
|
|
20
|
+
staleTimeout.current = setTimeout(() => {
|
|
30
21
|
staleRefetch.current = true;
|
|
31
22
|
clearTimeout(staleTimeout.current);
|
|
32
23
|
staleTimeout.current = null;
|
|
33
24
|
}, staleTime);
|
|
34
25
|
}
|
|
35
|
-
if (
|
|
36
|
-
onBlur
|
|
26
|
+
if (TypeGuards.isFunction(onBlur)) {
|
|
27
|
+
onBlur?.();
|
|
37
28
|
}
|
|
38
29
|
};
|
|
39
30
|
}, []));
|
|
40
31
|
};
|
|
41
|
-
exports.useQueryListRefresh = useQueryListRefresh;
|
|
42
32
|
//# sourceMappingURL=useQueryListRefresh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useQueryListRefresh.js","sourceRoot":"","sources":["../../src/utils/useQueryListRefresh.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useQueryListRefresh.js","sourceRoot":"","sources":["../../src/utils/useQueryListRefresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAe,UAAU,EAAiB,MAAM,kBAAkB,CAAA;AAezE,MAAM,CAAC,MAAM,mBAAmB,GAAwB,CAAC,SAAS,EAAE,OAAO,GAAG,EAAE,EAAE,EAAE;IAClF,MAAM,EAC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ap/mobile",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.10",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -9,18 +9,18 @@
|
|
|
9
9
|
"directory": "packages/mobile"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@codeleap/common": "4.2.
|
|
13
|
-
"@codeleap/config": "4.2.
|
|
12
|
+
"@codeleap/common": "4.2.10",
|
|
13
|
+
"@codeleap/config": "4.2.10"
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc --build",
|
|
17
17
|
"lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\""
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@codeleap/common": "4.2.
|
|
21
|
-
"@codeleap/styles": "4.2.
|
|
20
|
+
"@codeleap/common": "4.2.10",
|
|
21
|
+
"@codeleap/styles": "4.2.10",
|
|
22
22
|
"@d11/react-native-fast-image": "8.8.0",
|
|
23
|
-
"@react-native-firebase/messaging": "
|
|
23
|
+
"@react-native-firebase/messaging": "21.4.0",
|
|
24
24
|
"@react-navigation/bottom-tabs": "6.5.3",
|
|
25
25
|
"@react-navigation/drawer": "6.5.7",
|
|
26
26
|
"@react-navigation/native": "6.1.2",
|
package/package.json.bak
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/mobile",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.10",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@codeleap/common": "workspace:*",
|
|
21
21
|
"@codeleap/styles": "workspace:*",
|
|
22
22
|
"@d11/react-native-fast-image": "8.8.0",
|
|
23
|
-
"@react-native-firebase/messaging": "
|
|
23
|
+
"@react-native-firebase/messaging": "21.4.0",
|
|
24
24
|
"@react-navigation/bottom-tabs": "6.5.3",
|
|
25
25
|
"@react-navigation/drawer": "6.5.7",
|
|
26
26
|
"@react-navigation/native": "6.1.2",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FilterKeys } from '@codeleap/common'
|
|
2
|
-
|
|
1
|
+
import { FilterKeys, Paths } from '@codeleap/common'
|
|
2
|
+
|
|
3
3
|
import { TextStyle, ViewStyle } from 'react-native'
|
|
4
4
|
|
|
5
5
|
type CalendarTheme = {
|
|
@@ -26,7 +26,7 @@ type CalendarTheme = {
|
|
|
26
26
|
arrowColor?: string
|
|
27
27
|
textDisabledColor?: string
|
|
28
28
|
textInactiveColor?: string
|
|
29
|
-
backgroundColor?: string
|
|
29
|
+
backgroundColor?: string //TODO: remove in V2
|
|
30
30
|
dotColor?: string
|
|
31
31
|
selectedDotColor?: string
|
|
32
32
|
disabledArrowColor?: string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TypeGuards } from
|
|
2
|
-
import { ActionIconParts } from
|
|
3
|
-
import { InputBaseProps } from
|
|
1
|
+
import { TypeGuards } from '@codeleap/common'
|
|
2
|
+
import { ActionIconParts } from '../ActionIcon'
|
|
3
|
+
import { InputBaseProps } from './types'
|
|
4
4
|
import { mergeStyles, useCompositionStyles } from '@codeleap/styles'
|
|
5
5
|
import { useMemo } from 'react'
|
|
6
6
|
|
|
@@ -10,16 +10,17 @@ type IconParts = ActionIconParts
|
|
|
10
10
|
|
|
11
11
|
export type InputIconComposition = `${InputIcons}${Capitalize<IconParts>}`
|
|
12
12
|
|
|
13
|
-
export type InputBaseStates = 'error' | 'focus' | 'disabled'
|
|
13
|
+
export type InputBaseStates = 'error' | 'focus' | 'disabled' | 'typed'
|
|
14
14
|
|
|
15
|
-
export type InputBaseParts =
|
|
15
|
+
export type InputBaseParts =
|
|
16
16
|
'wrapper' |
|
|
17
17
|
'innerWrapper' |
|
|
18
18
|
'label' |
|
|
19
19
|
'errorMessage' |
|
|
20
20
|
'description' |
|
|
21
21
|
'labelRow'|
|
|
22
|
-
|
|
22
|
+
|
|
23
|
+
InputIconComposition
|
|
23
24
|
|
|
24
25
|
export type IconLessInputBaseParts = Exclude<InputBaseParts, InputIconComposition>
|
|
25
26
|
|
|
@@ -27,23 +28,26 @@ export type InputBaseComposition = `${InputBaseParts}:${InputBaseStates}` | Inpu
|
|
|
27
28
|
|
|
28
29
|
const getIconStyles = (obj, state) => ({
|
|
29
30
|
icon: mergeStyles([
|
|
30
|
-
obj.icon,
|
|
31
|
+
obj.icon,
|
|
31
32
|
state.focused && obj['icon:focus'],
|
|
32
|
-
state.hasError && obj['icon:error'],
|
|
33
|
-
state.disabled && obj['icon:disabled']
|
|
33
|
+
state.hasError && obj['icon:error'],
|
|
34
|
+
state.disabled && obj['icon:disabled'],
|
|
35
|
+
state.hasValue && obj['icon:typed'],
|
|
34
36
|
]),
|
|
35
37
|
'icon:disabled': mergeStyles([
|
|
36
|
-
state.disabled && obj['icon:disabled']
|
|
38
|
+
state.disabled && obj['icon:disabled'],
|
|
37
39
|
]),
|
|
38
40
|
touchableWrapper: mergeStyles([
|
|
39
|
-
obj.touchableWrapper,
|
|
41
|
+
obj.touchableWrapper,
|
|
40
42
|
state.focused && obj['touchableWrapper:focus'],
|
|
41
|
-
state.hasError && obj['touchableWrapper:error'],
|
|
42
|
-
state.disabled && obj['touchableWrapper:disabled']
|
|
43
|
+
state.hasError && obj['touchableWrapper:error'],
|
|
44
|
+
state.disabled && obj['touchableWrapper:disabled'],
|
|
45
|
+
state.hasValue && obj['touchableWrapper:typed'],
|
|
43
46
|
]),
|
|
44
47
|
'touchableWrapper:disabled': mergeStyles([
|
|
45
|
-
state.disabled && obj['touchableWrapper:disabled']
|
|
46
|
-
])
|
|
48
|
+
state.disabled && obj['touchableWrapper:disabled'],
|
|
49
|
+
]),
|
|
50
|
+
|
|
47
51
|
})
|
|
48
52
|
|
|
49
53
|
const useIconStyles = (styles, iconStyles, states) => {
|
|
@@ -59,7 +63,9 @@ export const useInputBaseStyles = (props: InputBaseProps) => {
|
|
|
59
63
|
focused,
|
|
60
64
|
disabled,
|
|
61
65
|
error,
|
|
66
|
+
|
|
62
67
|
style: styles,
|
|
68
|
+
hasValue,
|
|
63
69
|
} = props
|
|
64
70
|
|
|
65
71
|
const hasError = !TypeGuards.isNil(error)
|
|
@@ -68,14 +74,14 @@ export const useInputBaseStyles = (props: InputBaseProps) => {
|
|
|
68
74
|
|
|
69
75
|
const generalIconStyles = getIconStyles(compositionStyles?.icon, { hasError, disabled })
|
|
70
76
|
|
|
71
|
-
const leftIconStyles = useIconStyles(generalIconStyles, compositionStyles?.leftIcon, {
|
|
77
|
+
const leftIconStyles = useIconStyles(generalIconStyles, compositionStyles?.leftIcon, {
|
|
72
78
|
// @ts-expect-error
|
|
73
|
-
hasError, disabled: (disabled || props?.leftIcon?.disabled), focused
|
|
79
|
+
hasError, disabled: (disabled || props?.leftIcon?.disabled), focused,
|
|
74
80
|
})
|
|
75
81
|
|
|
76
|
-
const rightIconStyles = useIconStyles(generalIconStyles, compositionStyles?.rightIcon, {
|
|
82
|
+
const rightIconStyles = useIconStyles(generalIconStyles, compositionStyles?.rightIcon, {
|
|
77
83
|
// @ts-expect-error
|
|
78
|
-
hasError, disabled: (disabled || props?.rightIcon?.disabled), focused
|
|
84
|
+
hasError, disabled: (disabled || props?.rightIcon?.disabled), focused, hasValue,
|
|
79
85
|
})
|
|
80
86
|
|
|
81
87
|
const labelStyle = [
|
|
@@ -83,6 +89,7 @@ export const useInputBaseStyles = (props: InputBaseProps) => {
|
|
|
83
89
|
focused && styles['label:focus'],
|
|
84
90
|
hasError && styles['label:error'],
|
|
85
91
|
disabled && styles['label:disabled'],
|
|
92
|
+
hasValue && styles['label:typed'],
|
|
86
93
|
]
|
|
87
94
|
|
|
88
95
|
const errorStyle = [
|
|
@@ -90,6 +97,7 @@ export const useInputBaseStyles = (props: InputBaseProps) => {
|
|
|
90
97
|
focused && styles['errorMessage:focus'],
|
|
91
98
|
hasError && styles['errorMessage:error'],
|
|
92
99
|
disabled && styles['errorMessage:disabled'],
|
|
100
|
+
hasValue && styles['errorMessage:typed'],
|
|
93
101
|
]
|
|
94
102
|
|
|
95
103
|
const descriptionStyle = [
|
|
@@ -97,6 +105,7 @@ export const useInputBaseStyles = (props: InputBaseProps) => {
|
|
|
97
105
|
focused && styles['description:focus'],
|
|
98
106
|
hasError && styles['description:error'],
|
|
99
107
|
disabled && styles['description:disabled'],
|
|
108
|
+
hasValue && styles['description:typed'],
|
|
100
109
|
]
|
|
101
110
|
|
|
102
111
|
const wrapperStyle = [
|
|
@@ -104,6 +113,7 @@ export const useInputBaseStyles = (props: InputBaseProps) => {
|
|
|
104
113
|
focused && styles['wrapper:focus'],
|
|
105
114
|
error && styles['wrapper:error'],
|
|
106
115
|
disabled && styles['wrapper:disabled'],
|
|
116
|
+
hasValue && styles['wrapper:typed'],
|
|
107
117
|
]
|
|
108
118
|
|
|
109
119
|
const innerWrapperStyle = [
|
|
@@ -111,6 +121,7 @@ export const useInputBaseStyles = (props: InputBaseProps) => {
|
|
|
111
121
|
focused && styles['innerWrapper:focus'],
|
|
112
122
|
hasError && styles['innerWrapper:error'],
|
|
113
123
|
disabled && styles['innerWrapper:disabled'],
|
|
124
|
+
hasValue && styles['innerWrapper:typed'],
|
|
114
125
|
]
|
|
115
126
|
|
|
116
127
|
const labelRowStyle = [
|
|
@@ -118,9 +129,10 @@ export const useInputBaseStyles = (props: InputBaseProps) => {
|
|
|
118
129
|
focused && styles['labelRow:focus'],
|
|
119
130
|
hasError && styles['labelRow:error'],
|
|
120
131
|
disabled && styles['labelRow:disabled'],
|
|
132
|
+
hasValue && styles['labelRow:typed'],
|
|
121
133
|
]
|
|
122
134
|
|
|
123
|
-
|
|
135
|
+
return {
|
|
124
136
|
wrapperStyle,
|
|
125
137
|
innerWrapperStyle,
|
|
126
138
|
leftIconStyles,
|
|
@@ -128,6 +140,6 @@ export const useInputBaseStyles = (props: InputBaseProps) => {
|
|
|
128
140
|
labelStyle,
|
|
129
141
|
errorStyle,
|
|
130
142
|
descriptionStyle,
|
|
131
|
-
labelRowStyle
|
|
132
|
-
|
|
133
|
-
}
|
|
143
|
+
labelRowStyle,
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -83,6 +83,8 @@ export const NumberIncrement = forwardRef<NativeTextInput, NumberIncrementProps>
|
|
|
83
83
|
|
|
84
84
|
const InputElement: any = isMasked ? MaskedTextInput : isCurrency ? CurrencyInput : NativeTextInput
|
|
85
85
|
|
|
86
|
+
const hasValue = TypeGuards.isString(value) ? value.length > 0 : !TypeGuards.isNil(value)
|
|
87
|
+
|
|
86
88
|
// @ts-expect-error - React's ref type system is weird
|
|
87
89
|
useImperativeHandle(inputRef, () => {
|
|
88
90
|
return {
|
|
@@ -115,12 +117,14 @@ export const NumberIncrement = forwardRef<NativeTextInput, NumberIncrementProps>
|
|
|
115
117
|
isFocused && styles['input:focus'],
|
|
116
118
|
hasError && styles['input:error'],
|
|
117
119
|
disabled && styles['input:disabled'],
|
|
120
|
+
hasValue && styles['input:typed'],
|
|
118
121
|
]), [disabled, isFocused, hasError])
|
|
119
122
|
|
|
120
123
|
const placeholderTextColor = [
|
|
121
124
|
[disabled, styles['placeholder:disabled']],
|
|
122
125
|
[hasError, styles['placeholder:error']],
|
|
123
126
|
[isFocused, styles['placeholder:focus']],
|
|
127
|
+
[hasValue, styles['placeholder:typed']],
|
|
124
128
|
[true, styles.placeholder],
|
|
125
129
|
// @ts-expect-error
|
|
126
130
|
].find(([x]) => x)?.[1]?.color
|
|
@@ -129,6 +133,7 @@ export const NumberIncrement = forwardRef<NativeTextInput, NumberIncrementProps>
|
|
|
129
133
|
[disabled, styles['selection:disabled']],
|
|
130
134
|
[!validation.isValid, styles['selection:error']],
|
|
131
135
|
[isFocused, styles['selection:focus']],
|
|
136
|
+
[hasValue, styles['selection:typed']],
|
|
132
137
|
[true, styles.selection],
|
|
133
138
|
// @ts-expect-error
|
|
134
139
|
].find(([x]) => x)?.[1]?.color
|
|
@@ -168,9 +173,9 @@ export const NumberIncrement = forwardRef<NativeTextInput, NumberIncrementProps>
|
|
|
168
173
|
}, [value])
|
|
169
174
|
|
|
170
175
|
const handleBlur = React.useCallback((e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
171
|
-
if (TypeGuards.isNumber(max) && (value >= max)) {
|
|
176
|
+
if (TypeGuards.isNumber(max) && (Number(value) >= max)) {
|
|
172
177
|
onChange(max)
|
|
173
|
-
} else if (TypeGuards.isNumber(min) && (value <= min) ||
|
|
178
|
+
} else if (TypeGuards.isNumber(min) && (Number(value) <= min) || TypeGuards.isNil(value) || String(value)?.length <= 0) {
|
|
174
179
|
onChange(min)
|
|
175
180
|
}
|
|
176
181
|
|
|
@@ -269,6 +274,7 @@ export const NumberIncrement = forwardRef<NativeTextInput, NumberIncrementProps>
|
|
|
269
274
|
rippleDisabled: true,
|
|
270
275
|
onPress: onPressInnerWrapper,
|
|
271
276
|
}}
|
|
277
|
+
hasValue={hasValue}
|
|
272
278
|
>
|
|
273
279
|
{editable && !disabled ? (
|
|
274
280
|
<InputElement
|
|
@@ -9,10 +9,10 @@ type Masking = FormTypes.TextField['masking']
|
|
|
9
9
|
type MaskOptions = Masking['options']
|
|
10
10
|
|
|
11
11
|
export type NumberIncrementProps =
|
|
12
|
-
Omit<InputBaseProps, 'style'> &
|
|
13
|
-
Omit<RNTextInputProps, 'style'> &
|
|
12
|
+
Omit<InputBaseProps, 'style'|'value'> &
|
|
13
|
+
Omit<RNTextInputProps, 'style'|'value'> &
|
|
14
14
|
{
|
|
15
|
-
value: number
|
|
15
|
+
value: number | string
|
|
16
16
|
validate?: FormTypes.ValidatorWithoutForm<string> | yup.SchemaOf<string>
|
|
17
17
|
max?: number
|
|
18
18
|
min?: number
|
|
@@ -123,11 +123,14 @@ export const RadioGroup = <T extends string | number>(props: RadioGroupProps<T>)
|
|
|
123
123
|
// @ts-expect-error icss type
|
|
124
124
|
const _radioOnRight = radioOnRight ?? styles?.__props?.radioOnRight
|
|
125
125
|
|
|
126
|
+
const hasValue = !TypeGuards.isNil(value)
|
|
127
|
+
|
|
126
128
|
return <InputBase
|
|
127
129
|
{...inputBaseProps}
|
|
128
130
|
disabled={disabled}
|
|
129
131
|
style={styles}
|
|
130
132
|
debugName={debugName}
|
|
133
|
+
hasValue={hasValue}
|
|
131
134
|
>
|
|
132
135
|
{options?.map((item, idx) => (
|
|
133
136
|
<Option
|
|
@@ -140,6 +143,7 @@ export const RadioGroup = <T extends string | number>(props: RadioGroupProps<T>)
|
|
|
140
143
|
onSelect={() => onValueChange(item.value)}
|
|
141
144
|
separator={idx < options.length - 1}
|
|
142
145
|
reverseOrder={_radioOnRight}
|
|
146
|
+
|
|
143
147
|
/>
|
|
144
148
|
))}
|
|
145
149
|
</InputBase>
|