sapo-components-ui-rn 1.1.86 → 1.1.88
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/README.md +3 -2
- package/dist/assets/images/index.d.ts +1 -1
- package/dist/assets/images/index.ts +9 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +117 -160
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +92 -138
- package/dist/index.js.map +1 -1
- package/package.json +11 -3
- package/src/.DS_Store +0 -0
- package/src/assets/images/avatar.png +0 -0
- package/src/assets/images/badge.png +0 -0
- package/src/assets/images/button-icon.png +0 -0
- package/src/assets/images/button.png +0 -0
- package/src/assets/images/checkbox.png +0 -0
- package/src/assets/images/chipbar.png +0 -0
- package/src/assets/images/counting-dot.png +0 -0
- package/src/assets/images/error.png +0 -0
- package/src/assets/images/floating-button.png +0 -0
- package/src/assets/images/image.png +0 -0
- package/src/assets/images/image_default.png +0 -0
- package/src/assets/images/index.ts +0 -1
- package/src/assets/images/info.png +0 -0
- package/src/assets/images/radio-button.png +0 -0
- package/src/assets/images/search-input.png +0 -0
- package/src/assets/images/selection-field.png +0 -0
- package/src/assets/images/success.png +0 -0
- package/src/assets/images/switch.png +0 -0
- package/src/assets/images/text-area.png +0 -0
- package/src/assets/images/text-input.png +0 -0
- package/src/assets/images/toast.png +0 -0
- package/src/assets/images/warning.png +0 -0
- package/src/assets/svg/icon-arrow-down.svg +0 -3
- package/src/assets/svg/icon-checkbox-active.svg +0 -4
- package/src/assets/svg/icon-checkbox.svg +0 -3
- package/src/assets/svg/icon-clear-text.svg +0 -4
- package/src/assets/svg/icon-close.svg +0 -3
- package/src/assets/svg/icon-del-number.svg +0 -4
- package/src/assets/svg/icon-error.svg +0 -3
- package/src/assets/svg/icon-info.svg +0 -3
- package/src/assets/svg/icon-radio-active.svg +0 -5
- package/src/assets/svg/icon-radio.svg +0 -4
- package/src/assets/svg/icon-search.svg +0 -10
- package/src/assets/svg/icon-success.svg +0 -3
- package/src/assets/svg/icon-warning.svg +0 -3
- package/src/assets/svg/index.ts +0 -29
- package/src/babel/.eslintrc +0 -7
- package/src/babel/index.js +0 -63
- package/src/components/ActivityIndicator.tsx +0 -238
- package/src/components/Avatar/index.tsx +0 -115
- package/src/components/Badge/index.tsx +0 -301
- package/src/components/Button/index.tsx +0 -312
- package/src/components/ButtonIcon/index.tsx +0 -103
- package/src/components/Checkbox/index.tsx +0 -105
- package/src/components/ChipBar/index.tsx +0 -114
- package/src/components/CountingDot/index.tsx +0 -63
- package/src/components/FloatingButton/index.tsx +0 -98
- package/src/components/Icon/index.tsx +0 -121
- package/src/components/IconSvg/index.tsx +0 -41
- package/src/components/Image/index.tsx +0 -128
- package/src/components/NumberKeyboard/index.tsx +0 -586
- package/src/components/ProgressBar.tsx +0 -272
- package/src/components/RadioButton/index.tsx +0 -93
- package/src/components/ScaleButton/index.tsx +0 -17
- package/src/components/SearchInput/index.tsx +0 -98
- package/src/components/SelectionField/index.tsx +0 -193
- package/src/components/Spacer/index.tsx +0 -28
- package/src/components/Switch/Switch.tsx +0 -151
- package/src/components/Switch/utils.ts +0 -96
- package/src/components/Tag/index.tsx +0 -113
- package/src/components/Text/index.tsx +0 -90
- package/src/components/TextInput/Addons/Outline.tsx +0 -62
- package/src/components/TextInput/Addons/Underline.tsx +0 -71
- package/src/components/TextInput/Adornment/TextInputAdornment.tsx +0 -191
- package/src/components/TextInput/Adornment/TextInputAffix.tsx +0 -212
- package/src/components/TextInput/Adornment/enums.tsx +0 -12
- package/src/components/TextInput/Adornment/types.tsx +0 -11
- package/src/components/TextInput/Adornment/utils.ts +0 -39
- package/src/components/TextInput/Label/InputLabel.tsx +0 -224
- package/src/components/TextInput/Label/LabelBackground.tsx +0 -100
- package/src/components/TextInput/TextInput.tsx +0 -617
- package/src/components/TextInput/TextInputDefault.tsx +0 -481
- package/src/components/TextInput/TextInputFlat.tsx +0 -600
- package/src/components/TextInput/TextInputNumber.tsx +0 -875
- package/src/components/TextInput/constants.tsx +0 -48
- package/src/components/TextInput/helpers.tsx +0 -537
- package/src/components/TextInput/types.tsx +0 -167
- package/src/components/Toast/ToastProvider.tsx +0 -70
- package/src/components/Toast/index.tsx +0 -283
- package/src/components/Typography/AnimatedText.tsx +0 -84
- package/src/components/Typography/StyledText.tsx +0 -53
- package/src/components/Typography/Text.tsx +0 -189
- package/src/components/Typography/types.tsx +0 -5
- package/src/components/View/index.tsx +0 -452
- package/src/components/ViewVisibleAnimated/index.tsx +0 -199
- package/src/constants.tsx +0 -16
- package/src/core/theming.tsx +0 -144
- package/src/icons/IconArrowDown.tsx +0 -14
- package/src/icons/IconCheckbox.tsx +0 -20
- package/src/icons/IconCheckboxActive.tsx +0 -18
- package/src/icons/IconClearText.tsx +0 -14
- package/src/icons/IconClose.tsx +0 -14
- package/src/icons/IconDelNumber.tsx +0 -20
- package/src/icons/IconError.tsx +0 -22
- package/src/icons/IconInfo.tsx +0 -27
- package/src/icons/IconRadio.tsx +0 -11
- package/src/icons/IconRadioActive.tsx +0 -12
- package/src/icons/IconRadioDisable.tsx +0 -12
- package/src/icons/IconSearch.tsx +0 -14
- package/src/icons/IconSuccess.tsx +0 -21
- package/src/icons/IconWarning.tsx +0 -27
- package/src/index.ts +0 -48
- package/src/index.tsx +0 -48
- package/src/styles/fonts.tsx +0 -89
- package/src/styles/overlay.tsx +0 -69
- package/src/styles/shadow.tsx +0 -47
- package/src/styles/themes/DarkTheme.tsx +0 -11
- package/src/styles/themes/LightTheme.tsx +0 -14
- package/src/styles/themes/index.ts +0 -3
- package/src/styles/themes/tokens.tsx +0 -539
- package/src/theme/blue.ts +0 -25
- package/src/theme/colors.ts +0 -21
- package/src/theme/container-styles.tsx +0 -71
- package/src/theme/dimensions.ts +0 -45
- package/src/theme/green.ts +0 -27
- package/src/theme/icon.ts +0 -7
- package/src/theme/ink.ts +0 -18
- package/src/theme/orange.ts +0 -24
- package/src/theme/purple.ts +0 -8
- package/src/theme/red.ts +0 -26
- package/src/theme/themes.tsx +0 -17
- package/src/theme/white.ts +0 -16
- package/src/theme/yellow.ts +0 -26
- package/src/types/index.ts +0 -71
- package/src/types/svg.d.ts +0 -5
- package/src/types.ts +0 -297
- package/src/types.tsx +0 -296
- package/src/utils/BackHandler/BackHandler.native.tsx +0 -3
- package/src/utils/BackHandler/BackHandler.tsx +0 -11
- package/src/utils/addEventListener.tsx +0 -56
- package/src/utils/forwardRef.tsx +0 -23
- package/src/utils/function-utils.tsx +0 -108
- package/src/utils/getContrastingColor.tsx +0 -15
- package/src/utils/hasTouchHandler.tsx +0 -23
- package/src/utils/roundLayoutSize.ts +0 -2
- package/src/utils/splitStyles.ts +0 -60
- package/src/utils/toast-manager.tsx +0 -52
- package/src/utils/useAnimatedValue.tsx +0 -9
- package/src/utils/useAnimatedValueArray.tsx +0 -13
- package/src/utils/useIsKeyboardShown.tsx +0 -55
- package/src/utils/useLayout.tsx +0 -29
- package/src/utils/useLazyRef.tsx +0 -11
package/README.md
CHANGED
|
@@ -19,9 +19,10 @@ Thư viện này yêu cầu các peer dependencies sau:
|
|
|
19
19
|
"react": ">=18.0.0",
|
|
20
20
|
"react-native": ">=0.70.0",
|
|
21
21
|
"@react-native-community/masked-view": "*",
|
|
22
|
+
"react-native-gesture-handler": "*",
|
|
23
|
+
"react-native-reanimated": "*",
|
|
22
24
|
"react-native-safe-area-context": "*",
|
|
23
|
-
"react-native-screens": "*"
|
|
24
|
-
"react-native-svg": "*"
|
|
25
|
+
"react-native-screens": "*"
|
|
25
26
|
}
|
|
26
27
|
```
|
|
27
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const getImageDefault: () => number;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
let imageDefault: number | undefined;
|
|
3
|
+
|
|
4
|
+
export const getImageDefault = (): number => {
|
|
5
|
+
if (imageDefault === undefined) {
|
|
6
|
+
imageDefault = require("./image_default.png");
|
|
7
|
+
}
|
|
8
|
+
return imageDefault;
|
|
9
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export { ThemeColors } from "./styles/themes/tokens";
|
|
|
2
2
|
export { CONSTANTS } from "./styles/themes/tokens";
|
|
3
3
|
export { ThemeColors as ThemeColorsProps } from "./types";
|
|
4
4
|
export { default as containerStyles } from "./theme/container-styles";
|
|
5
|
-
export { useTheme, ThemeProvider, DefaultTheme, adaptNavigationTheme, } from "./core/theming";
|
|
6
5
|
export * from "./styles/themes";
|
|
7
6
|
export { default as Switch } from "./components/Switch/Switch";
|
|
8
7
|
export { default as TextInput } from "./components/TextInput/TextInput";
|
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Dimensions, Platform, StyleSheet, useColorScheme, TouchableOpacity, View as View$1,
|
|
1
|
+
import { Dimensions, Platform, StyleSheet, useColorScheme, TouchableOpacity, View as View$1, Text as Text$2, Animated as Animated$1, Pressable, I18nManager, useWindowDimensions, TextInput as TextInput$1, Modal, Keyboard, ActivityIndicator, ImageBackground, Image as Image$2 } from 'react-native';
|
|
2
2
|
import * as React$3 from 'react';
|
|
3
|
-
import React__default, { forwardRef as forwardRef$1, memo,
|
|
3
|
+
import React__default, { forwardRef as forwardRef$1, memo, useCallback, useState, useEffect, useMemo, useRef, useImperativeHandle } from 'react';
|
|
4
4
|
import require$$1 from 'deepmerge';
|
|
5
|
+
import Animated, { useSharedValue, withSequence, withTiming, withSpring, useAnimatedStyle, interpolateColor, useAnimatedReaction } from 'react-native-reanimated';
|
|
5
6
|
import color from 'color';
|
|
6
7
|
import IconClose from './assets/svg/icon-close.svg';
|
|
7
8
|
import IconCheckbox from './assets/svg/icon-checkbox.svg';
|
|
@@ -722,6 +723,48 @@ var containerStyles = StyleSheet.create({
|
|
|
722
723
|
},
|
|
723
724
|
});
|
|
724
725
|
|
|
726
|
+
function configureV3Fonts(config) {
|
|
727
|
+
if (!config) {
|
|
728
|
+
return typescale;
|
|
729
|
+
}
|
|
730
|
+
var isFlatConfig = Object.keys(config).every(function (key) { return typeof config[key] !== "object"; });
|
|
731
|
+
if (isFlatConfig) {
|
|
732
|
+
return Object.fromEntries(Object.entries(typescale).map(function (_a) {
|
|
733
|
+
var variantName = _a[0], variantProperties = _a[1];
|
|
734
|
+
return [
|
|
735
|
+
variantName,
|
|
736
|
+
__assign(__assign({}, variantProperties), config),
|
|
737
|
+
];
|
|
738
|
+
}));
|
|
739
|
+
}
|
|
740
|
+
return Object.assign.apply(Object, __spreadArray([{},
|
|
741
|
+
typescale], Object.entries(config).map(function (_a) {
|
|
742
|
+
var _b;
|
|
743
|
+
var variantName = _a[0], variantProperties = _a[1];
|
|
744
|
+
return (_b = {},
|
|
745
|
+
_b[variantName] = __assign(__assign({}, typescale[variantName]), variantProperties),
|
|
746
|
+
_b);
|
|
747
|
+
}), false));
|
|
748
|
+
}
|
|
749
|
+
// eslint-disable-next-line no-redeclare
|
|
750
|
+
function configureFonts(params) {
|
|
751
|
+
var config = (params || {}).config;
|
|
752
|
+
return configureV3Fonts(config);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
var LightTheme = {
|
|
756
|
+
dark: false,
|
|
757
|
+
roundness: 8,
|
|
758
|
+
version: 3,
|
|
759
|
+
colors: ThemeColors.light.colors,
|
|
760
|
+
fonts: configureFonts(),
|
|
761
|
+
animation: {
|
|
762
|
+
scale: 1.0,
|
|
763
|
+
},
|
|
764
|
+
};
|
|
765
|
+
|
|
766
|
+
var DarkTheme = __assign(__assign({}, LightTheme), { dark: true, mode: "adaptive", version: 3, colors: ThemeColors.light.colors });
|
|
767
|
+
|
|
725
768
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
726
769
|
|
|
727
770
|
var createTheming$2 = {};
|
|
@@ -1214,60 +1257,7 @@ var createTheming = _createTheming.default;
|
|
|
1214
1257
|
|
|
1215
1258
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1216
1259
|
|
|
1217
|
-
|
|
1218
|
-
if (!config) {
|
|
1219
|
-
return typescale;
|
|
1220
|
-
}
|
|
1221
|
-
var isFlatConfig = Object.keys(config).every(function (key) { return typeof config[key] !== "object"; });
|
|
1222
|
-
if (isFlatConfig) {
|
|
1223
|
-
return Object.fromEntries(Object.entries(typescale).map(function (_a) {
|
|
1224
|
-
var variantName = _a[0], variantProperties = _a[1];
|
|
1225
|
-
return [
|
|
1226
|
-
variantName,
|
|
1227
|
-
__assign(__assign({}, variantProperties), config),
|
|
1228
|
-
];
|
|
1229
|
-
}));
|
|
1230
|
-
}
|
|
1231
|
-
return Object.assign.apply(Object, __spreadArray([{},
|
|
1232
|
-
typescale], Object.entries(config).map(function (_a) {
|
|
1233
|
-
var _b;
|
|
1234
|
-
var variantName = _a[0], variantProperties = _a[1];
|
|
1235
|
-
return (_b = {},
|
|
1236
|
-
_b[variantName] = __assign(__assign({}, typescale[variantName]), variantProperties),
|
|
1237
|
-
_b);
|
|
1238
|
-
}), false));
|
|
1239
|
-
}
|
|
1240
|
-
// eslint-disable-next-line no-redeclare
|
|
1241
|
-
function configureFonts(params) {
|
|
1242
|
-
var config = (params || {}).config;
|
|
1243
|
-
return configureV3Fonts(config);
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
var LightTheme = {
|
|
1247
|
-
dark: false,
|
|
1248
|
-
roundness: 8,
|
|
1249
|
-
version: 3,
|
|
1250
|
-
colors: ThemeColors.light.colors,
|
|
1251
|
-
fonts: configureFonts(),
|
|
1252
|
-
animation: {
|
|
1253
|
-
scale: 1.0,
|
|
1254
|
-
},
|
|
1255
|
-
};
|
|
1256
|
-
|
|
1257
|
-
var DarkTheme = __assign(__assign({}, LightTheme), { dark: true, mode: "adaptive", version: 3, colors: ThemeColors.light.colors });
|
|
1258
|
-
|
|
1259
|
-
var DefaultTheme = LightTheme;
|
|
1260
|
-
var _a = createTheming(LightTheme), BaseThemeProvider = _a.ThemeProvider; _a.withTheme; var useAppTheme = _a.useTheme;
|
|
1261
|
-
var ThemeProvider = function (_a) {
|
|
1262
|
-
var children = _a.children;
|
|
1263
|
-
var colorScheme = useColorScheme();
|
|
1264
|
-
var isDark = colorScheme === "dark";
|
|
1265
|
-
var theme = isDark ? DarkTheme : LightTheme;
|
|
1266
|
-
return React__default.createElement(BaseThemeProvider, { theme: theme }, children);
|
|
1267
|
-
};
|
|
1268
|
-
function useTheme(overrides) {
|
|
1269
|
-
return useAppTheme(overrides);
|
|
1270
|
-
}
|
|
1260
|
+
var _a = createTheming(LightTheme); _a.ThemeProvider; _a.withTheme; _a.useTheme;
|
|
1271
1261
|
var useInternalTheme = function () {
|
|
1272
1262
|
var colorScheme = useColorScheme();
|
|
1273
1263
|
var isDark = colorScheme === "dark";
|
|
@@ -1283,43 +1273,6 @@ var getTheme = function (isDark) {
|
|
|
1283
1273
|
var scheme = isDark ? "dark" : "light";
|
|
1284
1274
|
return defaultThemesByVersion[scheme];
|
|
1285
1275
|
};
|
|
1286
|
-
// eslint-disable-next-line no-redeclare
|
|
1287
|
-
function adaptNavigationTheme(themes) {
|
|
1288
|
-
var reactNavigationLight = themes.reactNavigationLight, reactNavigationDark = themes.reactNavigationDark, materialLight = themes.materialLight, materialDark = themes.materialDark;
|
|
1289
|
-
var getAdaptedTheme = function (navigationTheme, AppTheme) {
|
|
1290
|
-
return __assign(__assign({}, navigationTheme), { colors: __assign(__assign({}, navigationTheme.colors), { primary: AppTheme.colors.surfaceBrandDefault, background: AppTheme.colors.backgroundPrimary, card: AppTheme.colors.card, text: AppTheme.colors.backgroundPrimary, border: AppTheme.colors.borderPrimaryDefault, notification: AppTheme.colors.surfaceErrorDefault }) });
|
|
1291
|
-
};
|
|
1292
|
-
var AppThemes = {
|
|
1293
|
-
light: materialLight || LightTheme,
|
|
1294
|
-
dark: materialDark || DarkTheme,
|
|
1295
|
-
};
|
|
1296
|
-
if (reactNavigationLight && reactNavigationDark) {
|
|
1297
|
-
var modes = ["light", "dark"];
|
|
1298
|
-
var NavigationThemes_1 = {
|
|
1299
|
-
light: reactNavigationLight,
|
|
1300
|
-
dark: reactNavigationDark,
|
|
1301
|
-
};
|
|
1302
|
-
var _a = modes.reduce(function (prev, curr) {
|
|
1303
|
-
var _a;
|
|
1304
|
-
return __assign(__assign({}, prev), (_a = {}, _a[curr] = getAdaptedTheme(NavigationThemes_1[curr], AppThemes[curr]), _a));
|
|
1305
|
-
}, {
|
|
1306
|
-
light: reactNavigationLight,
|
|
1307
|
-
dark: reactNavigationDark,
|
|
1308
|
-
}), adaptedLight = _a.light, adaptedDark = _a.dark;
|
|
1309
|
-
return {
|
|
1310
|
-
LightTheme: adaptedLight,
|
|
1311
|
-
DarkTheme: adaptedDark,
|
|
1312
|
-
};
|
|
1313
|
-
}
|
|
1314
|
-
if (reactNavigationDark) {
|
|
1315
|
-
return {
|
|
1316
|
-
DarkTheme: getAdaptedTheme(reactNavigationDark, AppThemes.dark),
|
|
1317
|
-
};
|
|
1318
|
-
}
|
|
1319
|
-
return {
|
|
1320
|
-
LightTheme: getAdaptedTheme(reactNavigationLight, AppThemes.light),
|
|
1321
|
-
};
|
|
1322
|
-
}
|
|
1323
1276
|
|
|
1324
1277
|
var ViewCustom = forwardRef$1(function (_a, ref) {
|
|
1325
1278
|
var row = _a.row, full = _a.full, justifyCenter = _a.justifyCenter, justifyBetween = _a.justifyBetween, alignCenter = _a.alignCenter, center = _a.center, color = _a.color, backgroundColor = _a.backgroundColor, width = _a.width, height = _a.height, padding = _a.padding, paddingHorizontal = _a.paddingHorizontal, paddingVertical = _a.paddingVertical, marginHorizontal = _a.marginHorizontal, marginVertical = _a.marginVertical, paddingLeft = _a.paddingLeft, paddingRight = _a.paddingRight, paddingTop = _a.paddingTop, alignEnd = _a.alignEnd, wrap = _a.wrap, borderBottomWidth = _a.borderBottomWidth, borderBottomColor = _a.borderBottomColor, borderRadius = _a.borderRadius, borderWidth = _a.borderWidth, borderColor = _a.borderColor, style = _a.style, onPress = _a.onPress, _b = _a.activeOpacity, activeOpacity = _b === void 0 ? 0.8 : _b, children = _a.children, disabled = _a.disabled, paddingBottom = _a.paddingBottom, marginTop = _a.marginTop, marginBottom = _a.marginBottom, marginLeft = _a.marginLeft, marginRight = _a.marginRight, margin = _a.margin, borderTopWidth = _a.borderTopWidth, borderTopColor = _a.borderTopColor, borderLeftWidth = _a.borderLeftWidth, borderLeftColor = _a.borderLeftColor, borderRightWidth = _a.borderRightWidth, borderRightColor = _a.borderRightColor, pointerEvents = _a.pointerEvents, gap = _a.gap,
|
|
@@ -1529,51 +1482,47 @@ var ViewCustom = forwardRef$1(function (_a, ref) {
|
|
|
1529
1482
|
});
|
|
1530
1483
|
var View = React__default.memo(ViewCustom);
|
|
1531
1484
|
|
|
1532
|
-
var animateProgress = function (progress, toValue) {
|
|
1533
|
-
Animated.sequence([
|
|
1534
|
-
Animated.timing(progress, {
|
|
1535
|
-
toValue: toValue,
|
|
1536
|
-
duration: 150,
|
|
1537
|
-
useNativeDriver: false,
|
|
1538
|
-
}),
|
|
1539
|
-
Animated.spring(progress, {
|
|
1540
|
-
toValue: toValue,
|
|
1541
|
-
damping: 20,
|
|
1542
|
-
stiffness: 200,
|
|
1543
|
-
mass: 0.5,
|
|
1544
|
-
velocity: 0.5,
|
|
1545
|
-
useNativeDriver: false,
|
|
1546
|
-
}),
|
|
1547
|
-
]).start();
|
|
1548
|
-
};
|
|
1549
1485
|
var Switch = memo(function (_a) {
|
|
1550
1486
|
var value = _a.value, disabled = _a.disabled, onValueChange = _a.onValueChange, _b = _a.size, size = _b === void 0 ? "normal" : _b;
|
|
1551
1487
|
var theme = useInternalTheme();
|
|
1552
1488
|
var colors = theme.colors;
|
|
1553
|
-
var progress =
|
|
1554
|
-
useEffect(function () {
|
|
1555
|
-
if (value !== undefined) {
|
|
1556
|
-
animateProgress(progress, value ? 1 : 0);
|
|
1557
|
-
}
|
|
1558
|
-
}, [value, progress]);
|
|
1489
|
+
var progress = useSharedValue(value ? 1 : 0);
|
|
1559
1490
|
var handleSwitch = useCallback(function () {
|
|
1560
1491
|
if (disabled)
|
|
1561
1492
|
return;
|
|
1562
1493
|
var newValue = !value;
|
|
1563
|
-
|
|
1494
|
+
progress.value = withSequence(withTiming(newValue ? 1 : 0, {
|
|
1495
|
+
duration: 150,
|
|
1496
|
+
}), withSpring(newValue ? 1 : 0, {
|
|
1497
|
+
damping: 20,
|
|
1498
|
+
stiffness: 200,
|
|
1499
|
+
mass: 0.5,
|
|
1500
|
+
velocity: 0.5,
|
|
1501
|
+
}));
|
|
1564
1502
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
|
|
1565
|
-
}, [disabled, value, onValueChange
|
|
1566
|
-
var
|
|
1567
|
-
|
|
1568
|
-
|
|
1503
|
+
}, [disabled, value, onValueChange]);
|
|
1504
|
+
var animatedStyle = useAnimatedStyle(function () {
|
|
1505
|
+
return {
|
|
1506
|
+
transform: [{ translateX: progress.value * 20 }],
|
|
1507
|
+
};
|
|
1569
1508
|
});
|
|
1570
|
-
var backgroundColor =
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
colors.toggleBackgroundActive,
|
|
1575
|
-
],
|
|
1509
|
+
var backgroundColor = useAnimatedStyle(function () {
|
|
1510
|
+
return {
|
|
1511
|
+
backgroundColor: interpolateColor(progress.value, [0, 1], [colors.toggleBackgroundDefault, colors.toggleBackgroundActive]),
|
|
1512
|
+
};
|
|
1576
1513
|
});
|
|
1514
|
+
useAnimatedReaction(function () { return value; }, function (currentValue) {
|
|
1515
|
+
if (currentValue !== undefined) {
|
|
1516
|
+
progress.value = withSequence(withTiming(currentValue ? 1 : 0, {
|
|
1517
|
+
duration: 150,
|
|
1518
|
+
}), withSpring(currentValue ? 1 : 0, {
|
|
1519
|
+
damping: 20,
|
|
1520
|
+
stiffness: 200,
|
|
1521
|
+
mass: 0.5,
|
|
1522
|
+
velocity: 0.5,
|
|
1523
|
+
}));
|
|
1524
|
+
}
|
|
1525
|
+
}, [value]);
|
|
1577
1526
|
var getSizeSwitch = useCallback(function () {
|
|
1578
1527
|
switch (size) {
|
|
1579
1528
|
case "small":
|
|
@@ -1608,12 +1557,8 @@ var Switch = memo(function (_a) {
|
|
|
1608
1557
|
}, [size, colors]);
|
|
1609
1558
|
return (React$3.createElement(View, { row: true },
|
|
1610
1559
|
React$3.createElement(TouchableOpacity, { activeOpacity: 1, onPress: handleSwitch, disabled: disabled, style: disabled ? { opacity: 0.6 } : {} },
|
|
1611
|
-
React$3.createElement(Animated.View, { style: [styles$j.vSegment,
|
|
1612
|
-
React$3.createElement(Animated.View, { style: [
|
|
1613
|
-
styles$j.animated,
|
|
1614
|
-
{ transform: [{ translateX: translateX }] },
|
|
1615
|
-
getSizeCircle(),
|
|
1616
|
-
] })))));
|
|
1560
|
+
React$3.createElement(Animated.View, { style: [styles$j.vSegment, backgroundColor, getSizeSwitch()] },
|
|
1561
|
+
React$3.createElement(Animated.View, { style: [styles$j.animated, animatedStyle, getSizeCircle()] })))));
|
|
1617
1562
|
});
|
|
1618
1563
|
var styles$j = StyleSheet.create({
|
|
1619
1564
|
vSegment: {
|
|
@@ -1624,6 +1569,11 @@ var styles$j = StyleSheet.create({
|
|
|
1624
1569
|
},
|
|
1625
1570
|
animated: {
|
|
1626
1571
|
position: "absolute",
|
|
1572
|
+
// shadowColor: "#000000",
|
|
1573
|
+
// shadowOffset: { width: 0, height: 0 },
|
|
1574
|
+
// shadowOpacity: 0.15,
|
|
1575
|
+
// shadowRadius: BORDER_RADIUS_6,
|
|
1576
|
+
// elevation: 5,
|
|
1627
1577
|
marginHorizontal: 2,
|
|
1628
1578
|
},
|
|
1629
1579
|
});
|
|
@@ -1985,7 +1935,7 @@ var TextInputAffix = function (_a) {
|
|
|
1985
1935
|
_b);
|
|
1986
1936
|
var textColor = getTextColor({ theme: theme, disabled: disabled });
|
|
1987
1937
|
var content = (React__default.createElement(Text$2, { maxFontSizeMultiplier: maxFontSizeMultiplier, style: [{ color: textColor }, textStyle, labelStyle], onLayout: onTextLayout, testID: "".concat(testID, "-text") }, text));
|
|
1988
|
-
return (React__default.createElement(Animated.View, { style: [
|
|
1938
|
+
return (React__default.createElement(Animated$1.View, { style: [
|
|
1989
1939
|
styles$i.container,
|
|
1990
1940
|
style,
|
|
1991
1941
|
{
|
|
@@ -2053,7 +2003,7 @@ var AnimatedText = forwardRef(function AnimatedText(_a, ref) {
|
|
|
2053
2003
|
if (typeof font !== "object") {
|
|
2054
2004
|
throw new Error("Variant ".concat(variant, " was not provided properly. Valid variants are ").concat(Object.keys(theme.fonts).join(", "), "."));
|
|
2055
2005
|
}
|
|
2056
|
-
return (React$3.createElement(Animated.Text, __assign({ ref: ref }, rest, { style: [
|
|
2006
|
+
return (React$3.createElement(Animated$1.Text, __assign({ ref: ref }, rest, { style: [
|
|
2057
2007
|
font,
|
|
2058
2008
|
styles$h.text,
|
|
2059
2009
|
{ writingDirection: writingDirection, color: theme.colors.backgroundPrimary },
|
|
@@ -4650,7 +4600,7 @@ var InputLabel = function (props) {
|
|
|
4650
4600
|
// Position colored placeholder and gray placeholder on top of each other and crossfade them
|
|
4651
4601
|
// This gives the effect of animating the color, but allows us to use native driver
|
|
4652
4602
|
React__default.createElement(View$1, { pointerEvents: "none", style: [StyleSheet.absoluteFill, styles$g.overflow, styles$g.labelContainer] },
|
|
4653
|
-
React__default.createElement(Animated.View, { pointerEvents: "none", style: [
|
|
4603
|
+
React__default.createElement(Animated$1.View, { pointerEvents: "none", style: [
|
|
4654
4604
|
StyleSheet.absoluteFill,
|
|
4655
4605
|
Platform.OS !== "web" && { width: width },
|
|
4656
4606
|
{ opacity: opacity },
|
|
@@ -4912,8 +4862,8 @@ var TextInputFlat = function (_a) {
|
|
|
4912
4862
|
adjustPaddingFlat(__assign(__assign({}, paddingSettings), { pad: pad }));
|
|
4913
4863
|
var baseLabelTranslateY = -labelHalfHeight - (topPosition + MINIMIZED_LABEL_Y_OFFSET);
|
|
4914
4864
|
var placeholderOpacityAnims = React$3.useRef([
|
|
4915
|
-
new Animated.Value(0),
|
|
4916
|
-
new Animated.Value(1),
|
|
4865
|
+
new Animated$1.Value(0),
|
|
4866
|
+
new Animated$1.Value(1),
|
|
4917
4867
|
]).current;
|
|
4918
4868
|
var placeholderOpacity = hasActiveOutline
|
|
4919
4869
|
? parentState.labeled
|
|
@@ -5982,8 +5932,8 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
5982
5932
|
var theme = useInternalTheme();
|
|
5983
5933
|
var isControlled = rest.value !== undefined;
|
|
5984
5934
|
var validInputValue = isControlled ? rest.value : rest.defaultValue;
|
|
5985
|
-
var labeled = React__default.useRef(new Animated.Value(validInputValue ? 0 : 1)).current;
|
|
5986
|
-
var error = React__default.useRef(new Animated.Value(errorProp ? 1 : 0)).current;
|
|
5935
|
+
var labeled = React__default.useRef(new Animated$1.Value(validInputValue ? 0 : 1)).current;
|
|
5936
|
+
var error = React__default.useRef(new Animated$1.Value(errorProp ? 1 : 0)).current;
|
|
5987
5937
|
var _k = React__default.useState(false), focused = _k[0], setFocused = _k[1];
|
|
5988
5938
|
var _l = React__default.useState(false), displayPlaceholder = _l[0], setDisplayPlaceholder = _l[1];
|
|
5989
5939
|
var _m = React__default.useState(validInputValue), uncontrolledValue = _m[0], setUncontrolledValue = _m[1];
|
|
@@ -6023,7 +5973,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6023
5973
|
// When the input has an error, we wiggle the label and apply error styles
|
|
6024
5974
|
if (errorProp) {
|
|
6025
5975
|
// show error
|
|
6026
|
-
Animated.timing(error, {
|
|
5976
|
+
Animated$1.timing(error, {
|
|
6027
5977
|
toValue: 1,
|
|
6028
5978
|
duration: FOCUS_ANIMATION_DURATION * scale,
|
|
6029
5979
|
// To prevent this - https://github.com/callstack/react-native-paper/issues/941
|
|
@@ -6033,7 +5983,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6033
5983
|
else {
|
|
6034
5984
|
// hide error
|
|
6035
5985
|
{
|
|
6036
|
-
Animated.timing(error, {
|
|
5986
|
+
Animated$1.timing(error, {
|
|
6037
5987
|
toValue: 0,
|
|
6038
5988
|
duration: BLUR_ANIMATION_DURATION * scale,
|
|
6039
5989
|
// To prevent this - https://github.com/callstack/react-native-paper/issues/941
|
|
@@ -6073,7 +6023,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6073
6023
|
// https://github.com/callstack/react-native-paper/pull/1440
|
|
6074
6024
|
if (value || focused) {
|
|
6075
6025
|
// minimize label
|
|
6076
|
-
Animated.timing(labeled, {
|
|
6026
|
+
Animated$1.timing(labeled, {
|
|
6077
6027
|
toValue: 0,
|
|
6078
6028
|
duration: BLUR_ANIMATION_DURATION * scale,
|
|
6079
6029
|
// To prevent this - https://github.com/callstack/react-native-paper/issues/941
|
|
@@ -6082,7 +6032,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6082
6032
|
}
|
|
6083
6033
|
else {
|
|
6084
6034
|
// restore label
|
|
6085
|
-
Animated.timing(labeled, {
|
|
6035
|
+
Animated$1.timing(labeled, {
|
|
6086
6036
|
toValue: 1,
|
|
6087
6037
|
duration: FOCUS_ANIMATION_DURATION * scale,
|
|
6088
6038
|
// To prevent this - https://github.com/callstack/react-native-paper/issues/941
|
|
@@ -6397,9 +6347,9 @@ var ViewVisibleAnimated = React__default.memo(React__default.forwardRef(function
|
|
|
6397
6347
|
hide: hide,
|
|
6398
6348
|
show: show,
|
|
6399
6349
|
}); });
|
|
6400
|
-
var visibleAnimation = useRef(new Animated.Value(0)).current;
|
|
6401
|
-
var translateAnimation = useRef(new Animated.Value(0)).current;
|
|
6402
|
-
var scaleAnimation = useRef(new Animated.Value(scaleType === "in" ? 0 : 3)).current;
|
|
6350
|
+
var visibleAnimation = useRef(new Animated$1.Value(0)).current;
|
|
6351
|
+
var translateAnimation = useRef(new Animated$1.Value(0)).current;
|
|
6352
|
+
var scaleAnimation = useRef(new Animated$1.Value(scaleType === "in" ? 0 : 3)).current;
|
|
6403
6353
|
var _o = useState(false), visible = _o[0], setVisible = _o[1];
|
|
6404
6354
|
var TIME_OUT = null;
|
|
6405
6355
|
useEffect(function () {
|
|
@@ -6430,18 +6380,18 @@ var ViewVisibleAnimated = React__default.memo(React__default.forwardRef(function
|
|
|
6430
6380
|
if (position === void 0) { position = "bottom"; }
|
|
6431
6381
|
setVisible(true);
|
|
6432
6382
|
translateAnimation.setValue(position === "bottom" ? 100 : -100);
|
|
6433
|
-
Animated.parallel([
|
|
6434
|
-
Animated.timing(scaleAnimation, {
|
|
6383
|
+
Animated$1.parallel([
|
|
6384
|
+
Animated$1.timing(scaleAnimation, {
|
|
6435
6385
|
toValue: 1,
|
|
6436
6386
|
duration: duration,
|
|
6437
6387
|
useNativeDriver: true,
|
|
6438
6388
|
}),
|
|
6439
|
-
Animated.timing(visibleAnimation, {
|
|
6389
|
+
Animated$1.timing(visibleAnimation, {
|
|
6440
6390
|
toValue: 1,
|
|
6441
6391
|
duration: duration,
|
|
6442
6392
|
useNativeDriver: true,
|
|
6443
6393
|
}),
|
|
6444
|
-
Animated.timing(translateAnimation, {
|
|
6394
|
+
Animated$1.timing(translateAnimation, {
|
|
6445
6395
|
toValue: 0,
|
|
6446
6396
|
duration: duration,
|
|
6447
6397
|
useNativeDriver: true,
|
|
@@ -6462,18 +6412,18 @@ var ViewVisibleAnimated = React__default.memo(React__default.forwardRef(function
|
|
|
6462
6412
|
};
|
|
6463
6413
|
var handleHide = function (_a) {
|
|
6464
6414
|
var durationHide = _a.durationHide, callback = _a.callback, _b = _a.position, position = _b === void 0 ? "bottom" : _b;
|
|
6465
|
-
Animated.parallel([
|
|
6466
|
-
Animated.timing(scaleAnimation, {
|
|
6415
|
+
Animated$1.parallel([
|
|
6416
|
+
Animated$1.timing(scaleAnimation, {
|
|
6467
6417
|
toValue: scaleType === "in" ? 0 : 3,
|
|
6468
6418
|
duration: durationHide,
|
|
6469
6419
|
useNativeDriver: true,
|
|
6470
6420
|
}),
|
|
6471
|
-
Animated.timing(visibleAnimation, {
|
|
6421
|
+
Animated$1.timing(visibleAnimation, {
|
|
6472
6422
|
toValue: 0,
|
|
6473
6423
|
duration: durationHide,
|
|
6474
6424
|
useNativeDriver: true,
|
|
6475
6425
|
}),
|
|
6476
|
-
Animated.timing(translateAnimation, {
|
|
6426
|
+
Animated$1.timing(translateAnimation, {
|
|
6477
6427
|
toValue: position === "bottom" ? 300 : -300,
|
|
6478
6428
|
duration: durationHide,
|
|
6479
6429
|
useNativeDriver: true,
|
|
@@ -6483,7 +6433,7 @@ var ViewVisibleAnimated = React__default.memo(React__default.forwardRef(function
|
|
|
6483
6433
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
6484
6434
|
});
|
|
6485
6435
|
};
|
|
6486
|
-
return (React__default.createElement(Animated.View, { style: [
|
|
6436
|
+
return (React__default.createElement(Animated$1.View, { style: [
|
|
6487
6437
|
style,
|
|
6488
6438
|
{
|
|
6489
6439
|
opacity: visibleAnimation,
|
|
@@ -6675,7 +6625,14 @@ var styles$9 = StyleSheet.create({
|
|
|
6675
6625
|
},
|
|
6676
6626
|
});
|
|
6677
6627
|
|
|
6678
|
-
|
|
6628
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
6629
|
+
var imageDefault;
|
|
6630
|
+
var getImageDefault = function () {
|
|
6631
|
+
if (imageDefault === undefined) {
|
|
6632
|
+
imageDefault = require("./image_default.png");
|
|
6633
|
+
}
|
|
6634
|
+
return imageDefault;
|
|
6635
|
+
};
|
|
6679
6636
|
|
|
6680
6637
|
var getSource = function (source) {
|
|
6681
6638
|
var newSource = source;
|
|
@@ -6692,8 +6649,8 @@ var Image = function (props) {
|
|
|
6692
6649
|
var image = getSource(disableDefaultImage
|
|
6693
6650
|
? source
|
|
6694
6651
|
: hasError
|
|
6695
|
-
?
|
|
6696
|
-
: source ||
|
|
6652
|
+
? getImageDefault()
|
|
6653
|
+
: source || getImageDefault());
|
|
6697
6654
|
var ImageComponent = children ? ImageBackground : Image$2;
|
|
6698
6655
|
// const getUriImage = (uri: string) => {
|
|
6699
6656
|
// return uri !== null &&
|
|
@@ -7738,5 +7695,5 @@ var ToastProvider = forwardRef$1(function (_a, ref) {
|
|
|
7738
7695
|
renderToast()));
|
|
7739
7696
|
});
|
|
7740
7697
|
|
|
7741
|
-
export { Avatar, Badge, index$3 as Button, CONSTANTS, Checkbox, ChipBar, CountingDot, DarkTheme,
|
|
7698
|
+
export { Avatar, Badge, index$3 as Button, CONSTANTS, Checkbox, ChipBar, CountingDot, DarkTheme, index$2 as FloatingButton, Image$1 as Image, LightTheme, index as NumberKeyboard, RadioButton, SearchInput, index$1 as SelectionField, Spacer, Switch, Tag, Text$1 as Text, TextInput, ThemeColors, Toast, ToastProvider, View, containerStyles, showToast, toastRef };
|
|
7742
7699
|
//# sourceMappingURL=index.esm.js.map
|