@lamenna/lxp-native 0.1.0 → 0.1.1

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.
@@ -3,4 +3,4 @@ import { TouchableOpacityProps } from "react-native";
3
3
  import { ReactNativeButtonProps } from "@lamenna/lxp-shared-components";
4
4
  export type { ReactNativeButtonProps as ButtonProps };
5
5
  type Props = ReactNativeButtonProps & Omit<TouchableOpacityProps, "style">;
6
- export declare const Button: ({ children, variant, size, disabled, testID, onPress, ...rest }: Props) => React.JSX.Element;
6
+ export declare const Button: ({ children, label, variant, size, disabled, testID, onPress, ...rest }: Props) => React.JSX.Element;
@@ -1,9 +1,12 @@
1
1
  import React from "react";
2
2
  import { TouchableOpacity, Text, StyleSheet, } from "react-native";
3
3
  import { buttonConfig, } from "@lamenna/lxp-shared-components";
4
- export const Button = ({ children, variant = "primary", size = "md", disabled = false, testID, onPress, ...rest }) => {
4
+ export const Button = ({ children, label, variant = "primary", size = "md", disabled = false, testID, onPress, ...rest }) => {
5
5
  const variantConfig = buttonConfig.variants[variant];
6
6
  const sizeStyle = size === "sm" ? styles.small : size === "lg" ? styles.large : styles.medium;
7
+ // `label` is the platform-agnostic text prop; `children` takes precedence for
8
+ // callers that need richer content.
9
+ const content = children ?? label;
7
10
  return (<TouchableOpacity style={[
8
11
  styles.button,
9
12
  {
@@ -13,7 +16,7 @@ export const Button = ({ children, variant = "primary", size = "md", disabled =
13
16
  disabled && styles.disabled,
14
17
  ]} onPress={onPress} activeOpacity={0.7} disabled={disabled} testID={testID} {...rest}>
15
18
  <Text style={[styles.text, { color: variantConfig.color }]}>
16
- {children}
19
+ {content}
17
20
  </Text>
18
21
  </TouchableOpacity>);
19
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lamenna/lxp-native",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "React Native components for LXP",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",