@ledgerhq/native-ui 0.22.2 → 0.22.3-nightly.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.
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { InputStatus } from ".";
3
+ type AnimatedNotchedLabelProps = {
4
+ placeholder: string;
5
+ inputStatus: InputStatus;
6
+ };
7
+ export declare const AnimatedNotchedLabel: ({ placeholder, inputStatus }: AnimatedNotchedLabelProps) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,77 @@
1
+ import React from "react";
2
+ import styled from "styled-components/native";
3
+ import { Flex } from "../../../Layout";
4
+ import { Text } from "react-native";
5
+ import Animated, { useSharedValue, withTiming, useAnimatedStyle, useAnimatedReaction, Easing, } from "react-native-reanimated";
6
+ import { inputTextColor, inputStatusColors, inputBackgroundColor } from "./inputTextColor";
7
+ const labelPadding = 4;
8
+ const labelInitialPositions = {
9
+ top: 20.5,
10
+ left: 16 - labelPadding,
11
+ fontSize: 16,
12
+ };
13
+ const labelFinalPositions = {
14
+ top: -7,
15
+ left: 16 - labelPadding,
16
+ fontSize: 12,
17
+ };
18
+ const LabelContainer = styled(Animated.View) `
19
+ position: absolute;
20
+ padding: ${`0 ${labelPadding}px`};
21
+ display: inline-block;
22
+ height: 15;
23
+ z-index: ${(p) => (p.notched ? 3 : 0)};
24
+ `;
25
+ const AnimatedText = Animated.createAnimatedComponent(Text);
26
+ const LabelText = styled(AnimatedText) `
27
+ display: inline-block;
28
+ height: 15;
29
+ line-height: 15;
30
+ vertical-align: top;
31
+ color: ${(p) => p.status === "default" ? inputTextColor[p.status] : inputStatusColors[p.status]};
32
+ `;
33
+ const LineCutout = styled(Flex) `
34
+ position: absolute;
35
+ height: 1;
36
+ top: 7;
37
+ left: 0;
38
+ width: 120%;
39
+ background: ${(p) => inputBackgroundColor[p.status]};
40
+ `;
41
+ export const AnimatedNotchedLabel = ({ placeholder, inputStatus }) => {
42
+ const notched = inputStatus !== "default";
43
+ const labelTop = useSharedValue(notched ? labelFinalPositions.top : labelInitialPositions.top);
44
+ const labelLeft = useSharedValue(notched ? labelFinalPositions.left : labelInitialPositions.left);
45
+ const fontSize = useSharedValue(notched ? labelFinalPositions.fontSize : labelInitialPositions.fontSize);
46
+ const labelStyle = useAnimatedStyle(() => {
47
+ return {
48
+ top: labelTop.value,
49
+ left: labelLeft.value,
50
+ };
51
+ });
52
+ const labelFontSize = useAnimatedStyle(() => {
53
+ return {
54
+ fontSize: fontSize.value,
55
+ };
56
+ });
57
+ useAnimatedReaction(() => notched, (isNotched) => {
58
+ const targetTop = isNotched ? labelFinalPositions.top : labelInitialPositions.top;
59
+ const targetLeft = isNotched ? labelFinalPositions.left : labelInitialPositions.left;
60
+ const targetSize = isNotched ? labelFinalPositions.fontSize : labelInitialPositions.fontSize;
61
+ labelTop.value = withTiming(targetTop, undefined, () => ({
62
+ duration: 200,
63
+ easing: Easing.inOut(Easing.quad),
64
+ }));
65
+ labelLeft.value = withTiming(targetLeft, undefined, () => ({
66
+ duration: 200,
67
+ easing: Easing.inOut(Easing.quad),
68
+ }));
69
+ fontSize.value = withTiming(targetSize, undefined, () => ({
70
+ duration: 100,
71
+ easing: Easing.inOut(Easing.quad),
72
+ }));
73
+ }, [notched]);
74
+ return (React.createElement(LabelContainer, { style: Object.assign(Object.assign({}, labelStyle), { elevation: notched ? 3 : 0 }), notched: notched },
75
+ notched && React.createElement(LineCutout, { status: inputStatus }),
76
+ React.createElement(LabelText, { style: Object.assign({}, labelFontSize), status: inputStatus }, placeholder)));
77
+ };
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { type InputProps as BaseInputType } from "../BaseInput/index";
3
+ import { StyleProp, ViewStyle } from "react-native";
4
+ export type InputStatus = "default" | "focused" | "filled" | "error";
5
+ export interface AnimatedInputProps extends BaseInputType {
6
+ style?: StyleProp<ViewStyle>;
7
+ }
8
+ declare const _default: React.ForwardRefExoticComponent<AnimatedInputProps & React.RefAttributes<unknown>>;
9
+ export default _default;
@@ -0,0 +1,52 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React, { forwardRef } from "react";
13
+ import { BaseInput } from "..";
14
+ import styled, { useTheme } from "styled-components/native";
15
+ import { View } from "react-native";
16
+ import { inputTextColor, inputStatusColors, getInputStatus } from "./inputTextColor";
17
+ import { useAnimatedInputFocus } from "./useAnimatedInputFocus";
18
+ import { AnimatedNotchedLabel } from "./AnimatedNotchedLabel";
19
+ const InputContainer = styled(View) `
20
+ position: relative;
21
+ box-sizing: border-box;
22
+ height: fit-content;
23
+ `;
24
+ const AnimatedInput = (_a) => {
25
+ var { style = { width: "100%" } } = _a, textInputProps = __rest(_a, ["style"]);
26
+ const { placeholder, onFocus: onFocusCallback, onBlur: onBlurCallback, error, value } = textInputProps, rest = __rest(textInputProps, ["placeholder", "onFocus", "onBlur", "error", "value"]);
27
+ const theme = useTheme();
28
+ const { onFocus, onBlur, focused } = useAnimatedInputFocus({
29
+ onFocusCallback,
30
+ onBlurCallback,
31
+ });
32
+ const inputStatus = getInputStatus({ focused, hasError: !!error, hasValue: !!value });
33
+ const displayClearCross = inputStatus === "error" || inputStatus === "focused";
34
+ return (React.createElement(InputContainer, { status: inputStatus, style: style },
35
+ placeholder && React.createElement(AnimatedNotchedLabel, { placeholder: placeholder, inputStatus: inputStatus }),
36
+ React.createElement(BaseInput, Object.assign({ onFocus: onFocus, onBlur: onBlur, error: error, value: value, containerStyle: {
37
+ height: "100%",
38
+ }, color: theme ? inputTextColor[inputStatus]({ theme }) : "neutral.c100", inputContainerStyle: {
39
+ backgroundColor: "none",
40
+ borderColor: theme ? inputStatusColors[inputStatus]({ theme }) : "neutral.c100",
41
+ borderRadius: 8,
42
+ height: inputStatus !== "error" ? 56 : 48,
43
+ }, baseInputContainerStyle: {
44
+ paddingTop: 15,
45
+ paddingBottom: 15,
46
+ paddingLeft: 14,
47
+ paddingRight: displayClearCross ? 8 : 14,
48
+ }, inputErrorContainerStyles: {
49
+ marginTop: 8,
50
+ }, inputErrorColor: theme ? inputStatusColors[inputStatus]({ theme }) : "neutral.c100", showErrorIcon: true }, rest))));
51
+ };
52
+ export default forwardRef(AnimatedInput);
@@ -0,0 +1,29 @@
1
+ import { Theme } from "src/styles/theme";
2
+ export type CbThemeType = {
3
+ theme: Theme;
4
+ };
5
+ export declare const inputStatusColors: {
6
+ default: ({ theme }: CbThemeType) => string;
7
+ focused: ({ theme }: CbThemeType) => string;
8
+ filled: ({ theme }: CbThemeType) => string;
9
+ error: ({ theme }: CbThemeType) => string;
10
+ };
11
+ export declare const inputTextColor: {
12
+ default: ({ theme }: CbThemeType) => string;
13
+ focused: ({ theme }: CbThemeType) => string;
14
+ filled: ({ theme }: CbThemeType) => string;
15
+ error: ({ theme }: CbThemeType) => string;
16
+ };
17
+ export declare const inputBackgroundColor: {
18
+ default: ({ theme }: CbThemeType) => string;
19
+ focused: ({ theme }: CbThemeType) => string;
20
+ filled: ({ theme }: CbThemeType) => string;
21
+ error: ({ theme }: CbThemeType) => string;
22
+ };
23
+ type getInputStatusProps = {
24
+ focused?: boolean;
25
+ hasValue?: boolean;
26
+ hasError?: boolean;
27
+ };
28
+ export declare const getInputStatus: ({ focused, hasValue, hasError }: getInputStatusProps) => "error" | "default" | "focused" | "filled";
29
+ export {};
@@ -0,0 +1,27 @@
1
+ export const inputStatusColors = {
2
+ default: ({ theme }) => theme.colors.opacityDefault.c50,
3
+ focused: ({ theme }) => theme.colors.primary.c80,
4
+ filled: ({ theme }) => theme.colors.neutral.c60,
5
+ error: ({ theme }) => theme.colors.error.c50,
6
+ };
7
+ export const inputTextColor = {
8
+ default: ({ theme }) => theme.colors.opacityDefault.c70,
9
+ focused: ({ theme }) => theme.colors.neutral.c100,
10
+ filled: ({ theme }) => theme.colors.neutral.c100,
11
+ error: ({ theme }) => theme.colors.neutral.c100,
12
+ };
13
+ export const inputBackgroundColor = {
14
+ default: ({ theme }) => theme.colors.background.main,
15
+ focused: ({ theme }) => theme.colors.background.main,
16
+ filled: ({ theme }) => theme.colors.background.main,
17
+ error: ({ theme }) => theme.colors.background.main,
18
+ };
19
+ export const getInputStatus = ({ focused, hasValue, hasError }) => {
20
+ if (hasError)
21
+ return "error";
22
+ if (focused)
23
+ return "focused";
24
+ if (hasValue)
25
+ return "filled";
26
+ return "default";
27
+ };
@@ -0,0 +1,11 @@
1
+ import { NativeSyntheticEvent, TextInputFocusEventData } from "react-native";
2
+ type useAnimatedInputFocusProps = {
3
+ onFocusCallback?: (e: NativeSyntheticEvent<TextInputFocusEventData>) => TextInputFocusEventData | void;
4
+ onBlurCallback?: (e: NativeSyntheticEvent<TextInputFocusEventData>) => TextInputFocusEventData | void;
5
+ };
6
+ export declare const useAnimatedInputFocus: ({ onFocusCallback, onBlurCallback, }: useAnimatedInputFocusProps) => {
7
+ onFocus: (e: NativeSyntheticEvent<TextInputFocusEventData>) => void;
8
+ onBlur: (e: NativeSyntheticEvent<TextInputFocusEventData>) => void;
9
+ focused: boolean;
10
+ };
11
+ export {};
@@ -0,0 +1,13 @@
1
+ import { useState } from "react";
2
+ export const useAnimatedInputFocus = ({ onFocusCallback, onBlurCallback, }) => {
3
+ const [focused, setFocused] = useState(false);
4
+ const onFocus = (e) => {
5
+ setFocused(true);
6
+ onFocusCallback && onFocusCallback(e);
7
+ };
8
+ const onBlur = (e) => {
9
+ setFocused(false);
10
+ onBlurCallback && onBlurCallback(e);
11
+ };
12
+ return { onFocus, onBlur, focused };
13
+ };
@@ -1,6 +1,6 @@
1
1
  /// <reference types="styled-components-react-native" />
2
2
  import React from "react";
3
- import { TextInput, TextInputProps, StyleProp, ViewStyle } from "react-native";
3
+ import { TextInput, TextInputProps, StyleProp, ViewStyle, TextStyle } from "react-native";
4
4
  export type CommonProps = TextInputProps & {
5
5
  disabled?: boolean;
6
6
  error?: string;
@@ -13,11 +13,15 @@ export type InputProps<T = string> = Omit<CommonProps, "value" | "onChange"> & {
13
13
  /**
14
14
  * A function that will render some content on the left side of the input.
15
15
  */
16
- renderLeft?: ((props: InputProps<T>) => React.ReactNode) | React.ReactNode;
16
+ renderLeft?: ((props: InputProps<T>, ref: React.RefObject<{
17
+ clear: () => void;
18
+ }>) => React.ReactNode) | React.ReactNode;
17
19
  /**
18
20
  * A function that will render some content on the right side of the input.
19
21
  */
20
- renderRight?: ((props: InputProps<T>) => React.ReactNode) | React.ReactNode;
22
+ renderRight?: ((props: InputProps<T>, ref: React.RefObject<{
23
+ clear: () => void;
24
+ }>) => React.ReactNode) | React.ReactNode;
21
25
  /**
22
26
  * Triggered when the input value is updated.
23
27
  */
@@ -46,6 +50,24 @@ export type InputProps<T = string> = Omit<CommonProps, "value" | "onChange"> & {
46
50
  * Additional style for the container element.
47
51
  */
48
52
  containerStyle?: StyleProp<ViewStyle>;
53
+ /**
54
+ * Additional style for the input container element.
55
+ */
56
+ inputContainerStyle?: StyleProp<ViewStyle> & TextStyle;
57
+ /**
58
+ * Additional style for the baseInput container element.
59
+ */
60
+ baseInputContainerStyle?: TextStyle;
61
+ /**
62
+ * Additional style for the error container element.
63
+ */
64
+ inputErrorContainerStyles?: StyleProp<ViewStyle>;
65
+ inputErrorColor?: string;
66
+ showErrorIcon?: boolean;
67
+ /**
68
+ * Optional text color parameter.
69
+ */
70
+ color?: string;
49
71
  };
50
72
  export declare const InputRenderLeftContainer: import("styled-components").StyledComponent<typeof import("react-native").View, import("styled-components").DefaultTheme, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").FlexboxProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").PositionProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").OverflowProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").BorderProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Border<import("styled-system").TLengthStyledSystem>> & import("styled-system").BackgroundProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Background<import("styled-system").TLengthStyledSystem>> & {
51
73
  columnGap?: string | number | undefined;
@@ -57,7 +79,7 @@ export declare const InputRenderLeftContainer: import("styled-components").Style
57
79
  } & {
58
80
  alignItems: string;
59
81
  flexDirection: string;
60
- pl: string;
82
+ pl: number;
61
83
  }, "alignItems" | "flexDirection" | "pl">;
62
84
  export declare const InputRenderRightContainer: import("styled-components").StyledComponent<typeof import("react-native").View, import("styled-components").DefaultTheme, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").FlexboxProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").PositionProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").OverflowProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").BorderProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Border<import("styled-system").TLengthStyledSystem>> & import("styled-system").BackgroundProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Background<import("styled-system").TLengthStyledSystem>> & {
63
85
  columnGap?: string | number | undefined;
@@ -69,7 +91,7 @@ export declare const InputRenderRightContainer: import("styled-components").Styl
69
91
  } & {
70
92
  alignItems: string;
71
93
  flexDirection: string;
72
- pr: string;
94
+ pr: number;
73
95
  }, "alignItems" | "flexDirection" | "pr">;
74
96
  declare function Input<T = string>(props: InputProps<T>, ref?: any): JSX.Element;
75
97
  declare const _default: <T>(props: Omit<CommonProps, "onChange" | "value"> & {
@@ -80,11 +102,15 @@ declare const _default: <T>(props: Omit<CommonProps, "onChange" | "value"> & {
80
102
  /**
81
103
  * A function that will render some content on the left side of the input.
82
104
  */
83
- renderLeft?: React.ReactNode | ((props: InputProps<T>) => React.ReactNode);
105
+ renderLeft?: React.ReactNode | ((props: InputProps<T>, ref: React.RefObject<{
106
+ clear: () => void;
107
+ }>) => React.ReactNode);
84
108
  /**
85
109
  * A function that will render some content on the right side of the input.
86
110
  */
87
- renderRight?: React.ReactNode | ((props: InputProps<T>) => React.ReactNode);
111
+ renderRight?: React.ReactNode | ((props: InputProps<T>, ref: React.RefObject<{
112
+ clear: () => void;
113
+ }>) => React.ReactNode);
88
114
  /**
89
115
  * Triggered when the input value is updated.
90
116
  */
@@ -113,6 +139,24 @@ declare const _default: <T>(props: Omit<CommonProps, "onChange" | "value"> & {
113
139
  * Additional style for the container element.
114
140
  */
115
141
  containerStyle?: StyleProp<ViewStyle>;
142
+ /**
143
+ * Additional style for the input container element.
144
+ */
145
+ inputContainerStyle?: (StyleProp<ViewStyle> & TextStyle) | undefined;
146
+ /**
147
+ * Additional style for the baseInput container element.
148
+ */
149
+ baseInputContainerStyle?: TextStyle | undefined;
150
+ /**
151
+ * Additional style for the error container element.
152
+ */
153
+ inputErrorContainerStyles?: StyleProp<ViewStyle>;
154
+ inputErrorColor?: string | undefined;
155
+ showErrorIcon?: boolean | undefined;
156
+ /**
157
+ * Optional text color parameter.
158
+ */
159
+ color?: string | undefined;
116
160
  } & {
117
161
  ref?: React.ForwardedRef<TextInput> | undefined;
118
162
  }) => ReturnType<typeof Input>;
@@ -13,6 +13,7 @@ import React, { useMemo, useCallback, useEffect, useImperativeHandle, useRef } f
13
13
  import styled, { css } from "styled-components/native";
14
14
  import Text from "../../../Text";
15
15
  import FlexBox from "../../../Layout/Flex";
16
+ import { DeleteCircleFill } from "@ledgerhq/icons-ui/native";
16
17
  const InputContainer = styled.View `
17
18
  display: flex;
18
19
  flex-direction: row;
@@ -56,30 +57,26 @@ const BaseInput = styled.TextInput.attrs((p) => ({
56
57
  width: 100%;
57
58
  border: 0;
58
59
  flex-shrink: 1;
59
- padding-top: 14px;
60
- padding-bottom: 14px;
61
- padding-left: 20px;
62
- padding-right: 20px;
60
+ padding: 14px 20px;
63
61
  `;
64
- const InputErrorContainer = styled(Text) `
62
+ const InputErrorText = styled(Text) `
65
63
  color: ${(p) => p.theme.colors.error.c50};
66
- margin-left: 12px;
67
64
  `;
68
65
  export const InputRenderLeftContainer = styled(FlexBox).attrs(() => ({
69
66
  alignItems: "center",
70
67
  flexDirection: "row",
71
- pl: "16px",
68
+ pl: 16,
72
69
  })) ``;
73
70
  export const InputRenderRightContainer = styled(FlexBox).attrs(() => ({
74
71
  alignItems: "center",
75
72
  flexDirection: "row",
76
- pr: "16px",
73
+ pr: 16,
77
74
  })) ``;
78
75
  // Yes, this is dirty. If you can figure out a better way please change the code :).
79
76
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
80
77
  const IDENTITY = (_) => _;
81
78
  function Input(props, ref) {
82
- const { value, onChange, onChangeText, onChangeEvent, disabled, error, renderLeft, renderRight, serialize = IDENTITY, deserialize = IDENTITY, containerStyle, autoFocus, onFocus, onBlur } = props, textInputProps = __rest(props, ["value", "onChange", "onChangeText", "onChangeEvent", "disabled", "error", "renderLeft", "renderRight", "serialize", "deserialize", "containerStyle", "autoFocus", "onFocus", "onBlur"]);
79
+ const { value, onChange, onChangeText, onChangeEvent, disabled, error, renderLeft, renderRight, serialize = IDENTITY, deserialize = IDENTITY, containerStyle, inputContainerStyle, baseInputContainerStyle, inputErrorContainerStyles, autoFocus, onFocus, onBlur, color, inputErrorColor = "error.c50", showErrorIcon = false } = props, textInputProps = __rest(props, ["value", "onChange", "onChangeText", "onChangeEvent", "disabled", "error", "renderLeft", "renderRight", "serialize", "deserialize", "containerStyle", "inputContainerStyle", "baseInputContainerStyle", "inputErrorContainerStyles", "autoFocus", "onFocus", "onBlur", "color", "inputErrorColor", "showErrorIcon"]);
83
80
  const inputRef = useRef();
84
81
  useImperativeHandle(ref, () => inputRef.current, [inputRef]);
85
82
  const inputValue = useMemo(() => serialize(value), [serialize, value]);
@@ -93,16 +90,18 @@ function Input(props, ref) {
93
90
  }, [inputRef, autoFocus]);
94
91
  const [focus, setFocus] = React.useState(false);
95
92
  return (React.createElement(FlexBox, { width: "100%", style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : undefined },
96
- React.createElement(InputContainer, { disabled: disabled, focus: focus, error: error },
97
- typeof renderLeft === "function" ? renderLeft(props) : renderLeft,
93
+ React.createElement(InputContainer, { disabled: disabled, focus: focus, error: error, style: inputContainerStyle },
94
+ typeof renderLeft === "function" ? renderLeft(props, inputRef) : renderLeft,
98
95
  React.createElement(BaseInput, Object.assign({ ref: inputRef }, textInputProps, { value: inputValue, onChange: onChangeEvent, onChangeText: handleChange, editable: !disabled, disabled: disabled, error: error, onFocus: (e) => {
99
96
  setFocus(true);
100
97
  typeof onFocus === "function" && onFocus(e);
101
98
  }, onBlur: (e) => {
102
99
  setFocus(false);
103
100
  typeof onBlur === "function" && onBlur(e);
104
- } })),
105
- typeof renderRight === "function" ? renderRight(props) : renderRight),
106
- !!error && !disabled && React.createElement(InputErrorContainer, null, error)));
101
+ }, style: Object.assign(Object.assign({}, (color ? { color: color } : {})), baseInputContainerStyle) })),
102
+ typeof renderRight === "function" ? renderRight(props, inputRef) : renderRight),
103
+ !!error && !disabled && (React.createElement(FlexBox, { flexDirection: "row", alignItems: "center", style: inputErrorContainerStyles || { paddingLeft: "12px" } },
104
+ showErrorIcon && React.createElement(DeleteCircleFill, { color: inputErrorColor, size: "S" }),
105
+ React.createElement(InputErrorText, { color: inputErrorColor, variant: "small", ml: 2 }, error)))));
107
106
  }
108
107
  export default React.forwardRef(Input);
@@ -3,13 +3,23 @@ import { TextInput } from "react-native";
3
3
  import { InputProps } from "../BaseInput";
4
4
  declare const _default: React.ForwardRefExoticComponent<Omit<import("../BaseInput").CommonProps, "onChange" | "value"> & {
5
5
  value: string;
6
- renderLeft?: React.ReactNode | ((props: InputProps<string>) => React.ReactNode);
7
- renderRight?: React.ReactNode | ((props: InputProps<string>) => React.ReactNode);
6
+ renderLeft?: React.ReactNode | ((props: InputProps<string>, ref: React.RefObject<{
7
+ clear: () => void;
8
+ }>) => React.ReactNode);
9
+ renderRight?: React.ReactNode | ((props: InputProps<string>, ref: React.RefObject<{
10
+ clear: () => void;
11
+ }>) => React.ReactNode);
8
12
  onChange?: ((value: string) => void) | undefined;
9
13
  onChangeEvent?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputChangeEventData>) => void) | undefined;
10
14
  serialize?: ((value: string) => string) | undefined;
11
15
  deserialize?: ((value: string) => string) | undefined;
12
16
  containerStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
17
+ inputContainerStyle?: (import("react-native").StyleProp<import("react-native").ViewStyle> & import("react-native").TextStyle) | undefined;
18
+ baseInputContainerStyle?: import("react-native").TextStyle | undefined;
19
+ inputErrorContainerStyles?: import("react-native").StyleProp<import("react-native").ViewStyle>;
20
+ inputErrorColor?: string | undefined;
21
+ showErrorIcon?: boolean | undefined;
22
+ color?: string | undefined;
13
23
  } & {
14
24
  legend: string;
15
25
  } & React.RefAttributes<TextInput>>;
@@ -3,13 +3,23 @@ import { TextInput } from "react-native";
3
3
  import { InputProps } from "../BaseInput";
4
4
  declare const _default: React.ForwardRefExoticComponent<Omit<import("../BaseInput").CommonProps, "onChange" | "value"> & {
5
5
  value: number | undefined;
6
- renderLeft?: React.ReactNode | ((props: InputProps<number | undefined>) => React.ReactNode);
7
- renderRight?: React.ReactNode | ((props: InputProps<number | undefined>) => React.ReactNode);
6
+ renderLeft?: React.ReactNode | ((props: InputProps<number | undefined>, ref: React.RefObject<{
7
+ clear: () => void;
8
+ }>) => React.ReactNode);
9
+ renderRight?: React.ReactNode | ((props: InputProps<number | undefined>, ref: React.RefObject<{
10
+ clear: () => void;
11
+ }>) => React.ReactNode);
8
12
  onChange?: ((value: number | undefined) => void) | undefined;
9
13
  onChangeEvent?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputChangeEventData>) => void) | undefined;
10
14
  serialize?: ((value: number | undefined) => string) | undefined;
11
15
  deserialize?: ((value: string) => number | undefined) | undefined;
12
16
  containerStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
17
+ inputContainerStyle?: (import("react-native").StyleProp<import("react-native").ViewStyle> & import("react-native").TextStyle) | undefined;
18
+ baseInputContainerStyle?: import("react-native").TextStyle | undefined;
19
+ inputErrorContainerStyles?: import("react-native").StyleProp<import("react-native").ViewStyle>;
20
+ inputErrorColor?: string | undefined;
21
+ showErrorIcon?: boolean | undefined;
22
+ color?: string | undefined;
13
23
  } & {
14
24
  onPercentClick: (percent: number) => void;
15
25
  min?: number | undefined;
@@ -4,13 +4,23 @@ import { GestureResponderEvent } from "react-native";
4
4
  import { InputProps } from "../BaseInput";
5
5
  declare const _default: React.ForwardRefExoticComponent<Omit<import("../BaseInput").CommonProps, "onChange" | "value"> & {
6
6
  value: string;
7
- renderLeft?: React.ReactNode | ((props: InputProps<string>) => React.ReactNode);
8
- renderRight?: React.ReactNode | ((props: InputProps<string>) => React.ReactNode);
7
+ renderLeft?: React.ReactNode | ((props: InputProps<string>, ref: React.RefObject<{
8
+ clear: () => void;
9
+ }>) => React.ReactNode);
10
+ renderRight?: React.ReactNode | ((props: InputProps<string>, ref: React.RefObject<{
11
+ clear: () => void;
12
+ }>) => React.ReactNode);
9
13
  onChange?: ((value: string) => void) | undefined;
10
14
  onChangeEvent?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputChangeEventData>) => void) | undefined;
11
15
  serialize?: ((value: string) => string) | undefined;
12
16
  deserialize?: ((value: string) => string) | undefined;
13
17
  containerStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
18
+ inputContainerStyle?: (import("react-native").StyleProp<import("react-native").ViewStyle> & import("react-native").TextStyle) | undefined;
19
+ baseInputContainerStyle?: import("react-native").TextStyle | undefined;
20
+ inputErrorContainerStyles?: import("react-native").StyleProp<import("react-native").ViewStyle>;
21
+ inputErrorColor?: string | undefined;
22
+ showErrorIcon?: boolean | undefined;
23
+ color?: string | undefined;
14
24
  } & {
15
25
  onQrCodeClick?: ((event: GestureResponderEvent) => void) | undefined;
16
26
  } & React.RefAttributes<TextInput>>;
@@ -3,12 +3,22 @@ import { TextInput } from "react-native";
3
3
  import { InputProps } from "../BaseInput";
4
4
  declare const _default: React.ForwardRefExoticComponent<Omit<import("../BaseInput").CommonProps, "onChange" | "value"> & {
5
5
  value: string;
6
- renderLeft?: React.ReactNode | ((props: InputProps<string>) => React.ReactNode);
7
- renderRight?: React.ReactNode | ((props: InputProps<string>) => React.ReactNode);
6
+ renderLeft?: React.ReactNode | ((props: InputProps<string>, ref: React.RefObject<{
7
+ clear: () => void;
8
+ }>) => React.ReactNode);
9
+ renderRight?: React.ReactNode | ((props: InputProps<string>, ref: React.RefObject<{
10
+ clear: () => void;
11
+ }>) => React.ReactNode);
8
12
  onChange?: ((value: string) => void) | undefined;
9
13
  onChangeEvent?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputChangeEventData>) => void) | undefined;
10
14
  serialize?: ((value: string) => string) | undefined;
11
15
  deserialize?: ((value: string) => string) | undefined;
12
16
  containerStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
17
+ inputContainerStyle?: (import("react-native").StyleProp<import("react-native").ViewStyle> & import("react-native").TextStyle) | undefined;
18
+ baseInputContainerStyle?: import("react-native").TextStyle | undefined;
19
+ inputErrorContainerStyles?: import("react-native").StyleProp<import("react-native").ViewStyle>;
20
+ inputErrorColor?: string | undefined;
21
+ showErrorIcon?: boolean | undefined;
22
+ color?: string | undefined;
13
23
  } & React.RefAttributes<TextInput>>;
14
24
  export default _default;
@@ -4,3 +4,4 @@ export { default as NumberInput } from "./NumberInput";
4
4
  export { default as QrCodeInput } from "./QrCodeInput";
5
5
  export { default as SearchInput } from "./SearchInput";
6
6
  export { default as SquaredSearchBar } from "./SquaredSearchBar";
7
+ export { default as AnimatedInput } from "./AnimatedInput";
@@ -4,3 +4,4 @@ export { default as NumberInput } from "./NumberInput";
4
4
  export { default as QrCodeInput } from "./QrCodeInput";
5
5
  export { default as SearchInput } from "./SearchInput";
6
6
  export { default as SquaredSearchBar } from "./SquaredSearchBar";
7
+ export { default as AnimatedInput } from "./AnimatedInput";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/native-ui",
3
- "version": "0.22.2",
3
+ "version": "0.22.3-nightly.0",
4
4
  "description": "Ledger Live - Mobile UI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,7 +42,7 @@
42
42
  "rn-range-slider": "2.1.1",
43
43
  "styled-system": "^5.1.5",
44
44
  "victory-native": "^35.5.5",
45
- "@ledgerhq/crypto-icons-ui": "^0.6.1",
45
+ "@ledgerhq/crypto-icons-ui": "^0.6.2-nightly.0",
46
46
  "@ledgerhq/icons-ui": "^0.6.2",
47
47
  "@ledgerhq/ui-shared": "^0.2.1"
48
48
  },
@@ -72,20 +72,19 @@
72
72
  "@react-native-community/cli-server-api": "^7.0.3",
73
73
  "@react-native-community/datetimepicker": "6.7.5",
74
74
  "@react-native-community/slider": "^4.4.2",
75
- "@storybook/addon-actions": "^6.5.16",
76
- "@storybook/addon-controls": "^6.5.16",
77
- "@storybook/addon-essentials": "^6.5.16",
78
- "@storybook/addon-links": "^6.5.16",
79
- "@storybook/addon-ondevice-actions": "6.5.6",
80
- "@storybook/addon-ondevice-backgrounds": "6.5.6",
81
- "@storybook/addon-ondevice-controls": "6.5.6",
82
- "@storybook/addon-ondevice-notes": "6.5.6",
83
- "@storybook/addon-react-native-web": "^0.0.19",
84
- "@storybook/builder-webpack5": "^6.5.14",
85
- "@storybook/docs-tools": "^6.5.16",
86
- "@storybook/manager-webpack5": "^6.5.14",
87
- "@storybook/react": "^6.5.16",
88
- "@storybook/react-native": "6.5.6",
75
+ "@storybook/addon-actions": "^7.5.3",
76
+ "@storybook/addon-controls": "^7.5.3",
77
+ "@storybook/addon-essentials": "^7.5.3",
78
+ "@storybook/addon-links": "^7.5.3",
79
+ "@storybook/addon-ondevice-actions": "6.5.7",
80
+ "@storybook/addon-ondevice-backgrounds": "6.5.7",
81
+ "@storybook/addon-ondevice-controls": "6.5.7",
82
+ "@storybook/addon-ondevice-notes": "6.5.7",
83
+ "@storybook/addon-react-native-web": "^0.0.21",
84
+ "@storybook/docs-tools": "^7.5.3",
85
+ "@storybook/react": "^7.5.3",
86
+ "@storybook/react-native": "6.5.7",
87
+ "@storybook/react-webpack5": "^7.5.3",
89
88
  "@svgr/core": "^5.5.0",
90
89
  "@svgr/plugin-jsx": "^5.5.0",
91
90
  "@svgr/plugin-svgo": "^5.5.0",
@@ -108,6 +107,7 @@
108
107
  "csstype": "^3.0.11",
109
108
  "eslint-plugin-react": "^7.33.2",
110
109
  "eslint-plugin-react-hooks": "^4.6.0",
110
+ "eslint-plugin-storybook": "^0.6.15",
111
111
  "expo": "^49.0.7",
112
112
  "expo-asset": "8.10.1",
113
113
  "expo-constants": "^14.4.2",
@@ -136,6 +136,7 @@
136
136
  "react-native-web": "~0.19.6",
137
137
  "regenerator-runtime": "^0.14.0",
138
138
  "rimraf": "^4.4.1",
139
+ "storybook": "^7.5.3",
139
140
  "styled-components": "^5.3.3",
140
141
  "stylelint": "^14.9.1",
141
142
  "stylelint-config-recommended": "^13.0.0",
@@ -151,7 +152,7 @@
151
152
  "android": "expo start --android",
152
153
  "build": "tsc -p tsconfig.prod.json && node scripts/postBuild",
153
154
  "prebuild:storybook": "pnpm -F ui-shared -F icons-ui -F crypto-icons-ui build",
154
- "build:storybook": "pnpm build-storybook -c .storybook-web -o web-build",
155
+ "build:storybook": "storybook build -c .storybook-web -o web-build",
155
156
  "watch": "tsc -p tsconfig.prod.json --watch",
156
157
  "clean": "rimraf lib",
157
158
  "eject": "expo eject",
@@ -161,7 +162,7 @@
161
162
  "lint:css": "stylelint './src/**/*.{js,jsx,ts,tsx}'",
162
163
  "release": "yarn publish ./lib --access public",
163
164
  "expo-start": "expo start",
164
- "storybook": "start-storybook -c .storybook-web -p 6006",
165
+ "storybook": "storybook dev -c .storybook-web -p 6006",
165
166
  "typecheck": "tsc --noEmit -p tsconfig.json",
166
167
  "test": "exit 0",
167
168
  "web": "expo start --web",