@artsy/palette-mobile 8.7.2 → 8.7.3

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.
@@ -30,5 +30,5 @@ export interface ButtonProps extends BoxProps {
30
30
  /** Used only for tests and stories */
31
31
  testOnly_pressed?: PressableProps["testOnly_pressed"];
32
32
  }
33
- export declare const Button: ({ children, disabled: disabledProp, haptic, icon, iconPosition, loading: loadingProp, block, longestText, onPress, size, style, variant, testOnly_pressed, testID, ...restProps }: ButtonProps) => JSX.Element;
33
+ export declare const Button: ({ children, disabled: disabledProp, haptic, icon, iconPosition, loading: loadingProp, block, longestText, onPress, size, variant, testOnly_pressed, testID, ...restProps }: ButtonProps) => JSX.Element;
34
34
  export {};
@@ -34,10 +34,8 @@ const react_native_haptic_feedback_1 = __importDefault(require("react-native-hap
34
34
  const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
35
35
  const __1 = require("../..");
36
36
  const MeasuredView_1 = require("../../utils/MeasuredView");
37
- const Spinner_1 = require("../Spinner");
38
- const Text_1 = require("../Text");
39
37
  const colors_1 = require("./colors");
40
- const Button = ({ children, disabled: disabledProp, haptic, icon, iconPosition = "left", loading: loadingProp, block, longestText, onPress, size = "large", style, variant = "fillDark", testOnly_pressed, testID, ...restProps }) => {
38
+ const Button = ({ children, disabled: disabledProp, haptic, icon, iconPosition = "left", loading: loadingProp, block, longestText, onPress, size = "large", variant = "fillDark", testOnly_pressed, testID, ...restProps }) => {
41
39
  // these are basically booleans
42
40
  const disabled = (0, react_native_reanimated_1.useSharedValue)(!!disabledProp ? 1 : 0);
43
41
  const loading = (0, react_native_reanimated_1.useSharedValue)(!!loadingProp ? 1 : 0);
@@ -47,8 +45,7 @@ const Button = ({ children, disabled: disabledProp, haptic, icon, iconPosition =
47
45
  loading.value = loadingProp ? 1 : 0;
48
46
  pressed.value = testOnly_pressed ? 1 : 0;
49
47
  }, [disabledProp, loadingProp, testOnly_pressed]);
50
- const color = (0, __1.useColor)();
51
- const textStyle = (0, Text_1.useTextStyleForPalette)(size === "small" ? "xs" : "sm");
48
+ const textStyle = (0, __1.useTextStyleForPalette)(size === "small" ? "xs" : "sm");
52
49
  const [longestTextMeasurements, setLongestTextMeasurements] = (0, react_1.useState)({
53
50
  width: 0,
54
51
  height: 0,
@@ -107,7 +104,7 @@ const Button = ({ children, disabled: disabledProp, haptic, icon, iconPosition =
107
104
  return;
108
105
  }
109
106
  pressed.value = 0;
110
- }, onPress: handlePress, testID: testID, testOnly_pressed: testOnly_pressed, children: (0, jsx_runtime_1.jsx)(__1.Flex, { ...restProps, height: height, width: block ? "100%" : undefined, borderRadius: 50, overflow: "hidden", children: (0, jsx_runtime_1.jsxs)(react_native_reanimated_1.default.View, { style: [{ borderWidth: 1, borderRadius: 50, overflow: "hidden" }, containerColorsAnim], children: [(0, jsx_runtime_1.jsxs)(__1.Flex, { height: "100%", mx: "25px", flexDirection: "row", alignItems: "center", justifyContent: "center", children: [iconPosition === "left-start" && !!icon ? ((0, jsx_runtime_1.jsxs)(__1.Box, { position: "absolute", left: 0, children: [icon, (0, jsx_runtime_1.jsx)(__1.Spacer, { x: 0.5 })] })) : null, iconPosition === "left" && !!icon ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon, (0, jsx_runtime_1.jsx)(__1.Spacer, { x: 0.5 })] })) : null, (0, jsx_runtime_1.jsx)(AText, { style: [{ width: Math.ceil(longestTextMeasurements.width) }, textStyle, textAnim], textAlign: "center", children: children }), !__TEST__ && ((0, jsx_runtime_1.jsx)(MeasuredView_1.MeasuredView, { setMeasuredState: setLongestTextMeasurements, children: (0, jsx_runtime_1.jsx)(Text_1.Text, { color: "red", style: textStyle, children: longestText ? longestText : children }) })), iconPosition === "right" && !!icon ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(__1.Spacer, { x: 0.5 }), icon] })) : null] }), loading.value === 1 ? ((0, jsx_runtime_1.jsx)(__1.Box, { position: "absolute", width: "100%", height: "100%", alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(Spinner_1.Spinner, { size: size, color: spinnerColor }) })) : null] }) }) }));
107
+ }, onPress: handlePress, testID: testID, testOnly_pressed: testOnly_pressed, children: (0, jsx_runtime_1.jsx)(__1.Flex, { ...restProps, height: height, width: block ? "100%" : undefined, borderRadius: 50, overflow: "hidden", children: (0, jsx_runtime_1.jsxs)(react_native_reanimated_1.default.View, { style: [{ borderWidth: 1, borderRadius: 50, overflow: "hidden" }, containerColorsAnim], children: [(0, jsx_runtime_1.jsxs)(__1.Flex, { height: "100%", mx: "25px", flexDirection: "row", alignItems: "center", justifyContent: "center", children: [iconPosition === "left-start" && !!icon ? ((0, jsx_runtime_1.jsxs)(__1.Box, { position: "absolute", left: 0, children: [icon, (0, jsx_runtime_1.jsx)(__1.Spacer, { x: 0.5 })] })) : null, iconPosition === "left" && !!icon ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [icon, (0, jsx_runtime_1.jsx)(__1.Spacer, { x: 0.5 })] })) : null, (0, jsx_runtime_1.jsx)(AText, { style: [{ width: Math.ceil(longestTextMeasurements.width) }, textStyle, textAnim], textAlign: "center", children: children }), !__TEST__ && ((0, jsx_runtime_1.jsx)(MeasuredView_1.MeasuredView, { setMeasuredState: setLongestTextMeasurements, children: (0, jsx_runtime_1.jsx)(__1.Text, { color: "red", style: textStyle, children: longestText ? longestText : children }) })), iconPosition === "right" && !!icon ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(__1.Spacer, { x: 0.5 }), icon] })) : null] }), loading.value === 1 ? ((0, jsx_runtime_1.jsx)(__1.Box, { position: "absolute", width: "100%", height: "100%", alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(__1.Spinner, { size: size, color: spinnerColor }) })) : null] }) }) }));
111
108
  };
112
109
  exports.Button = Button;
113
- const AText = react_native_reanimated_1.default.createAnimatedComponent(Text_1.Text);
110
+ const AText = react_native_reanimated_1.default.createAnimatedComponent(__1.Text);
@@ -2,7 +2,7 @@
2
2
  import { ButtonProps } from ".";
3
3
  declare const _default: {
4
4
  title: string;
5
- component: ({ children, disabled: disabledProp, haptic, icon, iconPosition, loading: loadingProp, block, longestText, onPress, size, style, variant, testOnly_pressed, testID, ...restProps }: ButtonProps) => JSX.Element;
5
+ component: ({ children, disabled: disabledProp, haptic, icon, iconPosition, loading: loadingProp, block, longestText, onPress, size, variant, testOnly_pressed, testID, ...restProps }: ButtonProps) => JSX.Element;
6
6
  };
7
7
  export default _default;
8
8
  export declare const Sizes: () => JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "8.7.2",
3
+ "version": "8.7.3",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "react-native run-android",