@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/Registry.js
CHANGED
|
@@ -1,67 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.MobileStyleRegistry = void 0;
|
|
19
|
-
var styles_1 = require("@codeleap/styles");
|
|
20
|
-
var react_native_1 = require("react-native");
|
|
21
|
-
var react_native_mmkv_1 = require("react-native-mmkv");
|
|
22
|
-
var mmkvStorage = new react_native_mmkv_1.MMKV();
|
|
23
|
-
var persistor = new styles_1.StylePersistor({
|
|
24
|
-
set: function (key, value) {
|
|
25
|
-
return mmkvStorage === null || mmkvStorage === void 0 ? void 0 : mmkvStorage.set(key, value);
|
|
1
|
+
import { CodeleapStyleRegistry, StylePersistor } from '@codeleap/styles';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { MMKV } from 'react-native-mmkv';
|
|
4
|
+
const mmkvStorage = new MMKV();
|
|
5
|
+
const persistor = new StylePersistor({
|
|
6
|
+
set(key, value) {
|
|
7
|
+
return mmkvStorage?.set(key, value);
|
|
26
8
|
},
|
|
27
|
-
get
|
|
28
|
-
return mmkvStorage
|
|
9
|
+
get(key) {
|
|
10
|
+
return mmkvStorage?.getString(key);
|
|
29
11
|
},
|
|
30
|
-
del
|
|
31
|
-
return mmkvStorage
|
|
12
|
+
del(key) {
|
|
13
|
+
return mmkvStorage?.delete(key);
|
|
32
14
|
},
|
|
33
15
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_this.registerComponent(component);
|
|
16
|
+
let instance;
|
|
17
|
+
const components = [];
|
|
18
|
+
export class MobileStyleRegistry extends CodeleapStyleRegistry {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(persistor);
|
|
21
|
+
components.forEach((component) => {
|
|
22
|
+
this.registerComponent(component);
|
|
42
23
|
});
|
|
43
24
|
if (!instance) {
|
|
44
|
-
instance =
|
|
25
|
+
instance = this;
|
|
45
26
|
}
|
|
46
27
|
return instance;
|
|
47
28
|
}
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
enumerable: false,
|
|
56
|
-
configurable: true
|
|
57
|
-
});
|
|
58
|
-
MobileStyleRegistry.registerComponent = function (component) {
|
|
29
|
+
createStyle(css) {
|
|
30
|
+
return StyleSheet.create({ s: css }).s;
|
|
31
|
+
}
|
|
32
|
+
static get current() {
|
|
33
|
+
return instance;
|
|
34
|
+
}
|
|
35
|
+
static registerComponent(component) {
|
|
59
36
|
components.push(component);
|
|
60
37
|
if (instance) {
|
|
61
38
|
instance.registerComponent(component);
|
|
62
39
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
}(styles_1.CodeleapStyleRegistry));
|
|
66
|
-
exports.MobileStyleRegistry = MobileStyleRegistry;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
67
42
|
//# sourceMappingURL=Registry.js.map
|
package/dist/Registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Registry.js","sourceRoot":"","sources":["../src/Registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Registry.js","sourceRoot":"","sources":["../src/Registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,qBAAqB,EAAQ,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAA;AAE9B,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC;IACnC,GAAG,CAAC,GAAG,EAAE,KAAK;QACZ,OAAO,WAAW,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACrC,CAAC;IACD,GAAG,CAAC,GAAG;QACL,OAAO,WAAW,EAAE,SAAS,CAAC,GAAG,CAAC,CAAA;IACpC,CAAC;IACD,GAAG,CAAC,GAAG;QACL,OAAO,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,CAAA;IACjC,CAAC;CACF,CAAC,CAAA;AAEF,IAAI,QAA6B,CAAA;AAEjC,MAAM,UAAU,GAAkD,EAAE,CAAA;AAEpE,MAAM,OAAO,mBAAoB,SAAQ,qBAAqB;IAC5D;QACE,KAAK,CAAC,SAAS,CAAC,CAAA;QAEhB,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAC/B,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;QACnC,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,EAAE;YACb,QAAQ,GAAG,IAAI,CAAA;SAChB;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,WAAW,CAAC,GAAS;QACnB,OAAO,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IACxC,CAAC;IAED,MAAM,KAAK,OAAO;QAChB,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,SAA6B;QACpD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAC1B,IAAI,QAAQ,EAAE;YACZ,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;SACtC;IACH,CAAC;CACF"}
|
|
@@ -1,79 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useCompositionStyles } from '@codeleap/styles';
|
|
3
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
4
|
+
import { Badge } from '../Badge';
|
|
5
|
+
import { Icon } from '../Icon';
|
|
6
|
+
import { Touchable } from '../Touchable';
|
|
7
|
+
import { useStylesFor } from '../../hooks';
|
|
8
|
+
export * from './styles';
|
|
9
|
+
export * from './types';
|
|
10
|
+
export const ActionIcon = (props) => {
|
|
11
|
+
const { name, icon, iconProps, children, badge, badgeProps = {}, style, ...touchableProps } = {
|
|
12
|
+
...ActionIcon.defaultProps,
|
|
13
|
+
...props,
|
|
10
14
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
-
};
|
|
27
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
28
|
-
var t = {};
|
|
29
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
30
|
-
t[p] = s[p];
|
|
31
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
32
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
33
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
34
|
-
t[p[i]] = s[p[i]];
|
|
35
|
-
}
|
|
36
|
-
return t;
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.ActionIcon = void 0;
|
|
43
|
-
var react_1 = __importDefault(require("react"));
|
|
44
|
-
var styles_1 = require("@codeleap/styles");
|
|
45
|
-
var Registry_1 = require("../../Registry");
|
|
46
|
-
var Badge_1 = require("../Badge");
|
|
47
|
-
var Icon_1 = require("../Icon");
|
|
48
|
-
var Touchable_1 = require("../Touchable");
|
|
49
|
-
var hooks_1 = require("../../hooks");
|
|
50
|
-
__exportStar(require("./styles"), exports);
|
|
51
|
-
__exportStar(require("./types"), exports);
|
|
52
|
-
var ActionIcon = function (props) {
|
|
53
|
-
var _a = __assign(__assign({}, exports.ActionIcon.defaultProps), props), name = _a.name, icon = _a.icon, iconProps = _a.iconProps, children = _a.children, badge = _a.badge, _b = _a.badgeProps, badgeProps = _b === void 0 ? {} : _b, style = _a.style, touchableProps = __rest(_a, ["name", "icon", "iconProps", "children", "badge", "badgeProps", "style"]);
|
|
54
|
-
var styles = (0, hooks_1.useStylesFor)(exports.ActionIcon.styleRegistryName, style);
|
|
55
|
-
var compositionStyles = (0, styles_1.useCompositionStyles)(['badge', 'touchable'], styles);
|
|
56
|
-
return (<Touchable_1.Touchable {...touchableProps} style={compositionStyles === null || compositionStyles === void 0 ? void 0 : compositionStyles.touchable}>
|
|
57
|
-
<Icon_1.Icon name={icon !== null && icon !== void 0 ? icon : name} {...iconProps} style={[
|
|
15
|
+
const styles = useStylesFor(ActionIcon.styleRegistryName, style);
|
|
16
|
+
const compositionStyles = useCompositionStyles(['badge', 'touchable'], styles);
|
|
17
|
+
return (<Touchable {...touchableProps} style={compositionStyles?.touchable}>
|
|
18
|
+
<Icon name={icon ?? name} {...iconProps} style={[
|
|
58
19
|
styles.icon,
|
|
59
|
-
|
|
20
|
+
touchableProps?.disabled && styles['icon:disabled'],
|
|
60
21
|
]}/>
|
|
61
22
|
|
|
62
23
|
{children}
|
|
63
24
|
|
|
64
|
-
<
|
|
65
|
-
</
|
|
25
|
+
<Badge badge={badge} {...badgeProps} style={compositionStyles?.badge}/>
|
|
26
|
+
</Touchable>);
|
|
66
27
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return exports.ActionIcon;
|
|
28
|
+
ActionIcon.styleRegistryName = 'ActionIcon';
|
|
29
|
+
ActionIcon.elements = ['icon', 'touchable', 'badge'];
|
|
30
|
+
ActionIcon.rootElement = 'touchableWrapper';
|
|
31
|
+
ActionIcon.withVariantTypes = (styles) => {
|
|
32
|
+
return ActionIcon;
|
|
73
33
|
};
|
|
74
|
-
|
|
34
|
+
ActionIcon.defaultProps = {
|
|
75
35
|
hitSlop: 10,
|
|
76
36
|
badge: false,
|
|
77
37
|
};
|
|
78
|
-
|
|
38
|
+
MobileStyleRegistry.registerComponent(ActionIcon);
|
|
79
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ActionIcon/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ActionIcon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAyC,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IACnD,MAAM,EACJ,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,UAAU,GAAG,EAAE,EACf,KAAK,EACL,GAAG,cAAc,EAClB,GAAG;QACF,GAAG,UAAU,CAAC,YAAY;QAC1B,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAEhE,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,CAAA;IAE9E,OAAO,CACL,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,SAAS,CAAC,CACjE;MAAA,CAAC,IAAI,CACH,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,CACnB,IAAI,SAAS,CAAC,CACd,KAAK,CAAC,CAAC;YACL,MAAM,CAAC,IAAI;YACX,cAAc,EAAE,QAAQ,IAAI,MAAM,CAAC,eAAe,CAAC;SACpD,CAAC,EAGJ;;MAAA,CAAC,QAAQ,CAET;;MAAA,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,iBAAiB,EAAE,KAAK,CAAC,EACvE;IAAA,EAAE,SAAS,CAAC,CACb,CAAA;AACH,CAAC,CAAA;AAED,UAAU,CAAC,iBAAiB,GAAG,YAAY,CAAA;AAC3C,UAAU,CAAC,QAAQ,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;AACpD,UAAU,CAAC,WAAW,GAAG,kBAAkB,CAAA;AAE3C,UAAU,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC/D,OAAO,UAAmF,CAAA;AAC5F,CAAC,CAAA;AAED,UAAU,CAAC,YAAY,GAAG;IACxB,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,KAAK;CACe,CAAA;AAE7B,mBAAmB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAA"}
|
|
@@ -1,66 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActivityIndicator as RNActivityIndicator } from 'react-native';
|
|
3
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
4
|
+
import { useStylesFor } from '../../hooks';
|
|
5
|
+
export * from './styles';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export const ActivityIndicator = (props) => {
|
|
8
|
+
const { style, component: Component = RNActivityIndicator, ...rest } = {
|
|
9
|
+
...ActivityIndicator.defaultProps,
|
|
10
|
+
...props,
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
+
const styles = useStylesFor(ActivityIndicator.styleRegistryName, style);
|
|
13
|
+
const wrapperStyle = styles?.wrapper;
|
|
14
|
+
const color = wrapperStyle?.color || '#000';
|
|
15
|
+
const size = (wrapperStyle?.height || wrapperStyle?.width || 'large');
|
|
16
|
+
return (<Component size={size} color={color} {...rest} style={styles?.wrapper}/>);
|
|
12
17
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
ActivityIndicator.styleRegistryName = 'ActivityIndicator';
|
|
19
|
+
ActivityIndicator.elements = ['wrapper'];
|
|
20
|
+
ActivityIndicator.rootElement = 'wrapper';
|
|
21
|
+
ActivityIndicator.defaultProps = {};
|
|
22
|
+
ActivityIndicator.withVariantTypes = (styles) => {
|
|
23
|
+
return ActivityIndicator;
|
|
26
24
|
};
|
|
27
|
-
|
|
28
|
-
var t = {};
|
|
29
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
30
|
-
t[p] = s[p];
|
|
31
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
32
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
33
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
34
|
-
t[p[i]] = s[p[i]];
|
|
35
|
-
}
|
|
36
|
-
return t;
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.ActivityIndicator = void 0;
|
|
43
|
-
var react_1 = __importDefault(require("react"));
|
|
44
|
-
var react_native_1 = require("react-native");
|
|
45
|
-
var Registry_1 = require("../../Registry");
|
|
46
|
-
var hooks_1 = require("../../hooks");
|
|
47
|
-
__exportStar(require("./styles"), exports);
|
|
48
|
-
__exportStar(require("./types"), exports);
|
|
49
|
-
var ActivityIndicator = function (props) {
|
|
50
|
-
var _a = __assign(__assign({}, exports.ActivityIndicator.defaultProps), props), style = _a.style, _b = _a.component, Component = _b === void 0 ? react_native_1.ActivityIndicator : _b, rest = __rest(_a, ["style", "component"]);
|
|
51
|
-
var styles = (0, hooks_1.useStylesFor)(exports.ActivityIndicator.styleRegistryName, style);
|
|
52
|
-
var wrapperStyle = styles === null || styles === void 0 ? void 0 : styles.wrapper;
|
|
53
|
-
var color = (wrapperStyle === null || wrapperStyle === void 0 ? void 0 : wrapperStyle.color) || '#000';
|
|
54
|
-
var size = ((wrapperStyle === null || wrapperStyle === void 0 ? void 0 : wrapperStyle.height) || (wrapperStyle === null || wrapperStyle === void 0 ? void 0 : wrapperStyle.width) || 'large');
|
|
55
|
-
return (<Component size={size} color={color} {...rest} style={styles === null || styles === void 0 ? void 0 : styles.wrapper}/>);
|
|
56
|
-
};
|
|
57
|
-
exports.ActivityIndicator = ActivityIndicator;
|
|
58
|
-
exports.ActivityIndicator.styleRegistryName = 'ActivityIndicator';
|
|
59
|
-
exports.ActivityIndicator.elements = ['wrapper'];
|
|
60
|
-
exports.ActivityIndicator.rootElement = 'wrapper';
|
|
61
|
-
exports.ActivityIndicator.defaultProps = {};
|
|
62
|
-
exports.ActivityIndicator.withVariantTypes = function (styles) {
|
|
63
|
-
return exports.ActivityIndicator;
|
|
64
|
-
};
|
|
65
|
-
Registry_1.MobileStyleRegistry.registerComponent(exports.ActivityIndicator);
|
|
25
|
+
MobileStyleRegistry.registerComponent(ActivityIndicator);
|
|
66
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ActivityIndicator/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ActivityIndicator/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAA;AAC5C,OAAO,EAAE,iBAAiB,IAAI,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAA6D,KAAgC,EAAE,EAAE;IAChI,MAAM,EACJ,KAAK,EACL,SAAS,EAAE,SAAS,GAAG,mBAAmB,EAC1C,GAAG,IAAI,EACR,GAAG;QACF,GAAG,iBAAiB,CAAC,YAAY;QACjC,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAEvE,MAAM,YAAY,GAAG,MAAM,EAAE,OAAwB,CAAA;IAErD,MAAM,KAAK,GAAG,YAAY,EAAE,KAAK,IAAI,MAAM,CAAA;IAC3C,MAAM,IAAI,GAAG,CAAC,YAAY,EAAE,MAAM,IAAI,YAAY,EAAE,KAAK,IAAI,OAAO,CAAW,CAAA;IAE/E,OAAO,CACL,CAAC,SAAS,CACR,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,IAAI,IAAI,CAAC,CACT,KAAK,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,EACvB,CACH,CAAA;AACH,CAAC,CAAA;AAED,iBAAiB,CAAC,iBAAiB,GAAG,mBAAmB,CAAA;AACzD,iBAAiB,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;AACxC,iBAAiB,CAAC,WAAW,GAAG,SAAS,CAAA;AACzC,iBAAiB,CAAC,YAAY,GAAG,EAA8B,CAAA;AAE/D,iBAAiB,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACtE,OAAO,iBAAkK,CAAA;AAC3K,CAAC,CAAA;AAED,mBAAmB,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAA"}
|
|
@@ -1,152 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(o, k2, desc);
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
-
}) : function(o, v) {
|
|
27
|
-
o["default"] = v;
|
|
28
|
-
});
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
-
__setModuleDefault(result, mod);
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
37
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
38
|
-
};
|
|
39
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
40
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
41
|
-
if (ar || !(i in from)) {
|
|
42
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
43
|
-
ar[i] = from[i];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
47
|
-
};
|
|
48
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
-
exports.Autocomplete = void 0;
|
|
50
|
-
var react_1 = __importStar(require("react"));
|
|
51
|
-
var common_1 = require("@codeleap/common");
|
|
52
|
-
var List_1 = require("../List");
|
|
53
|
-
var SearchInput_1 = require("../SearchInput");
|
|
54
|
-
var Button_1 = require("../Button");
|
|
55
|
-
var View_1 = require("../View");
|
|
56
|
-
var styles_1 = require("@codeleap/styles");
|
|
57
|
-
var Registry_1 = require("../../Registry");
|
|
58
|
-
var hooks_1 = require("../../hooks");
|
|
59
|
-
__exportStar(require("./styles"), exports);
|
|
60
|
-
__exportStar(require("./types"), exports);
|
|
61
|
-
var defaultFilterFunction = function (search, options) {
|
|
62
|
-
return options.filter(function (option) {
|
|
63
|
-
if (common_1.TypeGuards.isString(option.label)) {
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { TypeGuards, onMount, useSearch } from '@codeleap/common';
|
|
3
|
+
import { List } from '../List';
|
|
4
|
+
import { SearchInput } from '../SearchInput';
|
|
5
|
+
import { Button } from '../Button';
|
|
6
|
+
import { View } from '../View';
|
|
7
|
+
import { useCompositionStyles } from '@codeleap/styles';
|
|
8
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
9
|
+
import { useStylesFor } from '../../hooks';
|
|
10
|
+
export * from './styles';
|
|
11
|
+
export * from './types';
|
|
12
|
+
const defaultFilterFunction = (search, options) => {
|
|
13
|
+
return options.filter((option) => {
|
|
14
|
+
if (TypeGuards.isString(option.label)) {
|
|
64
15
|
return option.label.toLowerCase().includes(search.toLowerCase());
|
|
65
16
|
}
|
|
66
17
|
return option.label === search;
|
|
67
18
|
});
|
|
68
19
|
};
|
|
69
|
-
|
|
70
|
-
if (
|
|
20
|
+
const defaultGetLabel = (option) => {
|
|
21
|
+
if (TypeGuards.isArray(option)) {
|
|
71
22
|
if (option.length === 0)
|
|
72
23
|
return null;
|
|
73
|
-
return option.map(
|
|
24
|
+
return option.map(o => o.label).join(', ');
|
|
74
25
|
}
|
|
75
26
|
else {
|
|
76
27
|
if (!option)
|
|
77
28
|
return null;
|
|
78
|
-
return option
|
|
29
|
+
return option?.label;
|
|
79
30
|
}
|
|
80
31
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
32
|
+
export const Autocomplete = (autocomplete) => {
|
|
33
|
+
const allProps = {
|
|
34
|
+
...Autocomplete.defaultProps,
|
|
35
|
+
...autocomplete,
|
|
36
|
+
};
|
|
37
|
+
const { value, onValueChange, options = [], renderItem, debugName, placeholder, itemProps = {}, searchable, loadOptions, multiple, limit = null, defaultOptions = options, onLoadOptionsError, selectedIcon, loadOptionsOnMount = defaultOptions.length === 0, selectable, searchComponent, filterItems = defaultFilterFunction, searchInputProps: searchProps = {}, onItemPressed = () => { }, listPlaceholder, style, loading: loadingProp = false, listProps = {}, } = allProps;
|
|
38
|
+
const isValueArray = TypeGuards.isArray(value) && multiple;
|
|
39
|
+
const { loading, setLoading, labelOptions, setLabelOptions, filteredOptions, load, onChangeSearch, } = useSearch({
|
|
40
|
+
value,
|
|
41
|
+
multiple,
|
|
42
|
+
options,
|
|
43
|
+
filterItems,
|
|
44
|
+
debugName,
|
|
45
|
+
defaultOptions,
|
|
46
|
+
loadOptions,
|
|
47
|
+
onLoadOptionsError,
|
|
48
|
+
});
|
|
49
|
+
onMount(() => {
|
|
96
50
|
if (loadOptionsOnMount && !!loadOptions) {
|
|
97
51
|
load();
|
|
98
52
|
}
|
|
99
53
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
54
|
+
const styles = useStylesFor(Autocomplete.styleRegistryName, style);
|
|
55
|
+
const compositionStyles = useCompositionStyles(['item', 'list', 'searchInput'], styles);
|
|
56
|
+
const currentOptions = searchable ? filteredOptions : defaultOptions;
|
|
57
|
+
const select = (selectedValue) => {
|
|
58
|
+
let newValue = null;
|
|
59
|
+
let newOption = null;
|
|
60
|
+
let removedIndex = null;
|
|
107
61
|
if (multiple && isValueArray) {
|
|
108
62
|
if (value.includes(selectedValue)) {
|
|
109
|
-
removedIndex = value.findIndex(
|
|
110
|
-
newValue = value.filter(
|
|
63
|
+
removedIndex = value.findIndex(v => v === selectedValue);
|
|
64
|
+
newValue = value.filter((v, i) => i !== removedIndex);
|
|
111
65
|
}
|
|
112
66
|
else {
|
|
113
|
-
if (
|
|
67
|
+
if (TypeGuards.isNumber(limit) && value.length >= limit) {
|
|
114
68
|
return;
|
|
115
69
|
}
|
|
116
|
-
newOption = currentOptions.find(
|
|
117
|
-
newValue =
|
|
70
|
+
newOption = currentOptions.find(o => o.value === selectedValue);
|
|
71
|
+
newValue = [...value, selectedValue];
|
|
118
72
|
}
|
|
119
73
|
}
|
|
120
74
|
else {
|
|
121
75
|
newValue = selectedValue;
|
|
122
|
-
newOption = currentOptions.find(
|
|
76
|
+
newOption = currentOptions.find(o => o.value === selectedValue);
|
|
123
77
|
}
|
|
124
78
|
onValueChange(newValue);
|
|
125
79
|
if (isValueArray) {
|
|
126
80
|
if (removedIndex !== null) {
|
|
127
|
-
|
|
81
|
+
const newOptions = [...labelOptions];
|
|
128
82
|
newOptions.splice(removedIndex, 1);
|
|
129
83
|
setLabelOptions(newOptions);
|
|
130
84
|
}
|
|
131
85
|
else {
|
|
132
|
-
setLabelOptions(
|
|
86
|
+
setLabelOptions([...labelOptions, newOption]);
|
|
133
87
|
}
|
|
134
88
|
}
|
|
135
89
|
else {
|
|
136
90
|
setLabelOptions([newOption]);
|
|
137
91
|
}
|
|
138
92
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
var selected = false;
|
|
93
|
+
const Item = renderItem || Button;
|
|
94
|
+
const renderListItem = useCallback(({ item }) => {
|
|
95
|
+
let selected = false;
|
|
143
96
|
if (multiple && isValueArray) {
|
|
144
|
-
selected = value
|
|
97
|
+
selected = value?.includes(item.value);
|
|
145
98
|
}
|
|
146
99
|
else {
|
|
147
100
|
selected = value === item.value;
|
|
148
101
|
}
|
|
149
|
-
return <Item debugName={
|
|
102
|
+
return <Item debugName={`${debugName} item ${item.value}`} selected={selectable ? selected : false} text={item.label} item={item} onPress={() => {
|
|
150
103
|
onItemPressed(item);
|
|
151
104
|
if (selectable) {
|
|
152
105
|
select(item.value);
|
|
@@ -155,38 +108,37 @@ var Autocomplete = function (autocomplete) {
|
|
|
155
108
|
// @ts-ignore
|
|
156
109
|
rightIcon={selectedIcon}
|
|
157
110
|
// @ts-ignore
|
|
158
|
-
icon={selectedIcon} style={compositionStyles
|
|
111
|
+
icon={selectedIcon} style={compositionStyles?.item} {...itemProps}/>;
|
|
159
112
|
}, [value, select, multiple, selectable, isValueArray]);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
return <
|
|
163
|
-
<Search placeholder={placeholder} debugName={debugName} onTypingChange={
|
|
113
|
+
const Search = searchComponent;
|
|
114
|
+
const showLoading = TypeGuards.isFunction(loadingProp) ? loadingProp(loading) : (loadingProp || loading);
|
|
115
|
+
return <View style={styles?.wrapper}>
|
|
116
|
+
<Search placeholder={placeholder} debugName={debugName} onTypingChange={(isTyping) => {
|
|
164
117
|
if (searchable && !!loadOptions && isTyping) {
|
|
165
118
|
setLoading(isTyping);
|
|
166
119
|
}
|
|
167
|
-
}} debounce={!!loadOptions ? 800 : null} onSearchChange={onChangeSearch} hideErrorMessage {...searchProps} style={compositionStyles
|
|
120
|
+
}} debounce={!!loadOptions ? 800 : null} onSearchChange={onChangeSearch} hideErrorMessage {...searchProps} style={compositionStyles?.searchInput}/>
|
|
168
121
|
|
|
169
|
-
<
|
|
122
|
+
<List data={searchable ? filteredOptions : options} scrollEnabled={false} showsHorizontalScrollIndicator={false} style={compositionStyles?.list}
|
|
170
123
|
// @ts-ignore
|
|
171
|
-
keyExtractor={
|
|
172
|
-
</
|
|
124
|
+
keyExtractor={(i) => i.value} renderItem={renderListItem} loading={showLoading} placeholder={listPlaceholder} keyboardAware={false} {...listProps}/>
|
|
125
|
+
</View>;
|
|
173
126
|
};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return exports.Autocomplete;
|
|
127
|
+
Autocomplete.styleRegistryName = 'Autocomplete';
|
|
128
|
+
Autocomplete.elements = ['wrapper', 'list', 'item', 'searchInput'];
|
|
129
|
+
Autocomplete.rootElement = 'wrapper';
|
|
130
|
+
Autocomplete.withVariantTypes = (styles) => {
|
|
131
|
+
return Autocomplete;
|
|
180
132
|
};
|
|
181
|
-
|
|
133
|
+
Autocomplete.defaultProps = {
|
|
182
134
|
getLabel: defaultGetLabel,
|
|
183
135
|
searchInputProps: {},
|
|
184
136
|
selectedIcon: 'check',
|
|
185
|
-
searchComponent:
|
|
137
|
+
searchComponent: SearchInput,
|
|
186
138
|
placeholder: 'Select',
|
|
187
139
|
searchable: true,
|
|
188
140
|
multiple: false,
|
|
189
141
|
selectable: false,
|
|
190
142
|
};
|
|
191
|
-
|
|
143
|
+
MobileStyleRegistry.registerComponent(Autocomplete);
|
|
192
144
|
//# sourceMappingURL=index.js.map
|