sapo-components-ui-rn 1.0.23 → 1.0.24
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/assets/icon-close.svg +3 -0
- package/dist/assets/svg/icon-close.svg +3 -0
- package/dist/components/ChipBar/index.d.ts +3 -1
- package/dist/components/FloatingButton/index.d.ts +2 -0
- package/dist/components/Icon/index.d.ts +1 -1
- package/dist/components/Tag/index.d.ts +18 -0
- package/dist/icons/IconClose.d.ts +4 -0
- package/dist/index.esm.js +45 -41
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +45 -41
- package/dist/index.js.map +1 -1
- package/dist/styles/themes/tokens.d.ts +1 -0
- package/dist/theme/dimensions.d.ts +1 -0
- package/package.json +1 -1
- package/src/assets/svg/icon-close.svg +3 -0
- package/src/components/ChipBar/index.tsx +6 -0
- package/src/components/FloatingButton/index.tsx +19 -21
- package/src/components/Icon/index.tsx +5 -1
- package/src/components/Tag/index.tsx +122 -0
- package/src/components/View/index.tsx +10 -2
- package/src/icons/IconClose.tsx +14 -0
- package/src/styles/themes/DarkTheme.tsx +1 -1
- package/src/styles/themes/LightTheme.tsx +1 -1
- package/src/styles/themes/tokens.tsx +3 -2
- package/src/theme/dimensions.ts +1 -0
- package/src/theme/themes.tsx +2 -2
- package/src/types.tsx +26 -35
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<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="#0088FF"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<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="#0088FF"/>
|
|
3
|
+
</svg>
|
|
@@ -11,6 +11,8 @@ interface ChipBarProps {
|
|
|
11
11
|
rightIcon?: React.ReactNode;
|
|
12
12
|
badge?: number;
|
|
13
13
|
isActive?: boolean;
|
|
14
|
+
ellipsizeMode?: "head" | "middle" | "tail" | "clip";
|
|
15
|
+
numberOfLines?: number;
|
|
14
16
|
}
|
|
15
|
-
declare const ChipBar: ({ style, borderRadius, title, textStyle, onPress, disabled, leftIcon, rightIcon, badge, isActive, }: ChipBarProps) => React.JSX.Element;
|
|
17
|
+
declare const ChipBar: ({ style, borderRadius, title, textStyle, onPress, disabled, leftIcon, rightIcon, badge, isActive, ellipsizeMode, numberOfLines, }: ChipBarProps) => React.JSX.Element;
|
|
16
18
|
export default ChipBar;
|
|
@@ -12,6 +12,8 @@ export interface FloatingButtonProps {
|
|
|
12
12
|
backgroundColor?: string;
|
|
13
13
|
top?: number;
|
|
14
14
|
right?: number;
|
|
15
|
+
left?: number;
|
|
16
|
+
bottom?: number;
|
|
15
17
|
}
|
|
16
18
|
declare const _default: React.MemoExoticComponent<React.ComponentType<FloatingButtonProps>>;
|
|
17
19
|
export default _default;
|
|
@@ -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";
|
|
5
|
+
name: "IconCheckboxActive" | "IconCheckbox" | "IconRadio" | "IconRadioActive" | "IconRadioDisable" | "IconArrowDown" | "IconClearText" | "IconSearch" | "IconClose";
|
|
6
6
|
backgroundColor?: string;
|
|
7
7
|
size?: number;
|
|
8
8
|
color?: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle } from "react-native";
|
|
3
|
+
interface TagProps {
|
|
4
|
+
style?: StyleProp<ViewStyle>;
|
|
5
|
+
title: string;
|
|
6
|
+
borderRadius?: number;
|
|
7
|
+
onPress?: (val?: any) => void;
|
|
8
|
+
textStyle?: StyleProp<TextStyle>;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
leftIcon?: React.ReactNode;
|
|
11
|
+
rightIcon?: React.ReactNode;
|
|
12
|
+
isActive?: boolean;
|
|
13
|
+
ellipsizeMode?: "head" | "middle" | "tail" | "clip";
|
|
14
|
+
numberOfLines?: number;
|
|
15
|
+
hideRightIcon?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const Tag: ({ style, borderRadius, title, textStyle, onPress, disabled, leftIcon, rightIcon, isActive, ellipsizeMode, numberOfLines, hideRightIcon, }: TagProps) => React.JSX.Element;
|
|
18
|
+
export default Tag;
|
package/dist/index.esm.js
CHANGED
|
@@ -257,7 +257,7 @@ var ref = {
|
|
|
257
257
|
surfaceBrandDefault: blue.BLUE100,
|
|
258
258
|
surfaceBrandDisabled: ink.INK10,
|
|
259
259
|
surfaceBrandHover: blue.BLUE80,
|
|
260
|
-
surfaceBrandInverseDefault: blue.
|
|
260
|
+
surfaceBrandInverseDefault: blue.BLUE5,
|
|
261
261
|
surfaceBrandInverseHover: blue.BLUE20,
|
|
262
262
|
surfaceBrandInversePressed: blue.BLUE40,
|
|
263
263
|
surfaceBrandPressed: blue.BLUE120,
|
|
@@ -399,7 +399,7 @@ var ref = {
|
|
|
399
399
|
surfaceBrandDefault: blue.BLUE100,
|
|
400
400
|
surfaceBrandDisabled: ink.INK10,
|
|
401
401
|
surfaceBrandHover: blue.BLUE80,
|
|
402
|
-
surfaceBrandInverseDefault: blue.
|
|
402
|
+
surfaceBrandInverseDefault: blue.BLUE5,
|
|
403
403
|
surfaceBrandInverseHover: blue.BLUE20,
|
|
404
404
|
surfaceBrandInversePressed: blue.BLUE40,
|
|
405
405
|
surfaceBrandPressed: blue.BLUE120,
|
|
@@ -558,6 +558,7 @@ var CONSTANTS = {
|
|
|
558
558
|
BUTTON_HEIGHT: 48,
|
|
559
559
|
BUTTON_HEIGHT_SMALL: 40,
|
|
560
560
|
RADIO_BUTTON_HEIGHT: 20,
|
|
561
|
+
BUTTON_ICON: 36,
|
|
561
562
|
SPACE_0: 0,
|
|
562
563
|
SPACE_2: 2,
|
|
563
564
|
SPACE_4: 4,
|
|
@@ -1165,7 +1166,7 @@ var LightTheme = {
|
|
|
1165
1166
|
surfaceBrandDefault: blue.BLUE100,
|
|
1166
1167
|
surfaceBrandDisabled: ink.INK10,
|
|
1167
1168
|
surfaceBrandHover: blue.BLUE80,
|
|
1168
|
-
surfaceBrandInverseDefault: blue.
|
|
1169
|
+
surfaceBrandInverseDefault: blue.BLUE5,
|
|
1169
1170
|
surfaceBrandInverseHover: blue.BLUE20,
|
|
1170
1171
|
surfaceBrandInversePressed: blue.BLUE40,
|
|
1171
1172
|
surfaceBrandPressed: blue.BLUE120,
|
|
@@ -1311,7 +1312,7 @@ var DarkTheme = __assign(__assign({}, LightTheme), { dark: true, mode: "adaptive
|
|
|
1311
1312
|
surfaceBrandDefault: blue.BLUE100,
|
|
1312
1313
|
surfaceBrandDisabled: ink.INK10,
|
|
1313
1314
|
surfaceBrandHover: blue.BLUE80,
|
|
1314
|
-
surfaceBrandInverseDefault: blue.
|
|
1315
|
+
surfaceBrandInverseDefault: blue.BLUE5,
|
|
1315
1316
|
surfaceBrandInverseHover: blue.BLUE20,
|
|
1316
1317
|
surfaceBrandInversePressed: blue.BLUE40,
|
|
1317
1318
|
surfaceBrandPressed: blue.BLUE120,
|
|
@@ -1919,7 +1920,9 @@ var styles$g = StyleSheet.create({
|
|
|
1919
1920
|
});
|
|
1920
1921
|
|
|
1921
1922
|
var ViewCustom = function (_a) {
|
|
1922
|
-
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,
|
|
1923
|
+
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;
|
|
1924
|
+
var theme = useInternalTheme();
|
|
1925
|
+
var colors = theme.colors;
|
|
1923
1926
|
var getStyle = function () {
|
|
1924
1927
|
var styleCustom = {};
|
|
1925
1928
|
if (row) {
|
|
@@ -2005,7 +2008,11 @@ var ViewCustom = function (_a) {
|
|
|
2005
2008
|
};
|
|
2006
2009
|
var defaultStyle = getStyle();
|
|
2007
2010
|
var Component = onPress ? TouchableOpacity : View$1;
|
|
2008
|
-
return (React__default.createElement(Component, { activeOpacity: activeOpacity, onPress: onPress, disabled: disabled, style: [
|
|
2011
|
+
return (React__default.createElement(Component, { activeOpacity: activeOpacity, onPress: onPress, disabled: disabled, style: [
|
|
2012
|
+
{ backgroundColor: colors.backgroundPrimary },
|
|
2013
|
+
defaultStyle,
|
|
2014
|
+
style,
|
|
2015
|
+
] }, children));
|
|
2009
2016
|
};
|
|
2010
2017
|
var View = React__default.memo(ViewCustom);
|
|
2011
2018
|
|
|
@@ -2741,6 +2748,9 @@ var IconClearText = function (props) { return (React$3.createElement(Svg, __assi
|
|
|
2741
2748
|
var IconSearch = function (props) { return (React$3.createElement(Svg, __assign({ width: 16, height: 16, viewBox: "0 0 16 16", fill: "none" }, props),
|
|
2742
2749
|
React$3.createElement(Path, { d: "M15.7 14.3L11.5 10.1C11.3 9.9 11 9.8 10.7 9.8C11.5 8.8 12 7.4 12 6C12 2.7 9.3 0 6 0C2.7 0 0 2.7 0 6C0 9.3 2.7 12 6 12C7.4 12 8.8 11.5 9.8 10.6C9.8 10.9 9.8 11.2 10.1 11.4L14.3 15.6C14.5 15.8 14.8 15.9 15 15.9C15.2 15.9 15.5 15.8 15.7 15.6C16.1 15.3 16.1 14.7 15.7 14.3ZM6 10.5C3.5 10.5 1.5 8.5 1.5 6C1.5 3.5 3.5 1.5 6 1.5C8.5 1.5 10.5 3.5 10.5 6C10.5 8.5 8.5 10.5 6 10.5Z", fill: "currentColor" }))); };
|
|
2743
2750
|
|
|
2751
|
+
var IconClose = function (props) { return (React$3.createElement(Svg, __assign({ width: 24, height: 24, viewBox: "0 0 24 24", fill: "none" }, props),
|
|
2752
|
+
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" }))); };
|
|
2753
|
+
|
|
2744
2754
|
var getIconComponent = function (type) {
|
|
2745
2755
|
switch (type) {
|
|
2746
2756
|
case "MaterialIcons":
|
|
@@ -2775,6 +2785,8 @@ var Icon = function (_a) {
|
|
|
2775
2785
|
return IconClearText;
|
|
2776
2786
|
case "IconSearch":
|
|
2777
2787
|
return IconSearch;
|
|
2788
|
+
case "IconClose":
|
|
2789
|
+
return IconClose;
|
|
2778
2790
|
default:
|
|
2779
2791
|
return IconCheckbox;
|
|
2780
2792
|
}
|
|
@@ -6043,12 +6055,32 @@ var styles$8 = StyleSheet.create({
|
|
|
6043
6055
|
});
|
|
6044
6056
|
var index$2 = memoDeepEqual(ButtonIcon);
|
|
6045
6057
|
|
|
6058
|
+
Dimensions.get("window").height;
|
|
6059
|
+
Dimensions.get("window").width;
|
|
6060
|
+
var BUTTON_HEIGHT = 48;
|
|
6061
|
+
var BUTTON_HEIGHT_SMALL = 40;
|
|
6062
|
+
var SPACE_4 = 4;
|
|
6063
|
+
var SPACE_6 = 6;
|
|
6064
|
+
var SPACE_8 = 8;
|
|
6065
|
+
var SPACE_12 = 12;
|
|
6066
|
+
var SPACE_16 = 16;
|
|
6067
|
+
//MARK: Border radius
|
|
6068
|
+
var BORDER_RADIUS_6 = 6;
|
|
6069
|
+
//MARK: Border width
|
|
6070
|
+
StyleSheet.hairlineWidth; //0.3-0.5
|
|
6071
|
+
var BORDER_WIDTH_1 = 1;
|
|
6072
|
+
|
|
6046
6073
|
var FloatingButton = function (_a) {
|
|
6047
|
-
var isLoading = _a.isLoading, disabled = _a.disabled, onPress = _a.onPress, style = _a.style, _b = _a.hiddenBackground, hiddenBackground = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ?
|
|
6074
|
+
var isLoading = _a.isLoading, disabled = _a.disabled, onPress = _a.onPress, style = _a.style, _b = _a.hiddenBackground, hiddenBackground = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? BUTTON_HEIGHT : _c, children = _a.children, backgroundColor = _a.backgroundColor, props = _a.props, _d = _a.top, top = _d === void 0 ? 0 : _d, _e = _a.right, right = _e === void 0 ? 0 : _e, _f = _a.left, left = _f === void 0 ? 0 : _f, _g = _a.bottom, bottom = _g === void 0 ? 0 : _g;
|
|
6048
6075
|
var colors = useInternalTheme().colors;
|
|
6049
|
-
return (React__default.createElement(
|
|
6050
|
-
|
|
6051
|
-
|
|
6076
|
+
return (React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || isLoading, style: [
|
|
6077
|
+
styles$7.btn,
|
|
6078
|
+
top > 0 && { top: top },
|
|
6079
|
+
right > 0 && { right: right },
|
|
6080
|
+
left > 0 && { left: left },
|
|
6081
|
+
bottom > 0 && { bottom: bottom },
|
|
6082
|
+
] }),
|
|
6083
|
+
React__default.createElement(View, __assign({ center: true, style: [
|
|
6052
6084
|
!hiddenBackground
|
|
6053
6085
|
? {
|
|
6054
6086
|
backgroundColor: backgroundColor || colors.surfaceBrandDefault,
|
|
@@ -6060,8 +6092,6 @@ var FloatingButton = function (_a) {
|
|
|
6060
6092
|
width: size,
|
|
6061
6093
|
height: size,
|
|
6062
6094
|
borderRadius: size / 2,
|
|
6063
|
-
top: top,
|
|
6064
|
-
right: right,
|
|
6065
6095
|
},
|
|
6066
6096
|
disabled && {
|
|
6067
6097
|
borderWidth: 0,
|
|
@@ -6073,17 +6103,6 @@ var FloatingButton = function (_a) {
|
|
|
6073
6103
|
var styles$7 = StyleSheet.create({
|
|
6074
6104
|
btn: {
|
|
6075
6105
|
position: "absolute",
|
|
6076
|
-
justifyContent: "center",
|
|
6077
|
-
alignItems: "center",
|
|
6078
|
-
shadowColor: "#000",
|
|
6079
|
-
shadowOffset: {
|
|
6080
|
-
width: 0,
|
|
6081
|
-
height: 2,
|
|
6082
|
-
},
|
|
6083
|
-
shadowOpacity: 0.25,
|
|
6084
|
-
shadowRadius: 3.84,
|
|
6085
|
-
elevation: 5,
|
|
6086
|
-
zIndex: 99,
|
|
6087
6106
|
},
|
|
6088
6107
|
});
|
|
6089
6108
|
var index$1 = memoDeepEqual(FloatingButton);
|
|
@@ -6444,21 +6463,6 @@ var Badge = function (_a) {
|
|
|
6444
6463
|
React__default.createElement(Text$1, { size: 12, color: textColor || colors.textSecondary, style: textStyle }, value))));
|
|
6445
6464
|
};
|
|
6446
6465
|
|
|
6447
|
-
Dimensions.get("window").height;
|
|
6448
|
-
Dimensions.get("window").width;
|
|
6449
|
-
var BUTTON_HEIGHT = 48;
|
|
6450
|
-
var BUTTON_HEIGHT_SMALL = 40;
|
|
6451
|
-
var SPACE_4 = 4;
|
|
6452
|
-
var SPACE_6 = 6;
|
|
6453
|
-
var SPACE_8 = 8;
|
|
6454
|
-
var SPACE_12 = 12;
|
|
6455
|
-
var SPACE_16 = 16;
|
|
6456
|
-
//MARK: Border radius
|
|
6457
|
-
var BORDER_RADIUS_6 = 6;
|
|
6458
|
-
//MARK: Border width
|
|
6459
|
-
StyleSheet.hairlineWidth; //0.3-0.5
|
|
6460
|
-
var BORDER_WIDTH_1 = 1;
|
|
6461
|
-
|
|
6462
6466
|
var containerStyles = StyleSheet.create({
|
|
6463
6467
|
container: { flex: 1 },
|
|
6464
6468
|
center: {
|
|
@@ -6594,10 +6598,10 @@ var styles$5 = StyleSheet.create(__assign(__assign({}, containerStyles), { conta
|
|
|
6594
6598
|
} }));
|
|
6595
6599
|
|
|
6596
6600
|
var ChipBar = function (_a) {
|
|
6597
|
-
var style = _a.style, _b = _a.borderRadius, borderRadius = _b === void 0 ? CONSTANTS.BORDER_RADIUS_ROUNDED : _b, _c = _a.title, title = _c === void 0 ? "content" : _c, textStyle = _a.textStyle, onPress = _a.onPress, _d = _a.disabled, disabled = _d === void 0 ? false : _d, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, _e = _a.badge, badge = _e === void 0 ? 0 : _e, _f = _a.isActive, isActive = _f === void 0 ? false : _f;
|
|
6601
|
+
var style = _a.style, _b = _a.borderRadius, borderRadius = _b === void 0 ? CONSTANTS.BORDER_RADIUS_ROUNDED : _b, _c = _a.title, title = _c === void 0 ? "content" : _c, textStyle = _a.textStyle, onPress = _a.onPress, _d = _a.disabled, disabled = _d === void 0 ? false : _d, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, _e = _a.badge, badge = _e === void 0 ? 0 : _e, _f = _a.isActive, isActive = _f === void 0 ? false : _f, _g = _a.ellipsizeMode, ellipsizeMode = _g === void 0 ? "tail" : _g, _h = _a.numberOfLines, numberOfLines = _h === void 0 ? 1 : _h;
|
|
6598
6602
|
var theme = useInternalTheme();
|
|
6599
6603
|
var colors = theme.colors;
|
|
6600
|
-
var
|
|
6604
|
+
var _j = useState(isActive), active = _j[0], setActive = _j[1];
|
|
6601
6605
|
var handlePressChipBar = useCallback(function () {
|
|
6602
6606
|
setActive(!active);
|
|
6603
6607
|
onPress === null || onPress === void 0 ? void 0 : onPress();
|
|
@@ -6617,7 +6621,7 @@ var ChipBar = function (_a) {
|
|
|
6617
6621
|
: colors.backgroundSecondary },
|
|
6618
6622
|
leftIcon && React__default.createElement(View, { paddingRight: CONSTANTS.SPACE_4 }, leftIcon),
|
|
6619
6623
|
React__default.createElement(View, null,
|
|
6620
|
-
React__default.createElement(Text$1, { color: active ? colors.textBrandDefault : colors.textDefault, style: [
|
|
6624
|
+
React__default.createElement(Text$1, { numberOfLines: numberOfLines, ellipsizeMode: ellipsizeMode, color: active ? colors.textBrandDefault : colors.textDefault, style: [
|
|
6621
6625
|
styles$4.text14,
|
|
6622
6626
|
styles$4.textMedium,
|
|
6623
6627
|
disabled && {
|