sapo-components-ui-rn 1.0.85 → 1.0.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.
@@ -11,7 +11,7 @@ export interface ButtonProps extends TouchableOpacityProps {
11
11
  isLoading?: boolean;
12
12
  left?: React.ReactNode;
13
13
  right?: React.ReactNode;
14
- margin?: Number;
14
+ margin?: number;
15
15
  textProps?: IText;
16
16
  textColor?: string;
17
17
  bold?: boolean;
@@ -24,7 +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;
29
+ width?: number;
28
30
  }
29
- 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, ...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>;
30
32
  export default _default;
@@ -27,6 +27,7 @@ interface ViewProps {
27
27
  marginBottom?: number;
28
28
  marginLeft?: number;
29
29
  marginRight?: number;
30
+ margin?: number;
30
31
  style?: StyleProp<ViewStyle>;
31
32
  children?: React.ReactNode;
32
33
  alignEnd?: boolean;
@@ -45,5 +46,5 @@ interface ViewProps {
45
46
  pointerEvents?: "box-none" | "box-only" | "none" | "auto";
46
47
  gap?: number;
47
48
  }
48
- declare const _default: React.MemoExoticComponent<({ row, full, justifyCenter, justifyBetween, alignCenter, center, color, backgroundColor, width, height, padding, paddingHorizontal, paddingVertical, marginHorizontal, marginVertical, paddingLeft, paddingRight, paddingTop, alignEnd, wrap, borderBottomWidth, borderBottomColor, borderRadius, borderWidth, borderColor, style, onPress, activeOpacity, children, disabled, paddingBottom, marginTop, marginBottom, marginLeft, marginRight, borderTopWidth, borderTopColor, borderLeftWidth, borderLeftColor, borderRightWidth, borderRightColor, pointerEvents, gap, }: ViewProps) => React.JSX.Element>;
49
+ declare const _default: React.MemoExoticComponent<({ row, full, justifyCenter, justifyBetween, alignCenter, center, color, backgroundColor, width, height, padding, paddingHorizontal, paddingVertical, marginHorizontal, marginVertical, paddingLeft, paddingRight, paddingTop, alignEnd, wrap, borderBottomWidth, borderBottomColor, borderRadius, borderWidth, borderColor, style, onPress, activeOpacity, children, disabled, paddingBottom, marginTop, marginBottom, marginLeft, marginRight, margin, borderTopWidth, borderTopColor, borderLeftWidth, borderLeftColor, borderRightWidth, borderRightColor, pointerEvents, gap, }: ViewProps) => React.JSX.Element>;
49
50
  export default _default;
package/dist/index.esm.js CHANGED
@@ -1628,7 +1628,7 @@ function adaptNavigationTheme(themes) {
1628
1628
  }
1629
1629
 
1630
1630
  var ViewCustom = function (_a) {
1631
- 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, borderTopWidth = _a.borderTopWidth, borderTopColor = _a.borderTopColor, borderLeftWidth = _a.borderLeftWidth, borderLeftColor = _a.borderLeftColor, borderRightWidth = _a.borderRightWidth, borderRightColor = _a.borderRightColor, pointerEvents = _a.pointerEvents, gap = _a.gap;
1631
+ 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;
1632
1632
  var getStyle = function () {
1633
1633
  var styleCustom = {};
1634
1634
  if (row) {
@@ -1677,6 +1677,9 @@ var ViewCustom = function (_a) {
1677
1677
  if (marginVertical) {
1678
1678
  styleCustom.marginVertical = marginVertical;
1679
1679
  }
1680
+ if (margin) {
1681
+ styleCustom.margin = margin;
1682
+ }
1680
1683
  if (paddingLeft) {
1681
1684
  styleCustom.paddingLeft = paddingLeft;
1682
1685
  }
@@ -5358,7 +5361,7 @@ var TextInputFlat = function (_a) {
5358
5361
  contentStyle,
5359
5362
  ] })),
5360
5363
  renderSuffix())),
5361
- !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: styles$d.clearButton },
5364
+ parentState.focused && !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: styles$d.clearButton },
5362
5365
  React$3.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))) : (React$3.createElement(Spacer, { width: SPACE_12 })),
5363
5366
  checkLineRightAction() && (React$3.createElement(Spacer, { width: 1, height: 24, backgroundColor: theme.colors.borderPrimaryDefault, style: {
5364
5367
  marginRight: SPACE_8,
@@ -5608,7 +5611,7 @@ var TextInputDefault = function (_a) {
5608
5611
  contentStyle,
5609
5612
  ] })),
5610
5613
  !multiline && renderSuffix()))),
5611
- !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: multiline ? styles$c.clearButtonMultiline : styles$c.clearButton },
5614
+ parentState.focused && !disabled && clearButton && inputValue ? (React$3.createElement(TouchableOpacity, { onPress: handleClear, style: multiline ? styles$c.clearButtonMultiline : styles$c.clearButton },
5612
5615
  React$3.createElement(Icon$1, { name: "IconClearText", type: "Svg", size: 24 }))) : (React$3.createElement(Spacer, { width: CONSTANTS.SPACE_12 })),
5613
5616
  checkLineRightAction() && (React$3.createElement(Spacer, { width: 1, height: 24, backgroundColor: colors.borderPrimaryDefault, style: {
5614
5617
  marginRight: CONSTANTS.SPACE_8,
@@ -6248,7 +6251,7 @@ var TextInput = forwardRef(function (_a, ref) {
6248
6251
  TextInput.Affix = TextInputAffix;
6249
6252
 
6250
6253
  var Button = function (_a) {
6251
- var style = _a.style, title = _a.title; _a.border; var borderColor = _a.borderColor, isLoading = _a.isLoading, left = _a.left, right = _a.right; _a.margin; var 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, 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"]);
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"]);
6252
6255
  var theme = useInternalTheme();
6253
6256
  var colors = theme.colors;
6254
6257
  var disabledTextStyle = {
@@ -6297,9 +6300,30 @@ var Button = function (_a) {
6297
6300
  return colors.textBrandDefault;
6298
6301
  }
6299
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
+ }
6300
6324
  return (React__default.createElement(View, { row: !full },
6301
6325
  React__default.createElement(ScaleButton$1, __assign({ activeOpacity: 0.8, onPress: onPress }, props, { disabled: disabled || isLoading }),
6302
- React__default.createElement(View, { style: [
6326
+ React__default.createElement(View, { width: width, margin: margin, style: [
6303
6327
  styles$a.button,
6304
6328
  {
6305
6329
  borderRadius: CONSTANTS.BORDER_RADIUS_6,
@@ -6321,24 +6345,28 @@ var Button = function (_a) {
6321
6345
  ],
6322
6346
  isLoading && { justifyContent: "center" },
6323
6347
  style,
6324
- ], disabled: isLoading },
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 },
6325
6349
  React__default.createElement(Spacer, { width: left ? CONSTANTS.SPACE_12 : CONSTANTS.SPACE_16 }),
6326
6350
  !isLoading && left,
6327
- left && (React__default.createElement(Spacer, { width: buttonSize === "small" ? CONSTANTS.SPACE_4 : CONSTANTS.SPACE_8 })),
6328
- isLoading ? (React__default.createElement(ActivityIndicator, { color: (textStyle === null || textStyle === void 0 ? void 0 : textStyle.color) || renderTextColor() })) : (React__default.createElement(View, { full: true, center: true },
6329
- React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: textColor || renderTextColor(), size: size, bold: bold, medium: medium, style: [disabled && disabledTextStyle, textStyle] }, textProps), title))),
6330
- right && (React__default.createElement(Spacer, { width: buttonSize === "small" ? CONSTANTS.SPACE_4 : CONSTANTS.SPACE_8 })),
6351
+ left && (React__default.createElement(Spacer, { width: buttonSize === "small"
6352
+ ? CONSTANTS.SPACE_4
6353
+ : CONSTANTS.SPACE_8 })),
6354
+ React__default.createElement(View, { center: true },
6355
+ React__default.createElement(Text$1, __assign({ numberOfLines: 1, color: textColor || renderTextColor(), size: size, bold: bold, medium: medium, style: [disabled && disabledTextStyle, textStyle] }, textProps), title)),
6356
+ right && (React__default.createElement(Spacer, { width: buttonSize === "small"
6357
+ ? CONSTANTS.SPACE_4
6358
+ : CONSTANTS.SPACE_8 })),
6331
6359
  !isLoading && right,
6332
- React__default.createElement(Spacer, { width: right ? CONSTANTS.SPACE_12 : CONSTANTS.SPACE_16 })))));
6360
+ React__default.createElement(Spacer, { width: right ? CONSTANTS.SPACE_12 : CONSTANTS.SPACE_16 })))))));
6333
6361
  };
6334
6362
  var styles$a = StyleSheet.create({
6335
6363
  disabled: { opacity: 0.6 },
6336
6364
  button: {
6337
6365
  height: CONSTANTS.BUTTON_HEIGHT,
6338
- flexDirection: "row",
6339
6366
  alignItems: "center",
6340
6367
  justifyContent: "center",
6341
- minWidth: CONSTANTS.DEVICE_WIDTH / 4.5,
6368
+ minWidth: CONSTANTS.DEVICE_WIDTH / 4,
6369
+ paddingHorizontal: CONSTANTS.SPACE_12,
6342
6370
  },
6343
6371
  border: {
6344
6372
  borderWidth: CONSTANTS.BORDER_WIDTH_1,