sapo-components-ui-rn 1.1.84 → 1.1.87
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 +7 -6
- package/dist/components/Toast/ToastProvider.d.ts +1 -1
- package/dist/core/theming.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.esm.js +118 -175
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +92 -154
- package/dist/index.js.map +1 -1
- package/dist/styles/themes/tokens.d.ts +2 -4
- package/dist/theme/dimensions.d.ts +0 -2
- package/package.json +11 -6
- 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 -171
- 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,21 +19,22 @@ 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": "*",
|
|
24
22
|
"react-native-safe-area-context": "*",
|
|
25
|
-
"react-native-screens": "*"
|
|
23
|
+
"react-native-screens": "*",
|
|
24
|
+
"react-native-svg": "*"
|
|
26
25
|
}
|
|
27
26
|
```
|
|
28
27
|
|
|
29
28
|
## Sử dụng
|
|
30
29
|
|
|
31
30
|
```tsx
|
|
32
|
-
import { Button } from '
|
|
31
|
+
import { Button, ToastProvider } from 'sapo-components-ui-rn';
|
|
33
32
|
|
|
34
|
-
function
|
|
33
|
+
function App() {
|
|
35
34
|
return (
|
|
36
|
-
<
|
|
35
|
+
<ToastProvider>
|
|
36
|
+
<Button title="My Button" onPress={() => {}} />
|
|
37
|
+
</ToastProvider>
|
|
37
38
|
);
|
|
38
39
|
}
|
|
39
40
|
```
|
package/dist/core/theming.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const ThemeProvider: ({ children }: {
|
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}) => React.JSX.Element;
|
|
9
9
|
export declare function useTheme<T = AppTheme>(overrides?: $DeepPartial<T>): T;
|
|
10
|
-
export declare const useInternalTheme: () =>
|
|
10
|
+
export declare const useInternalTheme: () => InternalTheme;
|
|
11
11
|
export declare const withInternalTheme: <Props extends {
|
|
12
12
|
theme: InternalTheme;
|
|
13
13
|
}, C>(WrappedComponent: ComponentType<Props & {
|
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,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Platform, StyleSheet, Dimensions, TouchableOpacity, View as View$1, Animated, Text as Text$2, 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, useRef, useEffect, useCallback, useState, useMemo, useImperativeHandle } from 'react';
|
|
4
4
|
import require$$1 from 'deepmerge';
|
|
5
|
-
import Animated, { useSharedValue, withSequence, withTiming, withSpring, useAnimatedStyle, interpolateColor, useAnimatedReaction } from 'react-native-reanimated';
|
|
6
5
|
import color from 'color';
|
|
7
6
|
import IconClose from './assets/svg/icon-close.svg';
|
|
8
7
|
import IconCheckbox from './assets/svg/icon-checkbox.svg';
|
|
@@ -224,8 +223,7 @@ var yellow = {
|
|
|
224
223
|
YELLOW_STATUS: YELLOW_STATUS,
|
|
225
224
|
};
|
|
226
225
|
|
|
227
|
-
var
|
|
228
|
-
var DEVICE_WIDTH = Dimensions.get("window").width;
|
|
226
|
+
var getWindowDimensions = function () { return Dimensions.get("window"); };
|
|
229
227
|
var ref = {
|
|
230
228
|
palette: {
|
|
231
229
|
dark: {
|
|
@@ -604,8 +602,12 @@ var typescale = {
|
|
|
604
602
|
};
|
|
605
603
|
var ThemeColors = ref.palette;
|
|
606
604
|
var CONSTANTS = {
|
|
607
|
-
DEVICE_HEIGHT
|
|
608
|
-
|
|
605
|
+
get DEVICE_HEIGHT() {
|
|
606
|
+
return getWindowDimensions().height;
|
|
607
|
+
},
|
|
608
|
+
get DEVICE_WIDTH() {
|
|
609
|
+
return getWindowDimensions().width;
|
|
610
|
+
},
|
|
609
611
|
HEADER_HEIGHT: 50,
|
|
610
612
|
BUTTON_HEIGHT: 48,
|
|
611
613
|
BUTTON_HEIGHT_SMALL: 36,
|
|
@@ -723,6 +725,48 @@ var containerStyles = StyleSheet.create({
|
|
|
723
725
|
},
|
|
724
726
|
});
|
|
725
727
|
|
|
728
|
+
function configureV3Fonts(config) {
|
|
729
|
+
if (!config) {
|
|
730
|
+
return typescale;
|
|
731
|
+
}
|
|
732
|
+
var isFlatConfig = Object.keys(config).every(function (key) { return typeof config[key] !== "object"; });
|
|
733
|
+
if (isFlatConfig) {
|
|
734
|
+
return Object.fromEntries(Object.entries(typescale).map(function (_a) {
|
|
735
|
+
var variantName = _a[0], variantProperties = _a[1];
|
|
736
|
+
return [
|
|
737
|
+
variantName,
|
|
738
|
+
__assign(__assign({}, variantProperties), config),
|
|
739
|
+
];
|
|
740
|
+
}));
|
|
741
|
+
}
|
|
742
|
+
return Object.assign.apply(Object, __spreadArray([{},
|
|
743
|
+
typescale], Object.entries(config).map(function (_a) {
|
|
744
|
+
var _b;
|
|
745
|
+
var variantName = _a[0], variantProperties = _a[1];
|
|
746
|
+
return (_b = {},
|
|
747
|
+
_b[variantName] = __assign(__assign({}, typescale[variantName]), variantProperties),
|
|
748
|
+
_b);
|
|
749
|
+
}), false));
|
|
750
|
+
}
|
|
751
|
+
// eslint-disable-next-line no-redeclare
|
|
752
|
+
function configureFonts(params) {
|
|
753
|
+
var config = (params || {}).config;
|
|
754
|
+
return configureV3Fonts(config);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
var LightTheme = {
|
|
758
|
+
dark: false,
|
|
759
|
+
roundness: 8,
|
|
760
|
+
version: 3,
|
|
761
|
+
colors: ThemeColors.light.colors,
|
|
762
|
+
fonts: configureFonts(),
|
|
763
|
+
animation: {
|
|
764
|
+
scale: 1.0,
|
|
765
|
+
},
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
var DarkTheme = __assign(__assign({}, LightTheme), { dark: true, mode: "adaptive", version: 3, colors: ThemeColors.light.colors });
|
|
769
|
+
|
|
726
770
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
727
771
|
|
|
728
772
|
var createTheming$2 = {};
|
|
@@ -1215,112 +1259,10 @@ var createTheming = _createTheming.default;
|
|
|
1215
1259
|
|
|
1216
1260
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1217
1261
|
|
|
1218
|
-
|
|
1219
|
-
if (!config) {
|
|
1220
|
-
return typescale;
|
|
1221
|
-
}
|
|
1222
|
-
var isFlatConfig = Object.keys(config).every(function (key) { return typeof config[key] !== "object"; });
|
|
1223
|
-
if (isFlatConfig) {
|
|
1224
|
-
return Object.fromEntries(Object.entries(typescale).map(function (_a) {
|
|
1225
|
-
var variantName = _a[0], variantProperties = _a[1];
|
|
1226
|
-
return [
|
|
1227
|
-
variantName,
|
|
1228
|
-
__assign(__assign({}, variantProperties), config),
|
|
1229
|
-
];
|
|
1230
|
-
}));
|
|
1231
|
-
}
|
|
1232
|
-
return Object.assign.apply(Object, __spreadArray([{},
|
|
1233
|
-
typescale], Object.entries(config).map(function (_a) {
|
|
1234
|
-
var _b;
|
|
1235
|
-
var variantName = _a[0], variantProperties = _a[1];
|
|
1236
|
-
return (_b = {},
|
|
1237
|
-
_b[variantName] = __assign(__assign({}, typescale[variantName]), variantProperties),
|
|
1238
|
-
_b);
|
|
1239
|
-
}), false));
|
|
1240
|
-
}
|
|
1241
|
-
// eslint-disable-next-line no-redeclare
|
|
1242
|
-
function configureFonts(params) {
|
|
1243
|
-
var config = (params || {}).config;
|
|
1244
|
-
return configureV3Fonts(config);
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
var LightTheme = {
|
|
1248
|
-
dark: false,
|
|
1249
|
-
roundness: 8,
|
|
1250
|
-
version: 3,
|
|
1251
|
-
colors: ThemeColors.light.colors,
|
|
1252
|
-
fonts: configureFonts(),
|
|
1253
|
-
animation: {
|
|
1254
|
-
scale: 1.0,
|
|
1255
|
-
},
|
|
1256
|
-
};
|
|
1257
|
-
|
|
1258
|
-
var DarkTheme = __assign(__assign({}, LightTheme), { dark: true, mode: "adaptive", version: 3, colors: ThemeColors.light.colors });
|
|
1259
|
-
|
|
1260
|
-
var DefaultTheme = LightTheme;
|
|
1261
|
-
var _a = createTheming(LightTheme), BaseThemeProvider = _a.ThemeProvider; _a.withTheme; var useAppTheme = _a.useTheme;
|
|
1262
|
-
var ThemeProvider = function (_a) {
|
|
1263
|
-
var children = _a.children;
|
|
1264
|
-
var colorScheme = useColorScheme();
|
|
1265
|
-
var isDark = colorScheme === "dark";
|
|
1266
|
-
var theme = isDark ? DarkTheme : LightTheme;
|
|
1267
|
-
return React__default.createElement(BaseThemeProvider, { theme: theme }, children);
|
|
1268
|
-
};
|
|
1269
|
-
function useTheme(overrides) {
|
|
1270
|
-
return useAppTheme(overrides);
|
|
1271
|
-
}
|
|
1262
|
+
var _a = createTheming(LightTheme); _a.ThemeProvider; _a.withTheme; var useAppTheme = _a.useTheme;
|
|
1272
1263
|
var useInternalTheme = function () {
|
|
1273
|
-
|
|
1274
|
-
var isDark = colorScheme === "dark";
|
|
1275
|
-
var theme = getTheme(isDark);
|
|
1276
|
-
return theme;
|
|
1277
|
-
};
|
|
1278
|
-
var defaultThemesByVersion = {
|
|
1279
|
-
light: LightTheme,
|
|
1280
|
-
dark: DarkTheme,
|
|
1264
|
+
return useAppTheme();
|
|
1281
1265
|
};
|
|
1282
|
-
var getTheme = function (isDark) {
|
|
1283
|
-
if (isDark === void 0) { isDark = false; }
|
|
1284
|
-
var scheme = isDark ? "dark" : "light";
|
|
1285
|
-
return defaultThemesByVersion[scheme];
|
|
1286
|
-
};
|
|
1287
|
-
// eslint-disable-next-line no-redeclare
|
|
1288
|
-
function adaptNavigationTheme(themes) {
|
|
1289
|
-
var reactNavigationLight = themes.reactNavigationLight, reactNavigationDark = themes.reactNavigationDark, materialLight = themes.materialLight, materialDark = themes.materialDark;
|
|
1290
|
-
var getAdaptedTheme = function (navigationTheme, AppTheme) {
|
|
1291
|
-
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 }) });
|
|
1292
|
-
};
|
|
1293
|
-
var AppThemes = {
|
|
1294
|
-
light: materialLight || LightTheme,
|
|
1295
|
-
dark: materialDark || DarkTheme,
|
|
1296
|
-
};
|
|
1297
|
-
if (reactNavigationLight && reactNavigationDark) {
|
|
1298
|
-
var modes = ["light", "dark"];
|
|
1299
|
-
var NavigationThemes_1 = {
|
|
1300
|
-
light: reactNavigationLight,
|
|
1301
|
-
dark: reactNavigationDark,
|
|
1302
|
-
};
|
|
1303
|
-
var _a = modes.reduce(function (prev, curr) {
|
|
1304
|
-
var _a;
|
|
1305
|
-
return __assign(__assign({}, prev), (_a = {}, _a[curr] = getAdaptedTheme(NavigationThemes_1[curr], AppThemes[curr]), _a));
|
|
1306
|
-
}, {
|
|
1307
|
-
light: reactNavigationLight,
|
|
1308
|
-
dark: reactNavigationDark,
|
|
1309
|
-
}), adaptedLight = _a.light, adaptedDark = _a.dark;
|
|
1310
|
-
return {
|
|
1311
|
-
LightTheme: adaptedLight,
|
|
1312
|
-
DarkTheme: adaptedDark,
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1315
|
-
if (reactNavigationDark) {
|
|
1316
|
-
return {
|
|
1317
|
-
DarkTheme: getAdaptedTheme(reactNavigationDark, AppThemes.dark),
|
|
1318
|
-
};
|
|
1319
|
-
}
|
|
1320
|
-
return {
|
|
1321
|
-
LightTheme: getAdaptedTheme(reactNavigationLight, AppThemes.light),
|
|
1322
|
-
};
|
|
1323
|
-
}
|
|
1324
1266
|
|
|
1325
1267
|
var ViewCustom = forwardRef$1(function (_a, ref) {
|
|
1326
1268
|
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,
|
|
@@ -1530,47 +1472,51 @@ var ViewCustom = forwardRef$1(function (_a, ref) {
|
|
|
1530
1472
|
});
|
|
1531
1473
|
var View = React__default.memo(ViewCustom);
|
|
1532
1474
|
|
|
1475
|
+
var animateProgress = function (progress, toValue) {
|
|
1476
|
+
Animated.sequence([
|
|
1477
|
+
Animated.timing(progress, {
|
|
1478
|
+
toValue: toValue,
|
|
1479
|
+
duration: 150,
|
|
1480
|
+
useNativeDriver: false,
|
|
1481
|
+
}),
|
|
1482
|
+
Animated.spring(progress, {
|
|
1483
|
+
toValue: toValue,
|
|
1484
|
+
damping: 20,
|
|
1485
|
+
stiffness: 200,
|
|
1486
|
+
mass: 0.5,
|
|
1487
|
+
velocity: 0.5,
|
|
1488
|
+
useNativeDriver: false,
|
|
1489
|
+
}),
|
|
1490
|
+
]).start();
|
|
1491
|
+
};
|
|
1533
1492
|
var Switch = memo(function (_a) {
|
|
1534
1493
|
var value = _a.value, disabled = _a.disabled, onValueChange = _a.onValueChange, _b = _a.size, size = _b === void 0 ? "normal" : _b;
|
|
1535
1494
|
var theme = useInternalTheme();
|
|
1536
1495
|
var colors = theme.colors;
|
|
1537
|
-
var progress =
|
|
1496
|
+
var progress = useRef(new Animated.Value(value ? 1 : 0)).current;
|
|
1497
|
+
useEffect(function () {
|
|
1498
|
+
if (value !== undefined) {
|
|
1499
|
+
animateProgress(progress, value ? 1 : 0);
|
|
1500
|
+
}
|
|
1501
|
+
}, [value, progress]);
|
|
1538
1502
|
var handleSwitch = useCallback(function () {
|
|
1539
1503
|
if (disabled)
|
|
1540
1504
|
return;
|
|
1541
1505
|
var newValue = !value;
|
|
1542
|
-
progress
|
|
1543
|
-
duration: 150,
|
|
1544
|
-
}), withSpring(newValue ? 1 : 0, {
|
|
1545
|
-
damping: 20,
|
|
1546
|
-
stiffness: 200,
|
|
1547
|
-
mass: 0.5,
|
|
1548
|
-
velocity: 0.5,
|
|
1549
|
-
}));
|
|
1506
|
+
animateProgress(progress, newValue ? 1 : 0);
|
|
1550
1507
|
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
|
|
1551
|
-
}, [disabled, value, onValueChange]);
|
|
1552
|
-
var
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
};
|
|
1508
|
+
}, [disabled, value, onValueChange, progress]);
|
|
1509
|
+
var translateX = progress.interpolate({
|
|
1510
|
+
inputRange: [0, 1],
|
|
1511
|
+
outputRange: [0, 20],
|
|
1556
1512
|
});
|
|
1557
|
-
var backgroundColor =
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1513
|
+
var backgroundColor = progress.interpolate({
|
|
1514
|
+
inputRange: [0, 1],
|
|
1515
|
+
outputRange: [
|
|
1516
|
+
colors.toggleBackgroundDefault,
|
|
1517
|
+
colors.toggleBackgroundActive,
|
|
1518
|
+
],
|
|
1561
1519
|
});
|
|
1562
|
-
useAnimatedReaction(function () { return value; }, function (currentValue) {
|
|
1563
|
-
if (currentValue !== undefined) {
|
|
1564
|
-
progress.value = withSequence(withTiming(currentValue ? 1 : 0, {
|
|
1565
|
-
duration: 150,
|
|
1566
|
-
}), withSpring(currentValue ? 1 : 0, {
|
|
1567
|
-
damping: 20,
|
|
1568
|
-
stiffness: 200,
|
|
1569
|
-
mass: 0.5,
|
|
1570
|
-
velocity: 0.5,
|
|
1571
|
-
}));
|
|
1572
|
-
}
|
|
1573
|
-
}, [value]);
|
|
1574
1520
|
var getSizeSwitch = useCallback(function () {
|
|
1575
1521
|
switch (size) {
|
|
1576
1522
|
case "small":
|
|
@@ -1605,8 +1551,12 @@ var Switch = memo(function (_a) {
|
|
|
1605
1551
|
}, [size, colors]);
|
|
1606
1552
|
return (React$3.createElement(View, { row: true },
|
|
1607
1553
|
React$3.createElement(TouchableOpacity, { activeOpacity: 1, onPress: handleSwitch, disabled: disabled, style: disabled ? { opacity: 0.6 } : {} },
|
|
1608
|
-
React$3.createElement(Animated.View, { style: [styles$j.vSegment, backgroundColor, getSizeSwitch()] },
|
|
1609
|
-
React$3.createElement(Animated.View, { style: [
|
|
1554
|
+
React$3.createElement(Animated.View, { style: [styles$j.vSegment, { backgroundColor: backgroundColor }, getSizeSwitch()] },
|
|
1555
|
+
React$3.createElement(Animated.View, { style: [
|
|
1556
|
+
styles$j.animated,
|
|
1557
|
+
{ transform: [{ translateX: translateX }] },
|
|
1558
|
+
getSizeCircle(),
|
|
1559
|
+
] })))));
|
|
1610
1560
|
});
|
|
1611
1561
|
var styles$j = StyleSheet.create({
|
|
1612
1562
|
vSegment: {
|
|
@@ -1617,11 +1567,6 @@ var styles$j = StyleSheet.create({
|
|
|
1617
1567
|
},
|
|
1618
1568
|
animated: {
|
|
1619
1569
|
position: "absolute",
|
|
1620
|
-
// shadowColor: "#000000",
|
|
1621
|
-
// shadowOffset: { width: 0, height: 0 },
|
|
1622
|
-
// shadowOpacity: 0.15,
|
|
1623
|
-
// shadowRadius: BORDER_RADIUS_6,
|
|
1624
|
-
// elevation: 5,
|
|
1625
1570
|
marginHorizontal: 2,
|
|
1626
1571
|
},
|
|
1627
1572
|
});
|
|
@@ -1983,7 +1928,7 @@ var TextInputAffix = function (_a) {
|
|
|
1983
1928
|
_b);
|
|
1984
1929
|
var textColor = getTextColor({ theme: theme, disabled: disabled });
|
|
1985
1930
|
var content = (React__default.createElement(Text$2, { maxFontSizeMultiplier: maxFontSizeMultiplier, style: [{ color: textColor }, textStyle, labelStyle], onLayout: onTextLayout, testID: "".concat(testID, "-text") }, text));
|
|
1986
|
-
return (React__default.createElement(Animated
|
|
1931
|
+
return (React__default.createElement(Animated.View, { style: [
|
|
1987
1932
|
styles$i.container,
|
|
1988
1933
|
style,
|
|
1989
1934
|
{
|
|
@@ -2051,7 +1996,7 @@ var AnimatedText = forwardRef(function AnimatedText(_a, ref) {
|
|
|
2051
1996
|
if (typeof font !== "object") {
|
|
2052
1997
|
throw new Error("Variant ".concat(variant, " was not provided properly. Valid variants are ").concat(Object.keys(theme.fonts).join(", "), "."));
|
|
2053
1998
|
}
|
|
2054
|
-
return (React$3.createElement(Animated
|
|
1999
|
+
return (React$3.createElement(Animated.Text, __assign({ ref: ref }, rest, { style: [
|
|
2055
2000
|
font,
|
|
2056
2001
|
styles$h.text,
|
|
2057
2002
|
{ writingDirection: writingDirection, color: theme.colors.backgroundPrimary },
|
|
@@ -4648,7 +4593,7 @@ var InputLabel = function (props) {
|
|
|
4648
4593
|
// Position colored placeholder and gray placeholder on top of each other and crossfade them
|
|
4649
4594
|
// This gives the effect of animating the color, but allows us to use native driver
|
|
4650
4595
|
React__default.createElement(View$1, { pointerEvents: "none", style: [StyleSheet.absoluteFill, styles$g.overflow, styles$g.labelContainer] },
|
|
4651
|
-
React__default.createElement(Animated
|
|
4596
|
+
React__default.createElement(Animated.View, { pointerEvents: "none", style: [
|
|
4652
4597
|
StyleSheet.absoluteFill,
|
|
4653
4598
|
Platform.OS !== "web" && { width: width },
|
|
4654
4599
|
{ opacity: opacity },
|
|
@@ -4732,8 +4677,6 @@ var Spacer = function (_a) {
|
|
|
4732
4677
|
return (React__default.createElement(View, { backgroundColor: backgroundColor || "transparent", width: width, height: height, style: [style] }));
|
|
4733
4678
|
};
|
|
4734
4679
|
|
|
4735
|
-
Dimensions.get("window").height;
|
|
4736
|
-
Dimensions.get("window").width;
|
|
4737
4680
|
var BUTTON_HEIGHT = 48;
|
|
4738
4681
|
var BUTTON_HEIGHT_SMALL = 40;
|
|
4739
4682
|
var SPACE_4 = 4;
|
|
@@ -4910,8 +4853,8 @@ var TextInputFlat = function (_a) {
|
|
|
4910
4853
|
adjustPaddingFlat(__assign(__assign({}, paddingSettings), { pad: pad }));
|
|
4911
4854
|
var baseLabelTranslateY = -labelHalfHeight - (topPosition + MINIMIZED_LABEL_Y_OFFSET);
|
|
4912
4855
|
var placeholderOpacityAnims = React$3.useRef([
|
|
4913
|
-
new Animated
|
|
4914
|
-
new Animated
|
|
4856
|
+
new Animated.Value(0),
|
|
4857
|
+
new Animated.Value(1),
|
|
4915
4858
|
]).current;
|
|
4916
4859
|
var placeholderOpacity = hasActiveOutline
|
|
4917
4860
|
? parentState.labeled
|
|
@@ -5980,8 +5923,8 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
5980
5923
|
var theme = useInternalTheme();
|
|
5981
5924
|
var isControlled = rest.value !== undefined;
|
|
5982
5925
|
var validInputValue = isControlled ? rest.value : rest.defaultValue;
|
|
5983
|
-
var labeled = React__default.useRef(new Animated
|
|
5984
|
-
var error = React__default.useRef(new Animated
|
|
5926
|
+
var labeled = React__default.useRef(new Animated.Value(validInputValue ? 0 : 1)).current;
|
|
5927
|
+
var error = React__default.useRef(new Animated.Value(errorProp ? 1 : 0)).current;
|
|
5985
5928
|
var _k = React__default.useState(false), focused = _k[0], setFocused = _k[1];
|
|
5986
5929
|
var _l = React__default.useState(false), displayPlaceholder = _l[0], setDisplayPlaceholder = _l[1];
|
|
5987
5930
|
var _m = React__default.useState(validInputValue), uncontrolledValue = _m[0], setUncontrolledValue = _m[1];
|
|
@@ -6021,7 +5964,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6021
5964
|
// When the input has an error, we wiggle the label and apply error styles
|
|
6022
5965
|
if (errorProp) {
|
|
6023
5966
|
// show error
|
|
6024
|
-
Animated
|
|
5967
|
+
Animated.timing(error, {
|
|
6025
5968
|
toValue: 1,
|
|
6026
5969
|
duration: FOCUS_ANIMATION_DURATION * scale,
|
|
6027
5970
|
// To prevent this - https://github.com/callstack/react-native-paper/issues/941
|
|
@@ -6031,7 +5974,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6031
5974
|
else {
|
|
6032
5975
|
// hide error
|
|
6033
5976
|
{
|
|
6034
|
-
Animated
|
|
5977
|
+
Animated.timing(error, {
|
|
6035
5978
|
toValue: 0,
|
|
6036
5979
|
duration: BLUR_ANIMATION_DURATION * scale,
|
|
6037
5980
|
// To prevent this - https://github.com/callstack/react-native-paper/issues/941
|
|
@@ -6071,7 +6014,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6071
6014
|
// https://github.com/callstack/react-native-paper/pull/1440
|
|
6072
6015
|
if (value || focused) {
|
|
6073
6016
|
// minimize label
|
|
6074
|
-
Animated
|
|
6017
|
+
Animated.timing(labeled, {
|
|
6075
6018
|
toValue: 0,
|
|
6076
6019
|
duration: BLUR_ANIMATION_DURATION * scale,
|
|
6077
6020
|
// To prevent this - https://github.com/callstack/react-native-paper/issues/941
|
|
@@ -6080,7 +6023,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6080
6023
|
}
|
|
6081
6024
|
else {
|
|
6082
6025
|
// restore label
|
|
6083
|
-
Animated
|
|
6026
|
+
Animated.timing(labeled, {
|
|
6084
6027
|
toValue: 1,
|
|
6085
6028
|
duration: FOCUS_ANIMATION_DURATION * scale,
|
|
6086
6029
|
// To prevent this - https://github.com/callstack/react-native-paper/issues/941
|
|
@@ -6395,9 +6338,9 @@ var ViewVisibleAnimated = React__default.memo(React__default.forwardRef(function
|
|
|
6395
6338
|
hide: hide,
|
|
6396
6339
|
show: show,
|
|
6397
6340
|
}); });
|
|
6398
|
-
var visibleAnimation = useRef(new Animated
|
|
6399
|
-
var translateAnimation = useRef(new Animated
|
|
6400
|
-
var scaleAnimation = useRef(new Animated
|
|
6341
|
+
var visibleAnimation = useRef(new Animated.Value(0)).current;
|
|
6342
|
+
var translateAnimation = useRef(new Animated.Value(0)).current;
|
|
6343
|
+
var scaleAnimation = useRef(new Animated.Value(scaleType === "in" ? 0 : 3)).current;
|
|
6401
6344
|
var _o = useState(false), visible = _o[0], setVisible = _o[1];
|
|
6402
6345
|
var TIME_OUT = null;
|
|
6403
6346
|
useEffect(function () {
|
|
@@ -6428,18 +6371,18 @@ var ViewVisibleAnimated = React__default.memo(React__default.forwardRef(function
|
|
|
6428
6371
|
if (position === void 0) { position = "bottom"; }
|
|
6429
6372
|
setVisible(true);
|
|
6430
6373
|
translateAnimation.setValue(position === "bottom" ? 100 : -100);
|
|
6431
|
-
Animated
|
|
6432
|
-
Animated
|
|
6374
|
+
Animated.parallel([
|
|
6375
|
+
Animated.timing(scaleAnimation, {
|
|
6433
6376
|
toValue: 1,
|
|
6434
6377
|
duration: duration,
|
|
6435
6378
|
useNativeDriver: true,
|
|
6436
6379
|
}),
|
|
6437
|
-
Animated
|
|
6380
|
+
Animated.timing(visibleAnimation, {
|
|
6438
6381
|
toValue: 1,
|
|
6439
6382
|
duration: duration,
|
|
6440
6383
|
useNativeDriver: true,
|
|
6441
6384
|
}),
|
|
6442
|
-
Animated
|
|
6385
|
+
Animated.timing(translateAnimation, {
|
|
6443
6386
|
toValue: 0,
|
|
6444
6387
|
duration: duration,
|
|
6445
6388
|
useNativeDriver: true,
|
|
@@ -6460,18 +6403,18 @@ var ViewVisibleAnimated = React__default.memo(React__default.forwardRef(function
|
|
|
6460
6403
|
};
|
|
6461
6404
|
var handleHide = function (_a) {
|
|
6462
6405
|
var durationHide = _a.durationHide, callback = _a.callback, _b = _a.position, position = _b === void 0 ? "bottom" : _b;
|
|
6463
|
-
Animated
|
|
6464
|
-
Animated
|
|
6406
|
+
Animated.parallel([
|
|
6407
|
+
Animated.timing(scaleAnimation, {
|
|
6465
6408
|
toValue: scaleType === "in" ? 0 : 3,
|
|
6466
6409
|
duration: durationHide,
|
|
6467
6410
|
useNativeDriver: true,
|
|
6468
6411
|
}),
|
|
6469
|
-
Animated
|
|
6412
|
+
Animated.timing(visibleAnimation, {
|
|
6470
6413
|
toValue: 0,
|
|
6471
6414
|
duration: durationHide,
|
|
6472
6415
|
useNativeDriver: true,
|
|
6473
6416
|
}),
|
|
6474
|
-
Animated
|
|
6417
|
+
Animated.timing(translateAnimation, {
|
|
6475
6418
|
toValue: position === "bottom" ? 300 : -300,
|
|
6476
6419
|
duration: durationHide,
|
|
6477
6420
|
useNativeDriver: true,
|
|
@@ -6481,7 +6424,7 @@ var ViewVisibleAnimated = React__default.memo(React__default.forwardRef(function
|
|
|
6481
6424
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
6482
6425
|
});
|
|
6483
6426
|
};
|
|
6484
|
-
return (React__default.createElement(Animated
|
|
6427
|
+
return (React__default.createElement(Animated.View, { style: [
|
|
6485
6428
|
style,
|
|
6486
6429
|
{
|
|
6487
6430
|
opacity: visibleAnimation,
|
|
@@ -7705,7 +7648,7 @@ var showToast = function (_a) {
|
|
|
7705
7648
|
};
|
|
7706
7649
|
|
|
7707
7650
|
var ToastProvider = forwardRef$1(function (_a, ref) {
|
|
7708
|
-
var children = _a.children, _b = _a.wrapSafeArea, wrapSafeArea = _b === void 0 ?
|
|
7651
|
+
var children = _a.children, _b = _a.wrapSafeArea, wrapSafeArea = _b === void 0 ? false : _b;
|
|
7709
7652
|
var toastComponentRef = React__default.useRef(null);
|
|
7710
7653
|
// Expose the show method through the ref
|
|
7711
7654
|
useImperativeHandle(ref, function () { return ({
|
|
@@ -7736,5 +7679,5 @@ var ToastProvider = forwardRef$1(function (_a, ref) {
|
|
|
7736
7679
|
renderToast()));
|
|
7737
7680
|
});
|
|
7738
7681
|
|
|
7739
|
-
export { Avatar, Badge, index$3 as Button, CONSTANTS, Checkbox, ChipBar, CountingDot, DarkTheme,
|
|
7682
|
+
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 };
|
|
7740
7683
|
//# sourceMappingURL=index.esm.js.map
|