sapo-components-ui-rn 1.1.4 → 1.1.5
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/Badge/index.d.ts +1 -1
- package/dist/index.esm.js +11 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Badge/index.tsx +12 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { StyleProp, ViewStyle, TextStyle } from "react-native";
|
|
3
3
|
type BadgeType = "success" | "error" | "info" | "warning" | "default";
|
|
4
|
-
type BadgeSize = "
|
|
4
|
+
type BadgeSize = "large" | "medium" | "small";
|
|
5
5
|
type BadgeMode = "default" | "outline";
|
|
6
6
|
type ProgressType = "full" | "half" | "empty" | "none";
|
|
7
7
|
interface BadgeProps {
|
package/dist/index.esm.js
CHANGED
|
@@ -6781,19 +6781,20 @@ var Image$1 = memoDeepEqual(Image);
|
|
|
6781
6781
|
|
|
6782
6782
|
var BADGE_CONFIGS = {
|
|
6783
6783
|
sizes: {
|
|
6784
|
-
|
|
6784
|
+
medium: {
|
|
6785
6785
|
paddingHorizontal: CONSTANTS.SPACE_4,
|
|
6786
6786
|
minWidth: 16,
|
|
6787
6787
|
minHeight: 16,
|
|
6788
6788
|
textSize: 10,
|
|
6789
6789
|
},
|
|
6790
|
-
|
|
6790
|
+
large: {
|
|
6791
6791
|
paddingHorizontal: CONSTANTS.SPACE_8,
|
|
6792
6792
|
minWidth: 16,
|
|
6793
|
+
minHeight: 24,
|
|
6793
6794
|
textSize: 12,
|
|
6794
6795
|
},
|
|
6795
6796
|
},
|
|
6796
|
-
|
|
6797
|
+
small: {
|
|
6797
6798
|
width: 8,
|
|
6798
6799
|
height: 8,
|
|
6799
6800
|
borderRadius: 4,
|
|
@@ -6837,11 +6838,11 @@ var ProgressCircle = function (_a) {
|
|
|
6837
6838
|
} }));
|
|
6838
6839
|
};
|
|
6839
6840
|
var Badge = React__default.memo(function (_a) {
|
|
6840
|
-
var _b = _a.value, value = _b === void 0 ? "1" : _b, style = _a.style, textColor = _a.textColor, textStyle = _a.textStyle, _c = _a.type, type = _c === void 0 ? "success" : _c, _d = _a.badgeSize, badgeSize = _d === void 0 ? "
|
|
6841
|
+
var _b = _a.value, value = _b === void 0 ? "1" : _b, style = _a.style, textColor = _a.textColor, textStyle = _a.textStyle, _c = _a.type, type = _c === void 0 ? "success" : _c, _d = _a.badgeSize, badgeSize = _d === void 0 ? "large" : _d, _e = _a.mode, mode = _e === void 0 ? "default" : _e, textSize = _a.textSize, borderColor = _a.borderColor, backgroundColor = _a.backgroundColor, _f = _a.progressType, progressType = _f === void 0 ? "none" : _f, leftIcon = _a.leftIcon;
|
|
6841
6842
|
var theme = useInternalTheme();
|
|
6842
6843
|
var colors = theme.colors;
|
|
6843
6844
|
var sizeStyles = useMemo(function () {
|
|
6844
|
-
if (badgeSize === "
|
|
6845
|
+
if (badgeSize === "small")
|
|
6845
6846
|
return null;
|
|
6846
6847
|
return BADGE_CONFIGS.sizes[badgeSize];
|
|
6847
6848
|
}, [badgeSize]);
|
|
@@ -6873,8 +6874,8 @@ var Badge = React__default.memo(function (_a) {
|
|
|
6873
6874
|
backgroundColor: backgroundColor || colors.surfacePrimaryInverseDefault,
|
|
6874
6875
|
},
|
|
6875
6876
|
outline: {
|
|
6876
|
-
borderColor: borderColor || colors.
|
|
6877
|
-
backgroundColor: backgroundColor || colors.
|
|
6877
|
+
borderColor: borderColor || colors.borderPrimaryDefault,
|
|
6878
|
+
backgroundColor: backgroundColor || colors.surfaceSecondaryDefault,
|
|
6878
6879
|
},
|
|
6879
6880
|
},
|
|
6880
6881
|
warning: {
|
|
@@ -6912,7 +6913,7 @@ var Badge = React__default.memo(function (_a) {
|
|
|
6912
6913
|
},
|
|
6913
6914
|
info: {
|
|
6914
6915
|
default: colors.textOnFillDefault,
|
|
6915
|
-
outline: colors.
|
|
6916
|
+
outline: colors.textDefault,
|
|
6916
6917
|
},
|
|
6917
6918
|
warning: {
|
|
6918
6919
|
default: colors.textOnFillDefault,
|
|
@@ -6927,11 +6928,11 @@ var Badge = React__default.memo(function (_a) {
|
|
|
6927
6928
|
}, [colors, type, mode]);
|
|
6928
6929
|
var finalTextSize = useMemo(function () {
|
|
6929
6930
|
var _a;
|
|
6930
|
-
if (badgeSize === "
|
|
6931
|
+
if (badgeSize === "small")
|
|
6931
6932
|
return 0;
|
|
6932
6933
|
return textSize || ((_a = BADGE_CONFIGS.sizes[badgeSize]) === null || _a === void 0 ? void 0 : _a.textSize) || 12;
|
|
6933
6934
|
}, [textSize, badgeSize]);
|
|
6934
|
-
if (badgeSize === "
|
|
6935
|
+
if (badgeSize === "small") {
|
|
6935
6936
|
return (React__default.createElement(View, { row: true, style: style },
|
|
6936
6937
|
React__default.createElement(ProgressCircle, { progress: progressType, color: typeStyles.backgroundColor })));
|
|
6937
6938
|
}
|