sapo-components-ui-rn 1.0.47 → 1.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Icon/index.d.ts +1 -1
- package/dist/icons/IconError.d.ts +4 -0
- package/dist/icons/IconInfo.d.ts +4 -0
- package/dist/icons/IconSuccess.d.ts +4 -0
- package/dist/icons/IconWarning.d.ts +4 -0
- package/dist/index.esm.js +58 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +57 -29
- package/dist/index.js.map +1 -1
- package/dist/styles/themes/tokens.d.ts +8 -0
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/Icon/index.tsx +17 -1
- package/src/components/Switch/Switch.tsx +1 -8
- package/src/components/Switch/utils.ts +9 -9
- package/src/components/Toast/index.tsx +7 -6
- package/src/icons/IconError.tsx +21 -0
- package/src/icons/IconInfo.tsx +27 -0
- package/src/icons/IconSuccess.tsx +21 -0
- package/src/icons/IconWarning.tsx +27 -0
- package/src/styles/themes/DarkTheme.tsx +2 -0
- package/src/styles/themes/LightTheme.tsx +2 -0
- package/src/styles/themes/tokens.tsx +4 -0
- package/src/types.ts +3 -0
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { StyleProp, TextStyle } from "react-native";
|
|
3
3
|
export type IconType = "FontAwesome" | "Image" | "MaterialIcons" | "Feather" | "MaterialCommunityIcons" | "Svg";
|
|
4
4
|
export interface IconProps {
|
|
5
|
-
name: "IconCheckboxActive" | "IconCheckbox" | "IconRadio" | "IconRadioActive" | "IconRadioDisable" | "IconArrowDown" | "IconClearText" | "IconSearch" | "IconClose";
|
|
5
|
+
name: "IconCheckboxActive" | "IconCheckbox" | "IconRadio" | "IconRadioActive" | "IconRadioDisable" | "IconArrowDown" | "IconClearText" | "IconSearch" | "IconClose" | "IconSuccess" | "IconError" | "IconInfo" | "IconWarning";
|
|
6
6
|
backgroundColor?: string;
|
|
7
7
|
size?: number;
|
|
8
8
|
color?: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform, Dimensions, StyleSheet, useColorScheme, Animated, Easing, View as View$1, I18nManager, TouchableOpacity, NativeModules, Switch as Switch$1, Text as Text$2, Pressable, useWindowDimensions, TextInput as TextInput$1, ActivityIndicator as ActivityIndicator$1, Image as Image$2
|
|
1
|
+
import { Platform, Dimensions, StyleSheet, useColorScheme, Animated, Easing, View as View$1, I18nManager, TouchableOpacity, NativeModules, Switch as Switch$1, Text as Text$2, Pressable, useWindowDimensions, TextInput as TextInput$1, ActivityIndicator as ActivityIndicator$1, ImageBackground, Image as Image$2 } from 'react-native';
|
|
2
2
|
import * as React$3 from 'react';
|
|
3
3
|
import React__default, { useMemo, memo, forwardRef as forwardRef$1, useRef, useImperativeHandle, useState, useEffect, useCallback } from 'react';
|
|
4
4
|
import require$$1 from 'deepmerge';
|
|
@@ -356,6 +356,8 @@ var ref = {
|
|
|
356
356
|
borderPrimaryFocused: blue.BLUE100,
|
|
357
357
|
borderWarningInverseDefault: yellow.YELLOW40,
|
|
358
358
|
borderSuccessInverseDefault: green.GREEN40,
|
|
359
|
+
toggleBackgroundDefault: ink.INK10,
|
|
360
|
+
toggleBackgroundActive: green.GREEN80,
|
|
359
361
|
},
|
|
360
362
|
},
|
|
361
363
|
light: {
|
|
@@ -498,6 +500,8 @@ var ref = {
|
|
|
498
500
|
borderPrimaryFocused: blue.BLUE100,
|
|
499
501
|
borderWarningInverseDefault: yellow.YELLOW40,
|
|
500
502
|
borderSuccessInverseDefault: green.GREEN40,
|
|
503
|
+
toggleBackgroundDefault: ink.INK10,
|
|
504
|
+
toggleBackgroundActive: green.GREEN80,
|
|
501
505
|
},
|
|
502
506
|
},
|
|
503
507
|
},
|
|
@@ -1265,6 +1269,8 @@ var LightTheme = {
|
|
|
1265
1269
|
borderPrimaryFocused: blue.BLUE100,
|
|
1266
1270
|
borderWarningInverseDefault: yellow.YELLOW40,
|
|
1267
1271
|
borderSuccessInverseDefault: green.GREEN40,
|
|
1272
|
+
toggleBackgroundDefault: ink.INK10,
|
|
1273
|
+
toggleBackgroundActive: green.GREEN80,
|
|
1268
1274
|
},
|
|
1269
1275
|
fonts: configureFonts(),
|
|
1270
1276
|
animation: {
|
|
@@ -1411,6 +1417,8 @@ var DarkTheme = __assign(__assign({}, LightTheme), { dark: true, mode: "adaptive
|
|
|
1411
1417
|
borderPrimaryFocused: blue.BLUE100,
|
|
1412
1418
|
borderWarningInverseDefault: yellow.YELLOW40,
|
|
1413
1419
|
borderSuccessInverseDefault: green.GREEN40,
|
|
1420
|
+
toggleBackgroundDefault: ink.INK10,
|
|
1421
|
+
toggleBackgroundActive: green.GREEN80,
|
|
1414
1422
|
} });
|
|
1415
1423
|
|
|
1416
1424
|
var DefaultTheme = LightTheme;
|
|
@@ -2027,7 +2035,7 @@ var getCheckedColor = function (_a) {
|
|
|
2027
2035
|
if (color) {
|
|
2028
2036
|
return color;
|
|
2029
2037
|
}
|
|
2030
|
-
return theme.colors.
|
|
2038
|
+
return theme.colors.toggleBackgroundActive;
|
|
2031
2039
|
};
|
|
2032
2040
|
var getThumbTintColor = function (_a) {
|
|
2033
2041
|
var theme = _a.theme, disabled = _a.disabled, value = _a.value, checkedColor = _a.checkedColor;
|
|
@@ -2037,17 +2045,17 @@ var getThumbTintColor = function (_a) {
|
|
|
2037
2045
|
}
|
|
2038
2046
|
if (disabled) {
|
|
2039
2047
|
if (theme.dark) {
|
|
2040
|
-
return theme.colors.
|
|
2048
|
+
return theme.colors.toggleBackgroundDefault;
|
|
2041
2049
|
}
|
|
2042
|
-
return theme.colors.
|
|
2050
|
+
return theme.colors.toggleBackgroundDefault;
|
|
2043
2051
|
}
|
|
2044
2052
|
if (value) {
|
|
2045
2053
|
return checkedColor;
|
|
2046
2054
|
}
|
|
2047
2055
|
if (theme.dark) {
|
|
2048
|
-
return theme.colors.
|
|
2056
|
+
return theme.colors.toggleBackgroundDefault;
|
|
2049
2057
|
}
|
|
2050
|
-
return theme.colors.
|
|
2058
|
+
return theme.colors.toggleBackgroundDefault;
|
|
2051
2059
|
};
|
|
2052
2060
|
var getOnTintColor = function (_a) {
|
|
2053
2061
|
var theme = _a.theme, disabled = _a.disabled, value = _a.value, checkedColor = _a.checkedColor;
|
|
@@ -2057,17 +2065,17 @@ var getOnTintColor = function (_a) {
|
|
|
2057
2065
|
}
|
|
2058
2066
|
if (disabled) {
|
|
2059
2067
|
if (theme.dark) {
|
|
2060
|
-
return theme.colors.
|
|
2068
|
+
return theme.colors.toggleBackgroundDefault;
|
|
2061
2069
|
}
|
|
2062
|
-
return theme.colors.
|
|
2070
|
+
return theme.colors.toggleBackgroundDefault;
|
|
2063
2071
|
}
|
|
2064
2072
|
if (value) {
|
|
2065
2073
|
return checkedColor;
|
|
2066
2074
|
}
|
|
2067
2075
|
if (theme.dark) {
|
|
2068
|
-
return theme.colors.
|
|
2076
|
+
return theme.colors.toggleBackgroundDefault;
|
|
2069
2077
|
}
|
|
2070
|
-
return theme.colors.
|
|
2078
|
+
return theme.colors.toggleBackgroundDefault;
|
|
2071
2079
|
};
|
|
2072
2080
|
var getSwitchColor = function (_a) {
|
|
2073
2081
|
var theme = _a.theme, disabled = _a.disabled, value = _a.value, color = _a.color;
|
|
@@ -2109,25 +2117,19 @@ var Switch = function (_a) {
|
|
|
2109
2117
|
disabled: disabled,
|
|
2110
2118
|
value: value,
|
|
2111
2119
|
color: color,
|
|
2112
|
-
}),
|
|
2120
|
+
}), onTintColor = _b.onTintColor, thumbTintColor = _b.thumbTintColor;
|
|
2113
2121
|
var props = version && version.major === 0 && version.minor <= 56
|
|
2114
2122
|
? {
|
|
2115
2123
|
onTintColor: onTintColor,
|
|
2116
2124
|
thumbTintColor: thumbTintColor,
|
|
2117
2125
|
}
|
|
2118
|
-
:
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
}
|
|
2124
|
-
|
|
2125
|
-
thumbColor: thumbTintColor,
|
|
2126
|
-
trackColor: {
|
|
2127
|
-
true: onTintColor,
|
|
2128
|
-
false: onTintColor,
|
|
2129
|
-
},
|
|
2130
|
-
};
|
|
2126
|
+
: {
|
|
2127
|
+
thumbColor: thumbTintColor,
|
|
2128
|
+
trackColor: {
|
|
2129
|
+
true: onTintColor,
|
|
2130
|
+
false: onTintColor,
|
|
2131
|
+
},
|
|
2132
|
+
};
|
|
2131
2133
|
return (React$3.createElement(View, { row: true },
|
|
2132
2134
|
React$3.createElement(Switch$1, __assign({ value: value, disabled: disabled, onValueChange: disabled ? undefined : onValueChange }, props, rest))));
|
|
2133
2135
|
};
|
|
@@ -2772,6 +2774,24 @@ var IconSearch = function (props) { return (React$3.createElement(Svg, __assign(
|
|
|
2772
2774
|
var IconClose = function (props) { return (React$3.createElement(Svg, __assign({ width: 24, height: 24, viewBox: "0 0 24 24", fill: "none" }, props),
|
|
2773
2775
|
React$3.createElement(Path, { d: "M19 6.40958L13.4102 12.0004L19 17.5902L17.5898 19.0004L12 13.4096L6.41016 19.0004L5 17.5902L10.5898 12.0004L5 6.40958L6.41016 5.0004L12 10.5902L17.5898 5.0004L19 6.40958Z", fill: "currentColor" }))); };
|
|
2774
2776
|
|
|
2777
|
+
var IconSuccess = function (props) { return (React__default.createElement(Svg, __assign({ width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, props),
|
|
2778
|
+
React__default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5ZM3.86364 10C3.86364 6.61098 6.61098 3.86364 10 3.86364C13.389 3.86364 16.1364 6.61098 16.1364 10C16.1364 13.389 13.389 16.1364 10 16.1364C6.61098 16.1364 3.86364 13.389 3.86364 10Z", fill: "white" }),
|
|
2779
|
+
React__default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M8.875 10.9242L12.8447 6.9545L13.9053 8.01516L8.875 13.0455L6.09467 10.2652L7.15533 9.2045L8.875 10.9242Z", fill: "white" }))); };
|
|
2780
|
+
|
|
2781
|
+
var IconError = function (props) { return (React__default.createElement(Svg, __assign({ width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, props),
|
|
2782
|
+
React__default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5ZM3.86364 10C3.86364 6.61098 6.61098 3.86364 10 3.86364C13.389 3.86364 16.1364 6.61098 16.1364 10C16.1364 13.389 13.389 16.1364 10 16.1364C6.61098 16.1364 3.86364 13.389 3.86364 10Z", fill: "white" }),
|
|
2783
|
+
React__default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M13.3333 6.66667L10 10L6.66667 6.66667L5.83333 7.5L9.16667 10.8333L5.83333 14.1667L6.66667 15L10 11.6667L13.3333 15L14.1667 14.1667L10.8333 10.8333L14.1667 7.5L13.3333 6.66667Z", fill: "white" }))); };
|
|
2784
|
+
|
|
2785
|
+
var IconInfo = function (props) { return (React__default.createElement(Svg, __assign({ width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, props),
|
|
2786
|
+
React__default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5ZM3.86364 10C3.86364 6.61098 6.61098 3.86364 10 3.86364C13.389 3.86364 16.1364 6.61098 16.1364 10C16.1364 13.389 13.389 16.1364 10 16.1364C6.61098 16.1364 3.86364 13.389 3.86364 10Z", fill: "white" }),
|
|
2787
|
+
React__default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10 6.66667C10.4602 6.66667 10.8333 7.03976 10.8333 7.5V10.8333C10.8333 11.2936 10.4602 11.6667 10 11.6667C9.53976 11.6667 9.16667 11.2936 9.16667 10.8333V7.5C9.16667 7.03976 9.53976 6.66667 10 6.66667Z", fill: "white" }),
|
|
2788
|
+
React__default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10 12.5C10.4602 12.5 10.8333 12.8731 10.8333 13.3333C10.8333 13.7936 10.4602 14.1667 10 14.1667C9.53976 14.1667 9.16667 13.7936 9.16667 13.3333C9.16667 12.8731 9.53976 12.5 10 12.5Z", fill: "white" }))); };
|
|
2789
|
+
|
|
2790
|
+
var IconWarning = function (props) { return (React__default.createElement(Svg, __assign({ width: "20", height: "20", viewBox: "0 0 20 20", fill: "none" }, props),
|
|
2791
|
+
React__default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10 2.5L17.5 17.5H2.5L10 2.5ZM10 5.83333L4.16667 15.8333H15.8333L10 5.83333Z", fill: "white" }),
|
|
2792
|
+
React__default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10 7.5C10.4602 7.5 10.8333 7.8731 10.8333 8.33333V11.6667C10.8333 12.1269 10.4602 12.5 10 12.5C9.53976 12.5 9.16667 12.1269 9.16667 11.6667V8.33333C9.16667 7.8731 9.53976 7.5 10 7.5Z", fill: "white" }),
|
|
2793
|
+
React__default.createElement(Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10 13.3333C10.4602 13.3333 10.8333 13.7064 10.8333 14.1667C10.8333 14.6269 10.4602 15 10 15C9.53976 15 9.16667 14.6269 9.16667 14.1667C9.16667 13.7064 9.53976 13.3333 10 13.3333Z", fill: "white" }))); };
|
|
2794
|
+
|
|
2775
2795
|
var getIconComponent = function (type) {
|
|
2776
2796
|
switch (type) {
|
|
2777
2797
|
case "MaterialIcons":
|
|
@@ -2808,6 +2828,14 @@ var Icon = function (_a) {
|
|
|
2808
2828
|
return IconSearch;
|
|
2809
2829
|
case "IconClose":
|
|
2810
2830
|
return IconClose;
|
|
2831
|
+
case "IconSuccess":
|
|
2832
|
+
return IconSuccess;
|
|
2833
|
+
case "IconError":
|
|
2834
|
+
return IconError;
|
|
2835
|
+
case "IconInfo":
|
|
2836
|
+
return IconInfo;
|
|
2837
|
+
case "IconWarning":
|
|
2838
|
+
return IconWarning;
|
|
2811
2839
|
default:
|
|
2812
2840
|
return IconCheckbox;
|
|
2813
2841
|
}
|
|
@@ -6319,15 +6347,15 @@ var Toast = memoWithRef(function (_props, ref) {
|
|
|
6319
6347
|
var getSourceIcon = function () {
|
|
6320
6348
|
switch (options.type) {
|
|
6321
6349
|
case "success":
|
|
6322
|
-
return
|
|
6350
|
+
return "IconSuccess";
|
|
6323
6351
|
case "error":
|
|
6324
|
-
return
|
|
6352
|
+
return "IconError";
|
|
6325
6353
|
case "info":
|
|
6326
|
-
return
|
|
6354
|
+
return "IconInfo";
|
|
6327
6355
|
case "warning":
|
|
6328
|
-
return
|
|
6356
|
+
return "IconWarning";
|
|
6329
6357
|
default:
|
|
6330
|
-
return
|
|
6358
|
+
return "IconSuccess";
|
|
6331
6359
|
}
|
|
6332
6360
|
};
|
|
6333
6361
|
var handleToastBottomHeight = function () {
|
|
@@ -6372,7 +6400,7 @@ var Toast = memoWithRef(function (_props, ref) {
|
|
|
6372
6400
|
] },
|
|
6373
6401
|
React__default.createElement(View, { row: true, style: { alignItems: "flex-start" } },
|
|
6374
6402
|
React__default.createElement(View, null,
|
|
6375
|
-
React__default.createElement(
|
|
6403
|
+
React__default.createElement(Icon$1, { name: getSourceIcon(), type: "Svg", size: 20 })),
|
|
6376
6404
|
React__default.createElement(View, { full: true, paddingLeft: CONSTANTS.SPACE_8 },
|
|
6377
6405
|
React__default.createElement(Text$1, { bold: true, color: colors.textOnFillDefault }, options.title),
|
|
6378
6406
|
message.toString().length > 0 && (React__default.createElement(Text$1, { color: colors.textOnFillDefault, numberOfLines: 4, style: !options.title && styles$7.wrapMess }, message)))))));
|