sapo-components-ui-rn 1.0.86 → 1.0.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/dist/components/Button/index.d.ts +2 -1
- package/dist/index.esm.js +26 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +60 -5
|
@@ -24,8 +24,9 @@ export interface ButtonProps extends TouchableOpacityProps {
|
|
|
24
24
|
full?: boolean;
|
|
25
25
|
theme?: ThemeProp;
|
|
26
26
|
buttonSize?: "normal" | "small";
|
|
27
|
+
type?: "default" | "text";
|
|
27
28
|
critical?: boolean;
|
|
28
29
|
width?: number;
|
|
29
30
|
}
|
|
30
|
-
declare const _default: React.MemoExoticComponent<({ style, title, border, borderColor, isLoading, left, right, margin, textStyle, textProps, onPress, disabled, backgroundColor, textColor, bold, medium, mode, transparent, full, theme: themeOverrides, buttonSize, size, critical, width, ...props }: ButtonProps) => React.JSX.Element>;
|
|
31
|
+
declare const _default: React.MemoExoticComponent<({ style, title, border, borderColor, isLoading, left, right, margin, textStyle, textProps, onPress, disabled, backgroundColor, textColor, bold, medium, mode, transparent, full, theme: themeOverrides, buttonSize, size, critical, width, type, ...props }: ButtonProps) => React.JSX.Element>;
|
|
31
32
|
export default _default;
|
package/dist/index.esm.js
CHANGED
|
@@ -6251,7 +6251,7 @@ var TextInput = forwardRef(function (_a, ref) {
|
|
|
6251
6251
|
TextInput.Affix = TextInputAffix;
|
|
6252
6252
|
|
|
6253
6253
|
var Button = function (_a) {
|
|
6254
|
-
var style = _a.style, title = _a.title; _a.border; var borderColor = _a.borderColor, isLoading = _a.isLoading, left = _a.left, right = _a.right, margin = _a.margin, textStyle = _a.textStyle, textProps = _a.textProps, onPress = _a.onPress, disabled = _a.disabled, backgroundColor = _a.backgroundColor, textColor = _a.textColor, _b = _a.bold, bold = _b === void 0 ? true : _b, _c = _a.medium, medium = _c === void 0 ? false : _c, _d = _a.mode, mode = _d === void 0 ? "contained" : _d; _a.transparent; var _f = _a.full, full = _f === void 0 ? false : _f; _a.theme; var _g = _a.buttonSize, buttonSize = _g === void 0 ? "normal" : _g, _h = _a.size, size = _h === void 0 ? buttonSize === "small" ? 14 : 16 : _h, _j = _a.critical, critical = _j === void 0 ? false : _j, width = _a.width, props = __rest(_a, ["style", "title", "border", "borderColor", "isLoading", "left", "right", "margin", "textStyle", "textProps", "onPress", "disabled", "backgroundColor", "textColor", "bold", "medium", "mode", "transparent", "full", "theme", "buttonSize", "size", "critical", "width"]);
|
|
6254
|
+
var style = _a.style, title = _a.title; _a.border; var borderColor = _a.borderColor, isLoading = _a.isLoading, left = _a.left, right = _a.right, margin = _a.margin, textStyle = _a.textStyle, textProps = _a.textProps, onPress = _a.onPress, disabled = _a.disabled, backgroundColor = _a.backgroundColor, textColor = _a.textColor, _b = _a.bold, bold = _b === void 0 ? true : _b, _c = _a.medium, medium = _c === void 0 ? false : _c, _d = _a.mode, mode = _d === void 0 ? "contained" : _d; _a.transparent; var _f = _a.full, full = _f === void 0 ? false : _f; _a.theme; var _g = _a.buttonSize, buttonSize = _g === void 0 ? "normal" : _g, _h = _a.size, size = _h === void 0 ? buttonSize === "small" ? 14 : 16 : _h, _j = _a.critical, critical = _j === void 0 ? false : _j, width = _a.width, _k = _a.type, type = _k === void 0 ? "default" : _k, props = __rest(_a, ["style", "title", "border", "borderColor", "isLoading", "left", "right", "margin", "textStyle", "textProps", "onPress", "disabled", "backgroundColor", "textColor", "bold", "medium", "mode", "transparent", "full", "theme", "buttonSize", "size", "critical", "width", "type"]);
|
|
6255
6255
|
var theme = useInternalTheme();
|
|
6256
6256
|
var colors = theme.colors;
|
|
6257
6257
|
var disabledTextStyle = {
|
|
@@ -6300,6 +6300,27 @@ var Button = function (_a) {
|
|
|
6300
6300
|
return colors.textBrandDefault;
|
|
6301
6301
|
}
|
|
6302
6302
|
};
|
|
6303
|
+
if (type === "text") {
|
|
6304
|
+
return (React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || isLoading }),
|
|
6305
|
+
React__default.createElement(View, { width: width, margin: margin, style: [
|
|
6306
|
+
styles$a.button,
|
|
6307
|
+
{
|
|
6308
|
+
borderRadius: CONSTANTS.BORDER_RADIUS_6,
|
|
6309
|
+
paddingHorizontal: 0,
|
|
6310
|
+
},
|
|
6311
|
+
styles$a.small,
|
|
6312
|
+
disabled && !isLoading && [styles$a.disabled],
|
|
6313
|
+
isLoading && { justifyContent: "center" },
|
|
6314
|
+
style,
|
|
6315
|
+
], disabled: isLoading }, isLoading ? (React__default.createElement(ActivityIndicator, { color: (textStyle === null || textStyle === void 0 ? void 0 : textStyle.color) || colors.textBrandDefault })) : (React__default.createElement(View, { row: true, paddingHorizontal: CONSTANTS.SPACE_12 },
|
|
6316
|
+
React__default.createElement(Spacer, { width: left ? CONSTANTS.SPACE_12 : CONSTANTS.SPACE_16 }),
|
|
6317
|
+
!isLoading && left,
|
|
6318
|
+
left && React__default.createElement(Spacer, { width: CONSTANTS.SPACE_4 }),
|
|
6319
|
+
React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: textColor || colors.textBrandDefault, size: size, bold: bold, medium: medium, style: [disabled && disabledTextStyle, textStyle] }, textProps), title),
|
|
6320
|
+
right && React__default.createElement(Spacer, { width: CONSTANTS.SPACE_4 }),
|
|
6321
|
+
!isLoading && right,
|
|
6322
|
+
React__default.createElement(Spacer, { width: right ? CONSTANTS.SPACE_12 : CONSTANTS.SPACE_16 }))))));
|
|
6323
|
+
}
|
|
6303
6324
|
return (React__default.createElement(View, { row: !full },
|
|
6304
6325
|
React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || isLoading }),
|
|
6305
6326
|
React__default.createElement(View, { width: width, margin: margin, style: [
|
|
@@ -6324,13 +6345,13 @@ var Button = function (_a) {
|
|
|
6324
6345
|
],
|
|
6325
6346
|
isLoading && { justifyContent: "center" },
|
|
6326
6347
|
style,
|
|
6327
|
-
], disabled: isLoading }, isLoading ? (React__default.createElement(ActivityIndicator, { color: (textStyle === null || textStyle === void 0 ? void 0 : textStyle.color) || renderTextColor() })) : (React__default.createElement(View, {
|
|
6348
|
+
], disabled: isLoading }, isLoading ? (React__default.createElement(ActivityIndicator, { color: (textStyle === null || textStyle === void 0 ? void 0 : textStyle.color) || renderTextColor() })) : (React__default.createElement(View, { row: true, paddingHorizontal: CONSTANTS.SPACE_12 },
|
|
6328
6349
|
React__default.createElement(Spacer, { width: left ? CONSTANTS.SPACE_12 : CONSTANTS.SPACE_16 }),
|
|
6329
6350
|
!isLoading && left,
|
|
6330
6351
|
left && (React__default.createElement(Spacer, { width: buttonSize === "small"
|
|
6331
6352
|
? CONSTANTS.SPACE_4
|
|
6332
6353
|
: CONSTANTS.SPACE_8 })),
|
|
6333
|
-
React__default.createElement(View, {
|
|
6354
|
+
React__default.createElement(View, { center: true },
|
|
6334
6355
|
React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: textColor || renderTextColor(), size: size, bold: bold, medium: medium, style: [disabled && disabledTextStyle, textStyle] }, textProps), title)),
|
|
6335
6356
|
right && (React__default.createElement(Spacer, { width: buttonSize === "small"
|
|
6336
6357
|
? CONSTANTS.SPACE_4
|
|
@@ -6342,10 +6363,10 @@ var styles$a = StyleSheet.create({
|
|
|
6342
6363
|
disabled: { opacity: 0.6 },
|
|
6343
6364
|
button: {
|
|
6344
6365
|
height: CONSTANTS.BUTTON_HEIGHT,
|
|
6345
|
-
// flexDirection: "row",
|
|
6346
6366
|
alignItems: "center",
|
|
6347
6367
|
justifyContent: "center",
|
|
6348
|
-
minWidth: CONSTANTS.DEVICE_WIDTH / 4,
|
|
6368
|
+
minWidth: CONSTANTS.DEVICE_WIDTH / 4.5,
|
|
6369
|
+
paddingHorizontal: CONSTANTS.SPACE_12,
|
|
6349
6370
|
},
|
|
6350
6371
|
border: {
|
|
6351
6372
|
borderWidth: CONSTANTS.BORDER_WIDTH_1,
|