@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
|
@@ -1,178 +1,122 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
37
|
-
var t = {};
|
|
38
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
-
t[p] = s[p];
|
|
40
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
-
t[p[i]] = s[p[i]];
|
|
44
|
-
}
|
|
45
|
-
return t;
|
|
46
|
-
};
|
|
47
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
-
};
|
|
50
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
exports.Spotlight = exports.useImageSpotlight = exports.useSpotlight = exports.SpotlightProvider = void 0;
|
|
52
|
-
var react_1 = __importStar(require("react"));
|
|
53
|
-
var common_1 = require("@codeleap/common");
|
|
54
|
-
var react_native_uuid_1 = __importDefault(require("react-native-uuid"));
|
|
55
|
-
var component_1 = require("./component");
|
|
56
|
-
var View_1 = require("../View");
|
|
57
|
-
var Text_1 = require("../Text");
|
|
58
|
-
var SpotlightCtx = react_1.default.createContext({});
|
|
59
|
-
var SpotlightProvider = function (_a) {
|
|
60
|
-
var children = _a.children;
|
|
61
|
-
var _b = (0, react_1.useState)({}), spotlights = _b[0], setSpotlights = _b[1];
|
|
62
|
-
var _c = (0, react_1.useState)({}), indexes = _c[0], setIndexes = _c[1];
|
|
63
|
-
var ctxValue = {
|
|
64
|
-
spotlights: spotlights,
|
|
65
|
-
setSpotlights: setSpotlights,
|
|
66
|
-
indexes: indexes,
|
|
67
|
-
setIndexes: setIndexes,
|
|
1
|
+
import React, { useContext, useState } from 'react';
|
|
2
|
+
import { deepEqual, onUpdate, TypeGuards, usePrevious, useUnmount } from '@codeleap/common';
|
|
3
|
+
import uuid from 'react-native-uuid';
|
|
4
|
+
import { ImageView } from './component';
|
|
5
|
+
import { View } from '../View';
|
|
6
|
+
import { Text } from '../Text';
|
|
7
|
+
const SpotlightCtx = React.createContext({});
|
|
8
|
+
export const SpotlightProvider = ({ children }) => {
|
|
9
|
+
const [spotlights, setSpotlights] = useState({});
|
|
10
|
+
const [indexes, setIndexes] = useState({});
|
|
11
|
+
const ctxValue = {
|
|
12
|
+
spotlights,
|
|
13
|
+
setSpotlights,
|
|
14
|
+
indexes,
|
|
15
|
+
setIndexes,
|
|
68
16
|
};
|
|
69
17
|
return <SpotlightCtx.Provider value={ctxValue}>
|
|
70
18
|
{children}
|
|
71
19
|
</SpotlightCtx.Provider>;
|
|
72
20
|
};
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var imList = Object.values(ctx.spotlights[name] || {});
|
|
21
|
+
export function useSpotlight(name) {
|
|
22
|
+
const ctx = useContext(SpotlightCtx);
|
|
23
|
+
const imList = Object.values(ctx.spotlights[name] || {});
|
|
77
24
|
return {
|
|
78
25
|
images: imList,
|
|
79
26
|
currentIndex: ctx.indexes[name],
|
|
80
|
-
set
|
|
81
|
-
|
|
82
|
-
ctx.setSpotlights(
|
|
83
|
-
|
|
84
|
-
var images = __assign({}, prev[name]);
|
|
27
|
+
set(img, id) {
|
|
28
|
+
const newId = id || uuid.v4();
|
|
29
|
+
ctx.setSpotlights((prev) => {
|
|
30
|
+
const images = { ...prev[name] };
|
|
85
31
|
if (id !== null) {
|
|
86
|
-
images[id] =
|
|
32
|
+
images[id] = {
|
|
33
|
+
...images[id],
|
|
34
|
+
source: img,
|
|
35
|
+
};
|
|
87
36
|
}
|
|
88
37
|
else {
|
|
89
|
-
|
|
38
|
+
const now = Date.now();
|
|
90
39
|
images[newId] = {
|
|
91
40
|
created: now,
|
|
92
41
|
id: newId,
|
|
93
42
|
source: img,
|
|
94
43
|
};
|
|
95
44
|
}
|
|
96
|
-
return
|
|
45
|
+
return {
|
|
46
|
+
...prev,
|
|
47
|
+
[name]: images,
|
|
48
|
+
};
|
|
97
49
|
});
|
|
98
50
|
return newId;
|
|
99
51
|
},
|
|
100
|
-
remove
|
|
101
|
-
ctx.setSpotlights(
|
|
102
|
-
|
|
103
|
-
var images = __assign({}, prev[name]);
|
|
52
|
+
remove(id) {
|
|
53
|
+
ctx.setSpotlights((prev) => {
|
|
54
|
+
const images = { ...prev[name] };
|
|
104
55
|
delete images[id];
|
|
105
|
-
return
|
|
56
|
+
return {
|
|
57
|
+
...prev,
|
|
58
|
+
[name]: images,
|
|
59
|
+
};
|
|
106
60
|
});
|
|
107
61
|
},
|
|
108
|
-
open
|
|
109
|
-
|
|
110
|
-
ctx.setIndexes(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
});
|
|
62
|
+
open(id) {
|
|
63
|
+
const newIdx = imList.findIndex(x => x.id === id);
|
|
64
|
+
ctx.setIndexes((prev) => ({
|
|
65
|
+
...prev,
|
|
66
|
+
[name]: newIdx,
|
|
67
|
+
}));
|
|
114
68
|
},
|
|
115
|
-
close
|
|
116
|
-
ctx.setIndexes(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
69
|
+
close() {
|
|
70
|
+
ctx.setIndexes((prev) => ({
|
|
71
|
+
...prev,
|
|
72
|
+
[name]: undefined,
|
|
73
|
+
}));
|
|
120
74
|
},
|
|
121
|
-
clear
|
|
122
|
-
ctx.setIndexes(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
});
|
|
126
|
-
ctx.setSpotlights(
|
|
127
|
-
|
|
128
|
-
|
|
75
|
+
clear() {
|
|
76
|
+
ctx.setIndexes((prev) => ({
|
|
77
|
+
...prev,
|
|
78
|
+
[name]: undefined,
|
|
79
|
+
}));
|
|
80
|
+
ctx.setSpotlights((prev) => {
|
|
81
|
+
return {
|
|
82
|
+
...prev,
|
|
83
|
+
[name]: {},
|
|
84
|
+
};
|
|
129
85
|
});
|
|
130
86
|
},
|
|
131
87
|
};
|
|
132
88
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
(0, common_1.onUpdate)(function () {
|
|
89
|
+
export const useImageSpotlight = (name, src) => {
|
|
90
|
+
const [id, setId] = useState(null);
|
|
91
|
+
const spotlight = useSpotlight(name);
|
|
92
|
+
const imSource = TypeGuards.isString(src) ? { uri: src } : src;
|
|
93
|
+
const prevSource = usePrevious(imSource);
|
|
94
|
+
onUpdate(() => {
|
|
140
95
|
if (!name)
|
|
141
96
|
return;
|
|
142
|
-
if (
|
|
97
|
+
if (deepEqual(prevSource, imSource))
|
|
143
98
|
return;
|
|
144
99
|
setId(spotlight.set(imSource, id));
|
|
145
100
|
}, [src, id]);
|
|
146
|
-
|
|
101
|
+
useUnmount(() => {
|
|
147
102
|
if (!name)
|
|
148
103
|
return;
|
|
149
104
|
spotlight.remove(id);
|
|
150
105
|
});
|
|
151
106
|
return {
|
|
152
|
-
onImagePressed:
|
|
107
|
+
onImagePressed: () => {
|
|
153
108
|
spotlight.open(id);
|
|
154
109
|
},
|
|
155
110
|
};
|
|
156
111
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
var Spotlight = function (props) {
|
|
163
|
-
var name = props.name, HeaderComponent = props.HeaderComponent, showFooter = props.showFooter, FooterComponent = props.FooterComponent, rest = __rest(props, ["name", "HeaderComponent", "showFooter", "FooterComponent"]);
|
|
164
|
-
var spotlight = useSpotlight(name);
|
|
165
|
-
(0, common_1.useUnmount)(function () {
|
|
112
|
+
const DefaultFooterComponent = ({ imageIndex, imagesLength }) => (<View><Text text={imageIndex + 1 + '/' + imagesLength}/></View>);
|
|
113
|
+
export const Spotlight = (props) => {
|
|
114
|
+
const { name, HeaderComponent, showFooter, FooterComponent, ...rest } = props;
|
|
115
|
+
const spotlight = useSpotlight(name);
|
|
116
|
+
useUnmount(() => {
|
|
166
117
|
spotlight.clear();
|
|
167
118
|
});
|
|
168
|
-
|
|
169
|
-
return <
|
|
170
|
-
var imageIndex = _a.imageIndex;
|
|
171
|
-
return <Footer imageIndex={imageIndex} spotlight={spotlight} imagesLength={spotlight.images.length}/>;
|
|
172
|
-
}} HeaderComponent={!!HeaderComponent ? function (_a) {
|
|
173
|
-
var imageIndex = _a.imageIndex;
|
|
174
|
-
return <HeaderComponent spotlight={spotlight} imageIndex={imageIndex}/>;
|
|
175
|
-
} : undefined}/>;
|
|
119
|
+
const Footer = showFooter ? FooterComponent || DefaultFooterComponent : (() => null);
|
|
120
|
+
return <ImageView imageIndex={spotlight.currentIndex} images={spotlight.images.map(x => x.source)} keyExtractor={(_, index) => index.toString()} onRequestClose={spotlight.close} visible={typeof spotlight.currentIndex !== 'undefined'} {...rest} FooterComponent={({ imageIndex }) => <Footer imageIndex={imageIndex} spotlight={spotlight} imagesLength={spotlight.images.length}/>} HeaderComponent={!!HeaderComponent ? ({ imageIndex }) => <HeaderComponent spotlight={spotlight} imageIndex={imageIndex}/> : undefined}/>;
|
|
176
121
|
};
|
|
177
|
-
exports.Spotlight = Spotlight;
|
|
178
122
|
//# sourceMappingURL=Spotlight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spotlight.js","sourceRoot":"","sources":["../../../src/components/ImageView/Spotlight.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Spotlight.js","sourceRoot":"","sources":["../../../src/components/ImageView/Spotlight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAc,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAA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UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,EAAG,CAAC,CACrI,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,EAAG,CAAC,CAAC,CAAC,SAAS,CAAC,EACvI,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var common_1 = require("@codeleap/common");
|
|
9
|
-
var react_native_image_viewing_1 = __importDefault(require("react-native-image-viewing"));
|
|
10
|
-
var react_native_1 = require("react-native");
|
|
11
|
-
var ImageView = function (props) {
|
|
12
|
-
(0, common_1.onUpdate)(function () {
|
|
13
|
-
react_native_1.StatusBar.setHidden(props.visible);
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { onUpdate } from '@codeleap/common';
|
|
3
|
+
import _ImageView from 'react-native-image-viewing';
|
|
4
|
+
import { StatusBar } from 'react-native';
|
|
5
|
+
export const ImageView = (props) => {
|
|
6
|
+
onUpdate(() => {
|
|
7
|
+
StatusBar.setHidden(props.visible);
|
|
14
8
|
}, [props.visible]);
|
|
15
|
-
return (<
|
|
9
|
+
return (<_ImageView doubleTapToZoomEnabled={false} presentationStyle={'overFullScreen'} {...props}/>);
|
|
16
10
|
};
|
|
17
|
-
exports.ImageView = ImageView;
|
|
18
11
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/components/ImageView/component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/components/ImageView/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAW,MAAM,kBAAkB,CAAA;AACpD,OAAO,UAAU,MAAM,4BAA4B,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAIxC,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE;IACjD,QAAQ,CAAC,GAAG,EAAE;QACZ,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;IAEnB,OAAO,CACL,CAAC,UAAU,CACT,sBAAsB,CAAC,CAAC,KAAK,CAAC,CAC9B,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,CACpC,IAAI,KAAK,CAAC,EACV,CACH,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Spotlight"), exports);
|
|
18
|
-
__exportStar(require("./component"), exports);
|
|
1
|
+
export * from './Spotlight';
|
|
2
|
+
export * from './component';
|
|
19
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ImageView/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ImageView/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
@@ -1,86 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
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.InputBase = exports.InputBaseDefaultOrder = void 0;
|
|
43
|
-
var react_1 = __importDefault(require("react"));
|
|
44
|
-
var common_1 = require("@codeleap/common");
|
|
45
|
-
var ActionIcon_1 = require("../ActionIcon");
|
|
46
|
-
var View_1 = require("../View");
|
|
47
|
-
var styles_1 = require("./styles");
|
|
48
|
-
var Text_1 = require("../Text");
|
|
49
|
-
__exportStar(require("./styles"), exports);
|
|
50
|
-
__exportStar(require("./utils"), exports);
|
|
51
|
-
__exportStar(require("./types"), exports);
|
|
52
|
-
exports.InputBaseDefaultOrder = [
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TypeGuards, getRenderedComponent } from '@codeleap/common';
|
|
3
|
+
import { ActionIcon } from '../ActionIcon';
|
|
4
|
+
import { View } from '../View';
|
|
5
|
+
import { useInputBaseStyles } from './styles';
|
|
6
|
+
import { Text } from '../Text';
|
|
7
|
+
export * from './styles';
|
|
8
|
+
export * from './utils';
|
|
9
|
+
export * from './types';
|
|
10
|
+
export const InputBaseDefaultOrder = [
|
|
53
11
|
'label',
|
|
54
12
|
'description',
|
|
55
13
|
'innerWrapper',
|
|
56
14
|
'error',
|
|
57
15
|
];
|
|
58
|
-
|
|
16
|
+
const KeyPassthrough = (props) => {
|
|
59
17
|
return <>{props.children}</>;
|
|
60
18
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
19
|
+
export const InputBase = (props) => {
|
|
20
|
+
const { children, error = null, label, description = null, leftIcon = null, rightIcon = null, wrapper: WrapperComponent, debugName, innerWrapper: InnerWrapperComponent, focused, innerWrapperProps = {}, wrapperProps = {}, disabled, order = InputBaseDefaultOrder, style, labelAsRow, hideErrorMessage, ...otherProps } = {
|
|
21
|
+
...InputBase.defaultProps,
|
|
22
|
+
...props,
|
|
23
|
+
};
|
|
24
|
+
const styles = useInputBaseStyles(props);
|
|
25
|
+
const _leftIcon = getRenderedComponent(leftIcon, ActionIcon, {
|
|
65
26
|
// @ts-ignore
|
|
66
27
|
style: styles.leftIconStyles,
|
|
67
|
-
debugName:
|
|
28
|
+
debugName: `${debugName} left icon`,
|
|
68
29
|
dismissKeyboard: false,
|
|
69
30
|
});
|
|
70
|
-
|
|
31
|
+
const _rightIcon = getRenderedComponent(rightIcon, ActionIcon, {
|
|
71
32
|
// @ts-ignore
|
|
72
33
|
style: styles.rightIconStyles,
|
|
73
|
-
debugName:
|
|
34
|
+
debugName: `${debugName} right icon`,
|
|
74
35
|
dismissKeyboard: false,
|
|
75
36
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
label: labelAsRow ? <
|
|
37
|
+
const _label = TypeGuards.isString(label) ? <Text text={label} style={styles.labelStyle}/> : label;
|
|
38
|
+
const _error = TypeGuards.isString(error) ? <Text text={error} style={styles.errorStyle}/> : error;
|
|
39
|
+
const _description = TypeGuards.isString(description) ? <Text text={description} style={styles.descriptionStyle}/> : description;
|
|
40
|
+
const parts = {
|
|
41
|
+
label: labelAsRow ? <View style={styles.labelRowStyle}>
|
|
81
42
|
{_label}
|
|
82
43
|
{_description}
|
|
83
|
-
</
|
|
44
|
+
</View> : _label,
|
|
84
45
|
description: labelAsRow ? null : _description,
|
|
85
46
|
innerWrapper: <InnerWrapperComponent style={[
|
|
86
47
|
styles.innerWrapperStyle,
|
|
@@ -89,22 +50,21 @@ var InputBase = function (props) {
|
|
|
89
50
|
{children}
|
|
90
51
|
{_rightIcon}
|
|
91
52
|
</InnerWrapperComponent>,
|
|
92
|
-
error: hideErrorMessage ? null : (_error || <
|
|
53
|
+
error: hideErrorMessage ? null : (_error || <Text text={''} style={styles.errorStyle}/>),
|
|
93
54
|
};
|
|
94
55
|
return <WrapperComponent {...otherProps} {...wrapperProps} style={styles.wrapperStyle}>
|
|
95
|
-
{order.map(
|
|
56
|
+
{order.map((key) => <KeyPassthrough key={key}>
|
|
96
57
|
{parts[key]}
|
|
97
|
-
</KeyPassthrough
|
|
58
|
+
</KeyPassthrough>)}
|
|
98
59
|
</WrapperComponent>;
|
|
99
60
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
exports.InputBase.defaultProps = {
|
|
61
|
+
InputBase.elements = ['wrapper', 'innerWrapper', 'label', 'errorMessage', 'description', 'icon', 'leftIcon', 'rightIcon'];
|
|
62
|
+
InputBase.defaultProps = {
|
|
103
63
|
disabled: false,
|
|
104
64
|
labelAsRow: false,
|
|
105
65
|
hideErrorMessage: false,
|
|
106
|
-
order:
|
|
107
|
-
wrapper:
|
|
108
|
-
innerWrapper:
|
|
66
|
+
order: InputBaseDefaultOrder,
|
|
67
|
+
wrapper: View,
|
|
68
|
+
innerWrapper: View,
|
|
109
69
|
};
|
|
110
70
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/InputBase/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/InputBase/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,UAAU,EAAmB,MAAM,eAAe,CAAA;AAC3D,OAAO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Q,CACT;MAAA,CAAC,UAAU,CACb;IAAA,EAAE,qBAAqB,CAAC;QACxB,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC/B,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAG,CACvD;KACF,CAAA;IAED,OAAO,CAAC,gBAAgB,CACtB,IAAI,UAAU,CAAC,CACf,IAAI,YAAY,CAAC,CACjB,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAE3B;IAAA,CACE,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAC1C;QAAA,CAAC,KAAK,CAAC,GAAG,CAAC,CACb;MAAA,EAAE,cAAc,CAAC,CAAC,CAGtB;EAAA,EAAE,gBAAgB,CAAC,CAAA;AACrB,CAAC,CAAA;AAED,SAAS,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAA;AAEzH,SAAS,CAAC,YAAY,GAAG;IACvB,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,KAAK;IACjB,gBAAgB,EAAE,KAAK;IACvB,KAAK,EAAE,qBAAqB;IAC5B,OAAO,EAAE,IAAI;IACb,YAAY,EAAE,IAAI;CACQ,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ActionIconParts } from
|
|
2
|
-
import { InputBaseProps } from
|
|
1
|
+
import { ActionIconParts } from '../ActionIcon';
|
|
2
|
+
import { InputBaseProps } from './types';
|
|
3
3
|
type InputIcons = 'icon' | 'leftIcon' | 'rightIcon';
|
|
4
4
|
type IconParts = ActionIconParts;
|
|
5
5
|
export type InputIconComposition = `${InputIcons}${Capitalize<IconParts>}`;
|
|
6
|
-
export type InputBaseStates = 'error' | 'focus' | 'disabled';
|
|
6
|
+
export type InputBaseStates = 'error' | 'focus' | 'disabled' | 'typed';
|
|
7
7
|
export type InputBaseParts = 'wrapper' | 'innerWrapper' | 'label' | 'errorMessage' | 'description' | 'labelRow' | InputIconComposition;
|
|
8
8
|
export type IconLessInputBaseParts = Exclude<InputBaseParts, InputIconComposition>;
|
|
9
9
|
export type InputBaseComposition = `${InputBaseParts}:${InputBaseStates}` | InputBaseParts;
|