@artsy/palette-mobile 17.15.0 → 17.17.0

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.
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { StyleProp, ViewStyle } from "react-native";
2
3
  import { FastImageProps } from "react-native-fast-image";
3
4
  import { GeminiResizeMode } from "../../utils/createGeminiUrl";
4
5
  type CustomFastImageProps = Omit<FastImageProps, "onLoadStart" | "onLoadEnd" | "source">;
@@ -21,4 +22,13 @@ export interface ImageProps extends CustomFastImageProps {
21
22
  src: string;
22
23
  }
23
24
  export declare const Image: React.FC<ImageProps>;
25
+ type ImageSkeletonProps = {
26
+ dimensions: {
27
+ width: number;
28
+ height: number;
29
+ };
30
+ blurhash?: string | null | undefined;
31
+ style?: StyleProp<ViewStyle>;
32
+ };
33
+ export declare const ImageSkeleton: React.FC<ImageSkeletonProps>;
24
34
  export {};
@@ -25,7 +25,7 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
25
25
  // eslint-disable-next-line react-hooks/exhaustive-deps
26
26
  }, []);
27
27
  if (showLoadingState) {
28
- return _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash });
28
+ return (_jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }));
29
29
  }
30
30
  let uri = src;
31
31
  if (performResize) {
@@ -36,7 +36,7 @@ export const Image = memo(({ aspectRatio, width, height, performResize = true, s
36
36
  resizeMode: geminiResizeMode,
37
37
  });
38
38
  }
39
- return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [_jsx(View, { style: [dimensions, { position: "absolute" }], children: _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash }) }), _jsx(Animated.View, { style: animatedStyles, children: _jsx(FastImage, { style: [
39
+ return (_jsxs(Flex, { position: "relative", ...flexProps, style: { ...dimensions }, children: [_jsx(View, { style: [dimensions, { position: "absolute" }], children: _jsx(ImageSkeleton, { dimensions: dimensions, blurhash: blurhash, style: { position: "absolute" } }) }), _jsx(Animated.View, { style: animatedStyles, children: _jsx(FastImage, { style: [
40
40
  dimensions,
41
41
  style,
42
42
  // If we have a blurhash, we don't want to show a background color
@@ -67,9 +67,9 @@ const useImageDimensions = (props) => {
67
67
  };
68
68
  return dimensions;
69
69
  };
70
- const ImageSkeleton = ({ dimensions, blurhash }) => {
70
+ export const ImageSkeleton = ({ dimensions, blurhash, style }) => {
71
71
  if (!!blurhash) {
72
- return (_jsx(Flex, { position: "absolute", backgroundColor: "mono10", ...dimensions, children: _jsx(Blurhash, { blurhash: blurhash, style: { flex: 1 }, decodeWidth: 16, decodeHeight: 16 }) }));
72
+ return (_jsx(Flex, { backgroundColor: "mono10", ...dimensions, style: style, children: _jsx(Blurhash, { blurhash: blurhash, style: { flex: 1 }, decodeWidth: 16, decodeHeight: 16 }) }));
73
73
  }
74
- return (_jsx(Flex, { position: "absolute", children: _jsx(Skeleton, { children: _jsx(SkeletonBox, { ...dimensions }) }) }));
74
+ return (_jsx(Flex, { style: style, children: _jsx(Skeleton, { children: _jsx(SkeletonBox, { ...dimensions }) }) }));
75
75
  };
@@ -11,11 +11,6 @@ export interface InputProps extends Omit<TextInputProps, "placeholder" | "onChan
11
11
  * These lead to some issues when the parent component wants further control of the value
12
12
  */
13
13
  disabled?: boolean;
14
- /**
15
- * Enables the clear button
16
- * @warning This prop only works if `value` is specified
17
- */
18
- enableClearButton?: boolean;
19
14
  error?: string;
20
15
  fixedRightPlaceholder?: string;
21
16
  hintText?: string;
@@ -72,6 +67,19 @@ export interface InputProps extends Omit<TextInputProps, "placeholder" | "onChan
72
67
  */
73
68
  value?: string | undefined;
74
69
  }
70
+ type InputPropsWithSecureText = InputProps & {
71
+ secureTextEntry: true;
72
+ enableClearButton?: never;
73
+ };
74
+ type InputPropsWithClearButton = InputProps & {
75
+ enableClearButton: true;
76
+ secureTextEntry?: never;
77
+ };
78
+ type InputPropsWithNeither = InputProps & {
79
+ enableClearButton?: boolean;
80
+ secureTextEntry?: boolean;
81
+ };
82
+ export type InputComponentProps = InputPropsWithSecureText | InputPropsWithClearButton | InputPropsWithNeither;
75
83
  export declare const HORIZONTAL_PADDING = 15;
76
84
  export declare const INPUT_BORDER_RADIUS = 4;
77
85
  export declare const INPUT_MIN_HEIGHT = 56;
@@ -85,5 +93,6 @@ export interface InputRef {
85
93
  blur: () => void;
86
94
  clear: () => void;
87
95
  }
88
- export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<InputRef>>;
96
+ export declare const Input: import("react").ForwardRefExoticComponent<InputComponentProps & import("react").RefAttributes<InputRef>>;
89
97
  export type Input = TextInput;
98
+ export {};
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { InputProps } from "../Input";
2
+ import { type InputProps } from "../Input";
3
3
  export interface SearchInputProps extends InputProps {
4
4
  enableCancelButton?: boolean;
5
5
  }
package/dist/setupJest.js CHANGED
@@ -1,4 +1,10 @@
1
1
  import "@testing-library/react-native/extend-expect";
2
2
  import mockSafeAreaContext from "react-native-safe-area-context/jest/mock";
3
3
  jest.mock("react-native-safe-area-context", () => mockSafeAreaContext);
4
+ jest.mock("react-native-blurhash", () => {
5
+ const ReactNative = require("react-native");
6
+ return {
7
+ Blurhash: ReactNative.View,
8
+ };
9
+ });
4
10
  require("react-native-reanimated").setUpTests();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artsy/palette-mobile",
3
- "version": "17.15.0",
3
+ "version": "17.17.0",
4
4
  "description": "Artsy's design system for React Native",
5
5
  "scripts": {
6
6
  "android": "RCT_METRO_PORT=8082 react-native run-android --port 8082 --terminal terminal",
@@ -41,7 +41,7 @@
41
41
  "lodash": "^4.17.21",
42
42
  "moti": "^0.25.3",
43
43
  "react-nanny": "^2.15.0",
44
- "react-native-blurhash": "^1.1.11",
44
+ "react-native-blurhash": "^2.1.1",
45
45
  "react-native-collapsible-tab-view": "^8.0.0",
46
46
  "react-native-fast-image": "^8.6.3",
47
47
  "react-native-pager-view": "6.5.0",