@webority-technologies/mobile 0.0.15 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Accordion/Accordion.js +60 -19
- package/lib/commonjs/components/AppBar/AppBar.js +29 -20
- package/lib/commonjs/components/Avatar/Avatar.js +38 -8
- package/lib/commonjs/components/Badge/Badge.js +66 -4
- package/lib/commonjs/components/Banner/Banner.js +146 -66
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +37 -15
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +78 -53
- package/lib/commonjs/components/Button/Button.js +12 -5
- package/lib/commonjs/components/Card/Card.js +106 -16
- package/lib/commonjs/components/Carousel/Carousel.js +66 -12
- package/lib/commonjs/components/Checkbox/Checkbox.js +11 -7
- package/lib/commonjs/components/Chip/Chip.js +44 -12
- package/lib/commonjs/components/DatePicker/DatePicker.js +185 -76
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +133 -59
- package/lib/commonjs/components/Dialog/Dialog.js +16 -10
- package/lib/commonjs/components/Drawer/Drawer.js +13 -10
- package/lib/commonjs/components/FieldBase/FieldBase.js +306 -0
- package/lib/commonjs/components/FieldBase/index.js +32 -0
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +69 -44
- package/lib/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
- package/lib/commonjs/components/FormField/FormField.js +3 -2
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +132 -44
- package/lib/commonjs/components/Input/Input.js +144 -181
- package/lib/commonjs/components/ListItem/ListItem.js +90 -11
- package/lib/commonjs/components/Modal/Modal.js +55 -27
- package/lib/commonjs/components/NumberInput/NumberInput.js +60 -106
- package/lib/commonjs/components/OTPInput/OTPInput.js +65 -58
- package/lib/commonjs/components/PickerTrigger/PickerTrigger.js +185 -0
- package/lib/commonjs/components/{AppIcon → PickerTrigger}/index.js +4 -4
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +19 -11
- package/lib/commonjs/components/Radio/Radio.js +11 -6
- package/lib/commonjs/components/Rating/Rating.js +85 -19
- package/lib/commonjs/components/SearchBar/SearchBar.js +84 -107
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +22 -11
- package/lib/commonjs/components/Select/Select.js +62 -91
- package/lib/commonjs/components/Skeleton/Skeleton.js +131 -174
- package/lib/commonjs/components/Skeleton/SkeletonClock.js +117 -0
- package/lib/commonjs/components/Skeleton/SkeletonContent.js +164 -81
- package/lib/commonjs/components/Skeleton/SkeletonProvider.js +72 -10
- package/lib/commonjs/components/Skeleton/index.js +17 -16
- package/lib/commonjs/components/Slider/Slider.js +44 -25
- package/lib/commonjs/components/Stepper/Stepper.js +199 -29
- package/lib/commonjs/components/Swipeable/Swipeable.js +36 -19
- package/lib/commonjs/components/Switch/Switch.js +9 -2
- package/lib/commonjs/components/Tabs/Tabs.js +84 -21
- package/lib/commonjs/components/TimePicker/TimePicker.js +123 -45
- package/lib/commonjs/components/Toast/Toast.js +27 -16
- package/lib/commonjs/components/Tooltip/Tooltip.js +56 -32
- package/lib/commonjs/components/index.js +37 -37
- package/lib/commonjs/theme/tokens.js +55 -7
- package/lib/module/components/Accordion/Accordion.js +61 -20
- package/lib/module/components/AppBar/AppBar.js +29 -20
- package/lib/module/components/Avatar/Avatar.js +39 -9
- package/lib/module/components/Badge/Badge.js +67 -5
- package/lib/module/components/Banner/Banner.js +147 -67
- package/lib/module/components/BottomNavigation/BottomNavigation.js +37 -15
- package/lib/module/components/BottomSheet/BottomSheet.js +80 -55
- package/lib/module/components/Button/Button.js +12 -5
- package/lib/module/components/Card/Card.js +107 -17
- package/lib/module/components/Carousel/Carousel.js +67 -13
- package/lib/module/components/Checkbox/Checkbox.js +11 -7
- package/lib/module/components/Chip/Chip.js +45 -13
- package/lib/module/components/DatePicker/DatePicker.js +185 -76
- package/lib/module/components/DateRangePicker/DateRangePicker.js +134 -60
- package/lib/module/components/Dialog/Dialog.js +16 -10
- package/lib/module/components/Drawer/Drawer.js +13 -10
- package/lib/module/components/FieldBase/FieldBase.js +297 -0
- package/lib/module/components/FieldBase/index.js +4 -0
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +69 -44
- package/lib/module/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
- package/lib/module/components/FormField/FormField.js +3 -2
- package/lib/module/components/ImageGallery/ImageGallery.js +128 -40
- package/lib/module/components/Input/Input.js +144 -179
- package/lib/module/components/ListItem/ListItem.js +91 -12
- package/lib/module/components/Modal/Modal.js +55 -27
- package/lib/module/components/NumberInput/NumberInput.js +60 -106
- package/lib/module/components/OTPInput/OTPInput.js +65 -58
- package/lib/module/components/PickerTrigger/PickerTrigger.js +181 -0
- package/lib/module/components/PickerTrigger/index.js +4 -0
- package/lib/module/components/ProgressBar/ProgressBar.js +19 -11
- package/lib/module/components/Radio/Radio.js +11 -6
- package/lib/module/components/Rating/Rating.js +86 -20
- package/lib/module/components/SearchBar/SearchBar.js +84 -107
- package/lib/module/components/SegmentedControl/SegmentedControl.js +22 -11
- package/lib/module/components/Select/Select.js +62 -91
- package/lib/module/components/Skeleton/Skeleton.js +135 -175
- package/lib/module/components/Skeleton/SkeletonClock.js +110 -0
- package/lib/module/components/Skeleton/SkeletonContent.js +167 -84
- package/lib/module/components/Skeleton/SkeletonProvider.js +71 -10
- package/lib/module/components/Skeleton/index.js +3 -2
- package/lib/module/components/Slider/Slider.js +44 -25
- package/lib/module/components/Stepper/Stepper.js +201 -31
- package/lib/module/components/Swipeable/Swipeable.js +36 -19
- package/lib/module/components/Switch/Switch.js +9 -2
- package/lib/module/components/Tabs/Tabs.js +84 -21
- package/lib/module/components/TimePicker/TimePicker.js +123 -45
- package/lib/module/components/Toast/Toast.js +27 -16
- package/lib/module/components/Tooltip/Tooltip.js +56 -32
- package/lib/module/components/index.js +2 -2
- package/lib/module/theme/tokens.js +55 -7
- package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +10 -5
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +8 -0
- package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +12 -6
- package/lib/typescript/commonjs/components/Badge/Badge.d.ts +7 -6
- package/lib/typescript/commonjs/components/Banner/Banner.d.ts +17 -6
- package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +17 -6
- package/lib/typescript/commonjs/components/Carousel/Carousel.d.ts +7 -6
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +9 -1
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts +13 -6
- package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +38 -3
- package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +36 -3
- package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +13 -1
- package/lib/typescript/commonjs/components/FieldBase/FieldBase.d.ts +141 -0
- package/lib/typescript/commonjs/components/FieldBase/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
- package/lib/typescript/commonjs/components/FloatingActionButton/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
- package/lib/typescript/commonjs/components/FormField/FormField.d.ts +7 -0
- package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -4
- package/lib/typescript/commonjs/components/Input/Input.d.ts +6 -0
- package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +13 -6
- package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +3 -0
- package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +57 -0
- package/lib/typescript/commonjs/components/PickerTrigger/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts +3 -0
- package/lib/typescript/commonjs/components/Rating/Rating.d.ts +9 -6
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +49 -20
- package/lib/typescript/commonjs/components/Skeleton/SkeletonClock.d.ts +60 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonContent.d.ts +80 -19
- package/lib/typescript/commonjs/components/Skeleton/SkeletonProvider.d.ts +39 -5
- package/lib/typescript/commonjs/components/Skeleton/index.d.ts +6 -4
- package/lib/typescript/commonjs/components/Slider/Slider.d.ts +12 -1
- package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +18 -6
- package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +2 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +1 -0
- package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +26 -2
- package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +36 -3
- package/lib/typescript/commonjs/components/Toast/Toast.d.ts +8 -0
- package/lib/typescript/commonjs/components/Tooltip/Tooltip.d.ts +7 -1
- package/lib/typescript/commonjs/components/index.d.ts +5 -5
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/theme/index.d.ts +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +553 -11
- package/lib/typescript/module/components/Accordion/Accordion.d.ts +10 -5
- package/lib/typescript/module/components/AppBar/AppBar.d.ts +8 -0
- package/lib/typescript/module/components/Avatar/Avatar.d.ts +12 -6
- package/lib/typescript/module/components/Badge/Badge.d.ts +7 -6
- package/lib/typescript/module/components/Banner/Banner.d.ts +17 -6
- package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/module/components/Card/Card.d.ts +17 -6
- package/lib/typescript/module/components/Carousel/Carousel.d.ts +7 -6
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +9 -1
- package/lib/typescript/module/components/Chip/Chip.d.ts +13 -6
- package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +38 -3
- package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +36 -3
- package/lib/typescript/module/components/Dialog/Dialog.d.ts +13 -1
- package/lib/typescript/module/components/FieldBase/FieldBase.d.ts +141 -0
- package/lib/typescript/module/components/FieldBase/index.d.ts +3 -0
- package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
- package/lib/typescript/module/components/FloatingActionButton/index.d.ts +1 -1
- package/lib/typescript/module/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
- package/lib/typescript/module/components/FormField/FormField.d.ts +7 -0
- package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -4
- package/lib/typescript/module/components/Input/Input.d.ts +6 -0
- package/lib/typescript/module/components/ListItem/ListItem.d.ts +13 -6
- package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +3 -0
- package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +57 -0
- package/lib/typescript/module/components/PickerTrigger/index.d.ts +3 -0
- package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/lib/typescript/module/components/Radio/Radio.d.ts +3 -0
- package/lib/typescript/module/components/Rating/Rating.d.ts +9 -6
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +49 -20
- package/lib/typescript/module/components/Skeleton/SkeletonClock.d.ts +60 -0
- package/lib/typescript/module/components/Skeleton/SkeletonContent.d.ts +80 -19
- package/lib/typescript/module/components/Skeleton/SkeletonProvider.d.ts +39 -5
- package/lib/typescript/module/components/Skeleton/index.d.ts +6 -4
- package/lib/typescript/module/components/Slider/Slider.d.ts +12 -1
- package/lib/typescript/module/components/Stepper/Stepper.d.ts +18 -6
- package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +2 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +1 -0
- package/lib/typescript/module/components/Tabs/Tabs.d.ts +26 -2
- package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +36 -3
- package/lib/typescript/module/components/Toast/Toast.d.ts +8 -0
- package/lib/typescript/module/components/Tooltip/Tooltip.d.ts +7 -1
- package/lib/typescript/module/components/index.d.ts +5 -5
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/theme/index.d.ts +1 -1
- package/lib/typescript/module/theme/types.d.ts +553 -11
- package/package.json +2 -6
- package/lib/commonjs/components/AppIcon/AppIcon.js +0 -120
- package/lib/commonjs/types/vector-icons.d.js +0 -2
- package/lib/module/components/AppIcon/AppIcon.js +0 -111
- package/lib/module/components/AppIcon/index.js +0 -4
- package/lib/module/types/vector-icons.d.js +0 -2
- package/lib/typescript/commonjs/components/AppIcon/AppIcon.d.ts +0 -20
- package/lib/typescript/commonjs/components/AppIcon/index.d.ts +0 -3
- package/lib/typescript/module/components/AppIcon/AppIcon.d.ts +0 -20
- package/lib/typescript/module/components/AppIcon/index.d.ts +0 -3
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.AppIcon = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _Feather = _interopRequireDefault(require("react-native-vector-icons/Feather"));
|
|
10
|
-
var _MaterialCommunityIcons = _interopRequireDefault(require("react-native-vector-icons/MaterialCommunityIcons"));
|
|
11
|
-
var _MaterialIcons = _interopRequireDefault(require("react-native-vector-icons/MaterialIcons"));
|
|
12
|
-
var _Ionicons = _interopRequireDefault(require("react-native-vector-icons/Ionicons"));
|
|
13
|
-
var _index = require("../../theme/index.js");
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
18
|
-
// @ts-ignore - react-native-vector-icons ships no bundled types in this version
|
|
19
|
-
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
21
|
-
// @ts-ignore - react-native-vector-icons ships no bundled types in this version
|
|
22
|
-
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
24
|
-
// @ts-ignore - react-native-vector-icons ships no bundled types in this version
|
|
25
|
-
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
27
|
-
// @ts-ignore - react-native-vector-icons ships no bundled types in this version
|
|
28
|
-
|
|
29
|
-
const sizeMap = {
|
|
30
|
-
xs: 14,
|
|
31
|
-
sm: 16,
|
|
32
|
-
md: 20,
|
|
33
|
-
lg: 24,
|
|
34
|
-
xl: 32
|
|
35
|
-
};
|
|
36
|
-
const resolveSize = size => {
|
|
37
|
-
if (typeof size === 'number') return size;
|
|
38
|
-
return sizeMap[size];
|
|
39
|
-
};
|
|
40
|
-
const resolveToneColor = (theme, tone) => {
|
|
41
|
-
switch (tone) {
|
|
42
|
-
case 'primary':
|
|
43
|
-
return theme.colors.primary;
|
|
44
|
-
case 'secondary':
|
|
45
|
-
return theme.colors.text.secondary;
|
|
46
|
-
case 'success':
|
|
47
|
-
return theme.colors.success;
|
|
48
|
-
case 'warning':
|
|
49
|
-
return theme.colors.warning;
|
|
50
|
-
case 'error':
|
|
51
|
-
return theme.colors.error;
|
|
52
|
-
case 'info':
|
|
53
|
-
return theme.colors.info;
|
|
54
|
-
case 'muted':
|
|
55
|
-
return theme.colors.text.tertiary;
|
|
56
|
-
default:
|
|
57
|
-
return theme.colors.text.primary;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const resolveFamily = family => {
|
|
61
|
-
switch (family) {
|
|
62
|
-
case 'material-community':
|
|
63
|
-
return _MaterialCommunityIcons.default;
|
|
64
|
-
case 'material':
|
|
65
|
-
return _MaterialIcons.default;
|
|
66
|
-
case 'ionicons':
|
|
67
|
-
return _Ionicons.default;
|
|
68
|
-
case 'feather':
|
|
69
|
-
default:
|
|
70
|
-
return _Feather.default;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
const AppIcon = exports.AppIcon = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
74
|
-
const {
|
|
75
|
-
name,
|
|
76
|
-
family = 'feather',
|
|
77
|
-
size = 'md',
|
|
78
|
-
color,
|
|
79
|
-
tone,
|
|
80
|
-
style,
|
|
81
|
-
accessibilityLabel,
|
|
82
|
-
testID
|
|
83
|
-
} = props;
|
|
84
|
-
const theme = (0, _index.useTheme)();
|
|
85
|
-
const styles = (0, _react.useMemo)(() => buildStyles(), []);
|
|
86
|
-
const resolvedSize = resolveSize(size);
|
|
87
|
-
const resolvedColor = color ?? resolveToneColor(theme, tone);
|
|
88
|
-
const Family = resolveFamily(family);
|
|
89
|
-
const a11yProps = accessibilityLabel ? {
|
|
90
|
-
accessibilityRole: 'image',
|
|
91
|
-
accessibilityLabel,
|
|
92
|
-
accessible: true
|
|
93
|
-
} : {
|
|
94
|
-
accessibilityElementsHidden: true,
|
|
95
|
-
importantForAccessibility: 'no'
|
|
96
|
-
};
|
|
97
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
98
|
-
ref: ref,
|
|
99
|
-
style: [styles.wrapper, {
|
|
100
|
-
width: resolvedSize,
|
|
101
|
-
height: resolvedSize
|
|
102
|
-
}, style],
|
|
103
|
-
testID: testID,
|
|
104
|
-
...a11yProps,
|
|
105
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Family, {
|
|
106
|
-
name: name,
|
|
107
|
-
size: resolvedSize,
|
|
108
|
-
color: resolvedColor
|
|
109
|
-
})
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
AppIcon.displayName = 'AppIcon';
|
|
113
|
-
const buildStyles = () => _reactNative.StyleSheet.create({
|
|
114
|
-
wrapper: {
|
|
115
|
-
alignItems: 'center',
|
|
116
|
-
justifyContent: 'center'
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
var _default = exports.default = AppIcon;
|
|
120
|
-
//# sourceMappingURL=AppIcon.js.map
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { forwardRef, useMemo } from 'react';
|
|
4
|
-
import { StyleSheet, View } from 'react-native';
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
-
// @ts-ignore - react-native-vector-icons ships no bundled types in this version
|
|
7
|
-
import Feather from 'react-native-vector-icons/Feather';
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
9
|
-
// @ts-ignore - react-native-vector-icons ships no bundled types in this version
|
|
10
|
-
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
|
-
// @ts-ignore - react-native-vector-icons ships no bundled types in this version
|
|
13
|
-
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
-
// @ts-ignore - react-native-vector-icons ships no bundled types in this version
|
|
16
|
-
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
17
|
-
import { useTheme } from "../../theme/index.js";
|
|
18
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
const sizeMap = {
|
|
20
|
-
xs: 14,
|
|
21
|
-
sm: 16,
|
|
22
|
-
md: 20,
|
|
23
|
-
lg: 24,
|
|
24
|
-
xl: 32
|
|
25
|
-
};
|
|
26
|
-
const resolveSize = size => {
|
|
27
|
-
if (typeof size === 'number') return size;
|
|
28
|
-
return sizeMap[size];
|
|
29
|
-
};
|
|
30
|
-
const resolveToneColor = (theme, tone) => {
|
|
31
|
-
switch (tone) {
|
|
32
|
-
case 'primary':
|
|
33
|
-
return theme.colors.primary;
|
|
34
|
-
case 'secondary':
|
|
35
|
-
return theme.colors.text.secondary;
|
|
36
|
-
case 'success':
|
|
37
|
-
return theme.colors.success;
|
|
38
|
-
case 'warning':
|
|
39
|
-
return theme.colors.warning;
|
|
40
|
-
case 'error':
|
|
41
|
-
return theme.colors.error;
|
|
42
|
-
case 'info':
|
|
43
|
-
return theme.colors.info;
|
|
44
|
-
case 'muted':
|
|
45
|
-
return theme.colors.text.tertiary;
|
|
46
|
-
default:
|
|
47
|
-
return theme.colors.text.primary;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const resolveFamily = family => {
|
|
51
|
-
switch (family) {
|
|
52
|
-
case 'material-community':
|
|
53
|
-
return MaterialCommunityIcons;
|
|
54
|
-
case 'material':
|
|
55
|
-
return MaterialIcons;
|
|
56
|
-
case 'ionicons':
|
|
57
|
-
return Ionicons;
|
|
58
|
-
case 'feather':
|
|
59
|
-
default:
|
|
60
|
-
return Feather;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const AppIcon = /*#__PURE__*/forwardRef((props, ref) => {
|
|
64
|
-
const {
|
|
65
|
-
name,
|
|
66
|
-
family = 'feather',
|
|
67
|
-
size = 'md',
|
|
68
|
-
color,
|
|
69
|
-
tone,
|
|
70
|
-
style,
|
|
71
|
-
accessibilityLabel,
|
|
72
|
-
testID
|
|
73
|
-
} = props;
|
|
74
|
-
const theme = useTheme();
|
|
75
|
-
const styles = useMemo(() => buildStyles(), []);
|
|
76
|
-
const resolvedSize = resolveSize(size);
|
|
77
|
-
const resolvedColor = color ?? resolveToneColor(theme, tone);
|
|
78
|
-
const Family = resolveFamily(family);
|
|
79
|
-
const a11yProps = accessibilityLabel ? {
|
|
80
|
-
accessibilityRole: 'image',
|
|
81
|
-
accessibilityLabel,
|
|
82
|
-
accessible: true
|
|
83
|
-
} : {
|
|
84
|
-
accessibilityElementsHidden: true,
|
|
85
|
-
importantForAccessibility: 'no'
|
|
86
|
-
};
|
|
87
|
-
return /*#__PURE__*/_jsx(View, {
|
|
88
|
-
ref: ref,
|
|
89
|
-
style: [styles.wrapper, {
|
|
90
|
-
width: resolvedSize,
|
|
91
|
-
height: resolvedSize
|
|
92
|
-
}, style],
|
|
93
|
-
testID: testID,
|
|
94
|
-
...a11yProps,
|
|
95
|
-
children: /*#__PURE__*/_jsx(Family, {
|
|
96
|
-
name: name,
|
|
97
|
-
size: resolvedSize,
|
|
98
|
-
color: resolvedColor
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
AppIcon.displayName = 'AppIcon';
|
|
103
|
-
const buildStyles = () => StyleSheet.create({
|
|
104
|
-
wrapper: {
|
|
105
|
-
alignItems: 'center',
|
|
106
|
-
justifyContent: 'center'
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
export { AppIcon };
|
|
110
|
-
export default AppIcon;
|
|
111
|
-
//# sourceMappingURL=AppIcon.js.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
-
export type IconFamily = 'feather' | 'material-community' | 'material' | 'ionicons';
|
|
5
|
-
export type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number;
|
|
6
|
-
export type IconTone = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | 'muted';
|
|
7
|
-
export interface AppIconProps {
|
|
8
|
-
name: string;
|
|
9
|
-
family?: IconFamily;
|
|
10
|
-
size?: IconSize;
|
|
11
|
-
color?: string;
|
|
12
|
-
tone?: IconTone;
|
|
13
|
-
style?: StyleProp<ViewStyle>;
|
|
14
|
-
accessibilityLabel?: string;
|
|
15
|
-
testID?: string;
|
|
16
|
-
}
|
|
17
|
-
declare const AppIcon: React.ForwardRefExoticComponent<AppIconProps & React.RefAttributes<View>>;
|
|
18
|
-
export { AppIcon };
|
|
19
|
-
export default AppIcon;
|
|
20
|
-
//# sourceMappingURL=AppIcon.d.ts.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
-
export type IconFamily = 'feather' | 'material-community' | 'material' | 'ionicons';
|
|
5
|
-
export type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | number;
|
|
6
|
-
export type IconTone = 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info' | 'muted';
|
|
7
|
-
export interface AppIconProps {
|
|
8
|
-
name: string;
|
|
9
|
-
family?: IconFamily;
|
|
10
|
-
size?: IconSize;
|
|
11
|
-
color?: string;
|
|
12
|
-
tone?: IconTone;
|
|
13
|
-
style?: StyleProp<ViewStyle>;
|
|
14
|
-
accessibilityLabel?: string;
|
|
15
|
-
testID?: string;
|
|
16
|
-
}
|
|
17
|
-
declare const AppIcon: React.ForwardRefExoticComponent<AppIconProps & React.RefAttributes<View>>;
|
|
18
|
-
export { AppIcon };
|
|
19
|
-
export default AppIcon;
|
|
20
|
-
//# sourceMappingURL=AppIcon.d.ts.map
|