@ledgerhq/native-ui 0.6.1 → 0.6.2

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.
Files changed (53) hide show
  1. package/README.md +1 -4
  2. package/components/Carousel/index.js +2 -4
  3. package/components/Form/Checkbox/index.d.ts +1 -1
  4. package/components/Form/Checkbox/index.js +1 -1
  5. package/components/Form/Input/BaseInput/index.js +1 -1
  6. package/components/Form/Input/NumberInput/index.js +2 -2
  7. package/components/Form/SelectableList.js +1 -1
  8. package/components/Form/Slider/index.native.js +1 -1
  9. package/components/Form/Switch/index.d.ts +1 -1
  10. package/components/Form/Switch/index.js +1 -1
  11. package/components/Form/Toggle/index.d.ts +1 -1
  12. package/components/Form/Toggle/index.js +1 -1
  13. package/components/Icon/BoxedIcon.d.ts +9 -8
  14. package/components/Icon/BoxedIcon.js +7 -9
  15. package/components/Icon/Icon.d.ts +9 -0
  16. package/components/Icon/Icon.js +20 -0
  17. package/components/Icon/index.d.ts +1 -0
  18. package/components/Icon/index.js +1 -0
  19. package/components/Layout/Collapse/Accordion/index.js +1 -1
  20. package/components/Layout/ScrollContainer/index.d.ts +2 -1
  21. package/components/Layout/ScrollContainer/index.js +2 -2
  22. package/components/Layout/ScrollContainerHeader/Header.d.ts +1 -1
  23. package/components/Layout/ScrollContainerHeader/Header.js +23 -16
  24. package/components/Layout/ScrollContainerHeader/index.d.ts +3 -2
  25. package/components/Layout/ScrollContainerHeader/index.js +9 -4
  26. package/components/Loader/InfiniteLoader/index.js +2 -6
  27. package/components/Loader/ProgressLoader/index.d.ts +1 -1
  28. package/components/Loader/ProgressLoader/index.js +1 -1
  29. package/components/Navigation/FlowStepper/index.js +3 -5
  30. package/components/Navigation/SlideIndicator/index.d.ts +1 -1
  31. package/components/Navigation/SlideIndicator/index.js +2 -3
  32. package/components/Navigation/Stepper/index.d.ts +1 -1
  33. package/components/Navigation/Stepper/index.js +4 -4
  34. package/components/ProgressBar/index.js +1 -1
  35. package/components/Tabs/Chip/index.d.ts +1 -1
  36. package/components/Tabs/Chip/index.js +2 -2
  37. package/components/Tabs/Graph/index.d.ts +1 -1
  38. package/components/Tabs/Graph/index.js +1 -1
  39. package/components/cta/Button/index.d.ts +1 -0
  40. package/components/cta/Button/index.js +9 -11
  41. package/components/cta/Link/index.js +1 -5
  42. package/components/message/Alert/index.d.ts +1 -1
  43. package/components/message/Alert/index.js +1 -1
  44. package/components/message/Notification/index.js +1 -1
  45. package/components/transitions/Slide.d.ts +1 -1
  46. package/components/transitions/Slide.js +1 -1
  47. package/components/transitions/Transition.js +2 -5
  48. package/package.json +3 -3
  49. package/styles/StyleProvider.d.ts +1 -1
  50. package/styles/StyleProvider.js +1 -1
  51. package/styles/helpers.js +1 -3
  52. package/assets/fonts/.DS_Store +0 -0
  53. package/assets/fonts/alpha/.DS_Store +0 -0
package/README.md CHANGED
@@ -211,10 +211,7 @@ export default function App() {
211
211
  <Text variant="h2" color="neutral.c100" my={10}>
212
212
  Hello, world!
213
213
  </Text>
214
- <Switch
215
- checked={isLight}
216
- onChange={() => setPalette(() => (isLight ? "dark" : "light"))}
217
- />
214
+ <Switch checked={isLight} onChange={() => setPalette(() => (isLight ? "dark" : "light"))} />
218
215
  </Flex>
219
216
  </StyleProvider>
220
217
  );
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState, useRef, useCallback } from "react";
2
- import { Platform, } from "react-native";
2
+ import { Platform } from "react-native";
3
3
  import styled from "styled-components/native";
4
4
  import { Flex, SlideIndicator } from "../index";
5
5
  const HorizontalScrollView = styled.ScrollView.attrs({ horizontal: true }) `
@@ -14,9 +14,7 @@ function Carousel({ activeIndex, autoDelay, containerProps, slideIndicatorContai
14
14
  const slidesLength = React.Children.count(children);
15
15
  const scrollRef = useRef(null);
16
16
  const fullWidth = 100 * slidesLength;
17
- const itemWidth = !dimensions.current
18
- ? 0
19
- : dimensions.current.contentWidth / slidesLength;
17
+ const itemWidth = !dimensions.current ? 0 : dimensions.current.contentWidth / slidesLength;
20
18
  const scrollToIndex = useCallback((index, animated = true) => {
21
19
  if (scrollRef.current && dimensions.current) {
22
20
  scrollRef.current.scrollTo({
@@ -5,5 +5,5 @@ declare type CheckboxProps = {
5
5
  disabled?: boolean;
6
6
  label?: BaseTextProps["children"];
7
7
  };
8
- declare const Checkbox: ({ checked, onChange, disabled, label, }: CheckboxProps) => JSX.Element;
8
+ declare const Checkbox: ({ checked, onChange, disabled, label }: CheckboxProps) => JSX.Element;
9
9
  export default Checkbox;
@@ -16,7 +16,7 @@ const Square = styled(Flex).attrs({
16
16
  ? `background-color: ${theme.colors.primary.c90};`
17
17
  : `border: 1px solid ${theme.colors.neutral.c50};`}
18
18
  `;
19
- const Checkbox = ({ checked, onChange, disabled, label, }) => {
19
+ const Checkbox = ({ checked, onChange, disabled, label }) => {
20
20
  const { colors, space } = useTheme();
21
21
  return (React.createElement(Pressable, { onPress: onChange, disabled: disabled },
22
22
  React.createElement(Flex, { flexDirection: "row", alignItems: "center" },
@@ -89,6 +89,6 @@ function Input(props, ref) {
89
89
  typeof renderLeft === "function" ? renderLeft(props) : renderLeft,
90
90
  React.createElement(BaseInput, Object.assign({ ref: ref }, textInputProps, { value: inputValue, onChange: onChangeEvent, onChangeText: handleChange, editable: !disabled, disabled: disabled, error: error, onFocus: () => setFocus(true), onBlur: () => setFocus(false) })),
91
91
  typeof renderRight === "function" ? renderRight(props) : renderRight),
92
- !!error && !disabled && (React.createElement(InputErrorContainer, null, error))));
92
+ !!error && !disabled && React.createElement(InputErrorContainer, null, error)));
93
93
  }
94
94
  export default React.forwardRef(Input);
@@ -16,8 +16,8 @@ import Input from "../BaseInput";
16
16
  import FlexBox from "../../../Layout/Flex";
17
17
  import Text from "../../../Text";
18
18
  const PercentButton = styled(TouchableOpacity) `
19
- color: ${(p) => p.active ? p.theme.colors.neutral.c00 : p.theme.colors.neutral.c70};
20
- background-color: ${(p) => p.active ? p.theme.colors.neutral.c100 : p.theme.colors.neutral.c00};
19
+ color: ${(p) => (p.active ? p.theme.colors.neutral.c00 : p.theme.colors.neutral.c70)};
20
+ background-color: ${(p) => (p.active ? p.theme.colors.neutral.c100 : p.theme.colors.neutral.c00)};
21
21
  border-radius: 100px;
22
22
  border-width: 0;
23
23
  height: 31px;
@@ -14,7 +14,7 @@ function Element(props) {
14
14
  Icon && (React.createElement(Flex, { mr: 6, flexShrink: 0 },
15
15
  React.createElement(Icon, { size: 24, color: disabled ? "neutral.c50" : "neutral.c100" }))),
16
16
  React.createElement(Text, { variant: "large", flex: 1, color: disabled ? "neutral.c50" : "neutral.c100" }, children || value),
17
- RenderRight && (React.createElement(Flex, { pl: 6, flexShrink: 0 }, React.isValidElement(RenderRight) ? (RenderRight) : (React.createElement(RenderRight, Object.assign({}, props))))))));
17
+ RenderRight && (React.createElement(Flex, { pl: 6, flexShrink: 0 }, React.isValidElement(RenderRight) ? RenderRight : React.createElement(RenderRight, Object.assign({}, props)))))));
18
18
  }
19
19
  function SelectableList({ currentValue, onChange, children }) {
20
20
  return (React.createElement(Flex, { accessible: true, accessibilityRole: "radiogroup" }, React.Children.map(children, (child, index) => {
@@ -2,7 +2,7 @@ import React, { useCallback } from "react";
2
2
  import styled from "styled-components/native";
3
3
  import RnRangeSlider from "rn-range-slider";
4
4
  import Text from "../../Text";
5
- import { Label, MinMaxTextContainer, Notch, Rail, RailSelected, Thumb, } from "./components";
5
+ import { Label, MinMaxTextContainer, Notch, Rail, RailSelected, Thumb } from "./components";
6
6
  const SliderContainer = styled.View `
7
7
  display: flex;
8
8
  flex-direction: column;
@@ -4,5 +4,5 @@ declare type SwitchProps = {
4
4
  disabled?: boolean;
5
5
  label?: string;
6
6
  };
7
- declare const Switch: ({ checked, onChange, disabled, label, }: SwitchProps) => JSX.Element;
7
+ declare const Switch: ({ checked, onChange, disabled, label }: SwitchProps) => JSX.Element;
8
8
  export default Switch;
@@ -3,7 +3,7 @@ import { Switch as NativeSwitch } from "react-native";
3
3
  import { useTheme } from "styled-components/native";
4
4
  import Text from "../../Text";
5
5
  import Flex from "../../Layout/Flex";
6
- const Switch = ({ checked, onChange, disabled, label, }) => {
6
+ const Switch = ({ checked, onChange, disabled, label }) => {
7
7
  const { colors, space } = useTheme();
8
8
  return (React.createElement(Flex, { flexDirection: "row", alignItems: "center" },
9
9
  React.createElement(NativeSwitch, { trackColor: {
@@ -4,5 +4,5 @@ declare type ToggleProps = {
4
4
  onPress: () => void;
5
5
  children: ButtonProps["children"];
6
6
  };
7
- export default function Toggle({ active, children, onPress, }: ToggleProps): JSX.Element;
7
+ export default function Toggle({ active, children, onPress }: ToggleProps): JSX.Element;
8
8
  export {};
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { TouchableOpacity } from "react-native";
3
3
  import Button from "../../cta/Button";
4
- export default function Toggle({ active = false, children, onPress, }) {
4
+ export default function Toggle({ active = false, children, onPress }) {
5
5
  return (React.createElement(TouchableOpacity, { onPress: onPress },
6
6
  React.createElement(Button, { disabled: !active, type: "main" }, children)));
7
7
  }
@@ -1,16 +1,13 @@
1
- import React from "react";
1
+ import { IconOrElementType, IconType } from "./type";
2
2
  export declare const DEFAULT_BOX_SIZE = 40;
3
3
  export declare const DEFAULT_ICON_SIZE = 16;
4
4
  export declare const DEFAULT_BADGE_SIZE = 20;
5
- export declare type IconProps = {
6
- size?: number;
7
- color?: string;
8
- };
5
+ export declare type Variant = "square" | "circle";
9
6
  export declare type IconBoxProps = {
10
7
  /**
11
8
  * Component that takes `{size?: number; color?: string}` as props. Will be rendered at the top right with the size provided in `badgeSize` or a default size.
12
9
  */
13
- Badge?: React.ComponentType<IconProps>;
10
+ Badge?: IconType;
14
11
  /**
15
12
  * Color of the border
16
13
  */
@@ -28,12 +25,16 @@ export declare type IconBoxProps = {
28
25
  * Box size for preview
29
26
  */
30
27
  size?: number;
28
+ /**
29
+ * Box variant (box or circled)
30
+ */
31
+ variant?: Variant;
31
32
  };
32
33
  export declare type BoxedIconProps = IconBoxProps & {
33
34
  /**
34
35
  * Component that takes `{size?: number; color?: string}` as props. Will be rendered at the top right with the size provided in `iconSize` or a default size.
35
36
  */
36
- Icon: React.ComponentType<IconProps> | ((props: IconProps) => JSX.Element);
37
+ Icon: IconOrElementType;
37
38
  /**
38
39
  * Icon size, will be applied to the component provided in the `Icon` prop
39
40
  */
@@ -43,6 +44,6 @@ export declare type BoxedIconProps = IconBoxProps & {
43
44
  */
44
45
  iconColor?: string;
45
46
  };
46
- export declare const IconBox: ({ Badge, size, children, borderColor, badgeColor, badgeSize, }: IconBoxProps) => JSX.Element;
47
+ export declare const IconBox: ({ Badge, size, children, borderColor, badgeColor, badgeSize, variant, }: IconBoxProps) => JSX.Element;
47
48
  declare const BoxedIcon: ({ Icon, iconSize, iconColor, ...iconBoxProps }: BoxedIconProps) => JSX.Element;
48
49
  export default BoxedIcon;
@@ -34,7 +34,7 @@ const IconBoxBackground = styled(Flex) `
34
34
  position: absolute;
35
35
  height: ${(p) => p.size}px;
36
36
  width: ${(p) => p.size}px;
37
- border-radius: ${(p) => p.theme.radii[BORDER_RADIUS]}px;
37
+ border-radius: ${(p) => (p.variant === "circle" ? p.size : p.theme.radii[BORDER_RADIUS])}px;
38
38
  `;
39
39
  const BadgeContainer = styled.View `
40
40
  position: absolute;
@@ -46,15 +46,14 @@ const BadgeContainer = styled.View `
46
46
  width: ${p.badgeSize}px;`}
47
47
  `;
48
48
  /** This component is needed to draw a border that is clipped behind the badge icon */
49
- const IconBoxBackgroundSVG = ({ size, borderColor, badgeSize, }) => {
49
+ const IconBoxBackgroundSVG = ({ size, borderColor, badgeSize, variant = "square", }) => {
50
50
  const { colors, radii } = useTheme();
51
51
  const borderRadius = radii[BORDER_RADIUS];
52
52
  const borderWidth = 1;
53
53
  const paletteStr = borderColor.split(".")[0];
54
54
  // @ts-expect-error idk how to handle this properly pls help
55
55
  const palette = colors[paletteStr];
56
- const strokeColor = (palette ? palette[borderColor.split(".")[1]] : borderColor) ||
57
- colors.neutral.c40;
56
+ const strokeColor = (palette ? palette[borderColor.split(".")[1]] : borderColor) || colors.neutral.c40;
58
57
  const squareSize = getClipRectangleSize(badgeSize);
59
58
  /**
60
59
  * The following adjustments are necessary to have visual consistency
@@ -62,7 +61,7 @@ const IconBoxBackgroundSVG = ({ size, borderColor, badgeSize, }) => {
62
61
  */
63
62
  const svgSize = size + borderWidth;
64
63
  const rectSize = size - borderWidth;
65
- const rectRadius = borderRadius - borderWidth / 2;
64
+ const rectRadius = variant === "circle" ? size : borderRadius - borderWidth / 2;
66
65
  return (React.createElement(Box, { position: "absolute", overflow: "hidden" },
67
66
  React.createElement(Svg, { height: svgSize, width: svgSize },
68
67
  React.createElement(Defs, null,
@@ -71,17 +70,16 @@ const IconBoxBackgroundSVG = ({ size, borderColor, badgeSize, }) => {
71
70
  React.createElement(Rect, { x: "0", y: squareSize, width: "100%", height: svgSize - squareSize }))),
72
71
  React.createElement(Rect, { strokeWidth: PixelRatio.roundToNearestPixel(borderWidth), stroke: strokeColor, x: borderWidth, y: borderWidth, rx: rectRadius, ry: rectRadius, width: rectSize, height: rectSize, fill: "transparent", clipPath: "url(#clip)" }))));
73
72
  };
74
- export const IconBox = ({ Badge, size = DEFAULT_BOX_SIZE, children, borderColor = "neutral.c40", badgeColor, badgeSize = DEFAULT_BADGE_SIZE, }) => {
73
+ export const IconBox = ({ Badge, size = DEFAULT_BOX_SIZE, children, borderColor = "neutral.c40", badgeColor, badgeSize = DEFAULT_BADGE_SIZE, variant = "square", }) => {
75
74
  const hasBadge = !!Badge;
76
75
  return (React.createElement(Container, { size: size },
77
- hasBadge ? (React.createElement(IconBoxBackgroundSVG, { size: size, badgeSize: badgeSize, borderColor: borderColor })) : (React.createElement(IconBoxBackground, { border: "1px solid", size: size, borderColor: borderColor })),
76
+ hasBadge ? (React.createElement(IconBoxBackgroundSVG, { size: size, badgeSize: badgeSize, borderColor: borderColor, variant: variant })) : (React.createElement(IconBoxBackground, { border: "1px solid", size: size, borderColor: borderColor, variant: variant })),
78
77
  children,
79
78
  hasBadge && (React.createElement(BadgeContainer, { badgeSize: badgeSize },
80
79
  React.createElement(Badge, { size: badgeSize, color: badgeColor })))));
81
80
  };
82
81
  const BoxedIcon = (_a) => {
83
82
  var { Icon, iconSize = DEFAULT_ICON_SIZE, iconColor } = _a, iconBoxProps = __rest(_a, ["Icon", "iconSize", "iconColor"]);
84
- return (React.createElement(IconBox, Object.assign({}, iconBoxProps),
85
- React.createElement(Icon, { size: iconSize || DEFAULT_ICON_SIZE, color: iconColor })));
83
+ return (React.createElement(IconBox, Object.assign({}, iconBoxProps), React.isValidElement(Icon) ? (Icon) : (React.createElement(Icon, { size: iconSize || DEFAULT_ICON_SIZE, color: iconColor }))));
86
84
  };
87
85
  export default BoxedIcon;
@@ -0,0 +1,9 @@
1
+ export declare type Props = {
2
+ name: string;
3
+ size?: number;
4
+ weight?: "Regular" | "Thin" | "Light" | "Medium" | "UltraLight";
5
+ color?: string;
6
+ };
7
+ export declare const iconNames: string[];
8
+ declare const Icon: ({ name, size, color, weight, }: Props) => JSX.Element | null;
9
+ export default Icon;
@@ -0,0 +1,20 @@
1
+ import * as icons from "@ledgerhq/icons-ui/native";
2
+ import React from "react";
3
+ export const iconNames = Array.from(Object.keys(icons).reduce((set, rawKey) => {
4
+ const key = rawKey
5
+ .replace(/(.+)(Regular|Light|UltraLight|Thin|Medium)+$/g, "$1")
6
+ .replace(/(.+)(Ultra)+$/g, "$1");
7
+ if (!set.has(key))
8
+ set.add(key);
9
+ return set;
10
+ }, new Set()));
11
+ const Icon = ({ name, size = 16, color = "currentColor", weight = "Medium", }) => {
12
+ const maybeIconName = `${name}${weight}`;
13
+ if (maybeIconName in icons) {
14
+ // @ts-expect-error FIXME I don't know how to make you happy ts
15
+ const Component = icons[maybeIconName];
16
+ return React.createElement(Component, { size: size, color: color });
17
+ }
18
+ return null;
19
+ };
20
+ export default Icon;
@@ -1,2 +1,3 @@
1
1
  export { default as IconBox } from "./IconBox";
2
2
  export { default as BoxedIcon } from "./BoxedIcon";
3
+ export { default as Icon } from "./Icon";
@@ -1,2 +1,3 @@
1
1
  export { default as IconBox } from "./IconBox";
2
2
  export { default as BoxedIcon } from "./BoxedIcon";
3
+ export { default as Icon } from "./Icon";
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect } from "react";
2
2
  import Animated, { useSharedValue, withTiming, useAnimatedStyle, Easing, } from "react-native-reanimated";
3
3
  import Link from "../../../cta/Link";
4
- import { ChevronBottomMedium, ChevronTopMedium, } from "@ledgerhq/icons-ui/native";
4
+ import { ChevronBottomMedium, ChevronTopMedium } from "@ledgerhq/icons-ui/native";
5
5
  import { View } from "react-native";
6
6
  const Accordion = ({ collapsed = false, children, title, onPress, }) => {
7
7
  const animationHeight = useSharedValue(collapsed ? "0%" : "100%");
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import { SpaceProps } from "styled-system";
3
+ import { BaseStyledProps } from "../../styled";
3
4
  import type { NativeSyntheticEvent, NativeScrollEvent, ScrollViewProps } from "react-native";
4
- declare type ScrollContainerProps = ScrollViewProps & SpaceProps & {
5
+ declare type ScrollContainerProps = BaseStyledProps & ScrollViewProps & SpaceProps & {
5
6
  children: React.ReactNode;
6
7
  onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
7
8
  horizontal?: boolean;
@@ -11,9 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React from "react";
13
13
  import { space } from "styled-system";
14
- import styled from "styled-components/native";
14
+ import baseStyled from "../../styled";
15
15
  import Animated from "react-native-reanimated";
16
- const ScrollView = styled(Animated.ScrollView) `
16
+ const ScrollView = baseStyled(Animated.ScrollView) `
17
17
  ${space};
18
18
  `;
19
19
  const ScrollContainer = (_a) => {
@@ -7,5 +7,5 @@ export declare type HeaderProps = {
7
7
  BottomSection?: JSX.Element;
8
8
  currentPositionY: Animated.SharedValue<number>;
9
9
  };
10
- declare const Header: ({ TopLeftSection, TopRightSection, MiddleSection, BottomSection, currentPositionY, }: HeaderProps) => JSX.Element;
10
+ declare const Header: ({ TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, currentPositionY, }: HeaderProps) => JSX.Element;
11
11
  export default Header;
@@ -1,7 +1,6 @@
1
1
  import React, { useCallback, useState } from "react";
2
- import { View } from "react-native";
3
2
  import styled from "styled-components/native";
4
- import Animated, { useAnimatedStyle, interpolate, Extrapolate, } from "react-native-reanimated";
3
+ import Animated, { useAnimatedStyle, interpolate, Extrapolate } from "react-native-reanimated";
5
4
  import Flex from "../Flex";
6
5
  const Container = styled(Flex).attrs({
7
6
  paddingHorizontal: 16,
@@ -10,7 +9,7 @@ const Container = styled(Flex).attrs({
10
9
  width: 100%;
11
10
  `;
12
11
  const SCROLL_BREAKPOINT = 80;
13
- const Header = ({ TopLeftSection, TopRightSection, MiddleSection, BottomSection, currentPositionY, }) => {
12
+ const Header = ({ TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, currentPositionY, }) => {
14
13
  const [topSectionHeight, setTopSectionHeight] = useState(0);
15
14
  const [topSectionWidth, setTopSectionWidth] = useState(0);
16
15
  const [topMiddleWidth, setTopMiddleWidth] = useState(0);
@@ -29,34 +28,42 @@ const Header = ({ TopLeftSection, TopRightSection, MiddleSection, BottomSection,
29
28
  const onLayoutMiddle = useCallback(({ nativeEvent: { layout } }) => {
30
29
  setMiddleWidth(layout.width);
31
30
  }, []);
31
+ const TopMiddleStyle = useAnimatedStyle(() => {
32
+ const scaleRatio = middleWidth ? Math.min(topMiddleWidth / middleWidth, 0.9) : 0.7;
33
+ /** scale the animated content to fit in the available space on the top header section */
34
+ const scale = interpolate(currentPositionY.value, [0, SCROLL_BREAKPOINT], [1, scaleRatio], Extrapolate.CLAMP);
35
+ /** offset horizontaly given the scale transformation and potential top left header section */
36
+ const translateX = interpolate(currentPositionY.value, [0, SCROLL_BREAKPOINT], [0, -(topMiddleWidth - topMiddleWidth * scaleRatio) / 2], Extrapolate.CLAMP);
37
+ const opacity = interpolate(currentPositionY.value, [SCROLL_BREAKPOINT - 1, SCROLL_BREAKPOINT + 40], [0, 1], Extrapolate.CLAMP);
38
+ return {
39
+ transform: [{ translateX }, { scale }],
40
+ flex: 1,
41
+ opacity,
42
+ justifyContent: "center", // needed to ensure vertical centering of animated content
43
+ };
44
+ }, [topLeftWidth, topSectionHeight, middleWidth, topMiddleWidth, topSectionWidth]);
32
45
  const MiddleStyle = useAnimatedStyle(() => {
33
- const scaleRatio = middleWidth
34
- ? Math.min(topMiddleWidth / middleWidth, 0.9)
35
- : 0.7;
46
+ const scaleRatio = middleWidth ? Math.min(topMiddleWidth / middleWidth, 0.9) : 0.7;
36
47
  /** scale the animated content to fit in the available space on the top header section */
37
48
  const scale = interpolate(currentPositionY.value, [0, SCROLL_BREAKPOINT], [1, scaleRatio], Extrapolate.CLAMP);
38
49
  /** translate verticaly to the middle of the top header section */
39
50
  const translateY = interpolate(currentPositionY.value, [0, SCROLL_BREAKPOINT], [0, -topSectionHeight + topSectionHeight / 2], Extrapolate.CLAMP);
40
51
  /** offset horizontaly given the scale transformation and potential top left header section */
41
- const translateX = interpolate(currentPositionY.value, [0, SCROLL_BREAKPOINT], [0, -(topSectionWidth - topMiddleWidth) / 2 + topLeftWidth], Extrapolate.CLAMP);
52
+ const translateX = interpolate(currentPositionY.value, [0, SCROLL_BREAKPOINT], [0, -(topSectionWidth - topSectionWidth * scaleRatio) / 2 + topLeftWidth], Extrapolate.CLAMP);
42
53
  /** allow for content to move upward as animation is taking place */
43
54
  const maxHeight = interpolate(currentPositionY.value, [0, SCROLL_BREAKPOINT], [70, 0], Extrapolate.CLAMP);
55
+ const opacity = interpolate(currentPositionY.value, [SCROLL_BREAKPOINT - 1, SCROLL_BREAKPOINT + 40], [1, 0], Extrapolate.CLAMP);
44
56
  return {
45
57
  maxHeight,
46
58
  transform: [{ translateY }, { translateX }, { scale }],
59
+ opacity,
47
60
  justifyContent: "center", // needed to ensure vertical centering of animated content
48
61
  };
49
- }, [
50
- topLeftWidth,
51
- topSectionHeight,
52
- middleWidth,
53
- topMiddleWidth,
54
- topSectionWidth,
55
- ]);
62
+ }, [topLeftWidth, topSectionHeight, middleWidth, topMiddleWidth, topSectionWidth]);
56
63
  return (React.createElement(Container, null,
57
64
  React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", onLayout: onLayout },
58
- React.createElement(View, { onLayout: onLayoutTopLeft }, TopLeftSection),
59
- React.createElement(Flex, { flex: 1, onLayout: onLayoutTopMiddle }),
65
+ React.createElement(Flex, { onLayout: onLayoutTopLeft }, TopLeftSection),
66
+ React.createElement(Animated.View, { style: [TopMiddleStyle], onLayout: topMiddleWidth ? () => { } : onLayoutTopMiddle }, TopMiddleSection || MiddleSection),
60
67
  TopRightSection),
61
68
  React.createElement(Animated.View, { onLayout: middleWidth ? () => { } : onLayoutMiddle, style: MiddleStyle }, MiddleSection),
62
69
  BottomSection ? React.createElement(Flex, null, BottomSection) : null));
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
- import type { ScrollViewProps } from "react-native";
2
+ import { FlatListProps } from "react-native";
3
3
  import type { HeaderProps } from "./Header";
4
- declare type ScrollContainerHeaderProps = Omit<HeaderProps, "currentPositionY"> & Omit<ScrollViewProps, "onScroll"> & {
4
+ import { BaseStyledProps } from "../../styled";
5
+ declare type ScrollContainerHeaderProps = BaseStyledProps & Omit<HeaderProps, "currentPositionY"> & Omit<FlatListProps<any>, "onScroll" | "data" | "renderItem" | "stickyHeaderIndices"> & {
5
6
  children?: React.ReactNode;
6
7
  onScroll?: (y: number) => void;
7
8
  };
@@ -10,8 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import React from "react";
13
- import Animated, { useAnimatedScrollHandler, useSharedValue, } from "react-native-reanimated";
13
+ import { View } from "react-native";
14
+ import Animated, { useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated";
14
15
  import Header from "./Header";
16
+ import baseStyled from "../../styled";
17
+ const StyledFlatList = baseStyled.FlatList ``;
18
+ const AnimatedFlatList = Animated.createAnimatedComponent(StyledFlatList);
15
19
  const ScrollContainerHeader = (_a) => {
16
20
  var { TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, children, onScroll } = _a, props = __rest(_a, ["TopLeftSection", "TopRightSection", "TopMiddleSection", "MiddleSection", "BottomSection", "children", "onScroll"]);
17
21
  const currentPositionY = useSharedValue(0);
@@ -20,8 +24,9 @@ const ScrollContainerHeader = (_a) => {
20
24
  if (onScroll)
21
25
  onScroll(event.contentOffset.y);
22
26
  });
23
- return (React.createElement(Animated.ScrollView, Object.assign({}, props, { onScroll: handleScroll, scrollEventThrottle: 16, stickyHeaderIndices: [0] }),
24
- React.createElement(Header, { TopLeftSection: TopLeftSection, TopRightSection: TopRightSection, TopMiddleSection: TopMiddleSection, MiddleSection: MiddleSection, BottomSection: BottomSection, currentPositionY: currentPositionY }),
25
- children));
27
+ return (React.createElement(AnimatedFlatList, Object.assign({}, props, { onScroll: handleScroll, scrollEventThrottle: 16, stickyHeaderIndices: [0], data: [
28
+ React.createElement(Header, { TopLeftSection: TopLeftSection, TopRightSection: TopRightSection, TopMiddleSection: TopMiddleSection, MiddleSection: MiddleSection, BottomSection: BottomSection, currentPositionY: currentPositionY }),
29
+ children,
30
+ ], renderItem: ({ item, index }) => (React.createElement(View, { key: index }, item)) })));
26
31
  };
27
32
  export default ScrollContainerHeader;
@@ -39,15 +39,11 @@ export default function InfiniteLoader(_a) {
39
39
  rotation.value = withRepeat(withTiming(360, {
40
40
  duration: 1000,
41
41
  easing: Easing.linear,
42
- }), -1 //Infinite
43
- );
42
+ }), -1);
44
43
  return () => cancelAnimation(rotation);
45
44
  // eslint-disable-next-line react-hooks/exhaustive-deps
46
45
  }, []);
47
- return (React.createElement(Animated.View, { style: [
48
- { display: "flex", justifyContent: "center", alignItems: "center" },
49
- animatedStyles,
50
- ] },
46
+ return (React.createElement(Animated.View, { style: [{ display: "flex", justifyContent: "center", alignItems: "center" }, animatedStyles] },
51
47
  React.createElement(Loader, Object.assign({ size: size, stroke: color, viewBox: "0 0 38 38", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, extraProps),
52
48
  React.createElement(LinearGradient, { id: "gradient-start", gradientUnits: "userSpaceOnUse", gradientTransform: "rotate(-20)" },
53
49
  React.createElement(Stop, { offset: 0, stopColor: "white", stopOpacity: 0.5 }),
@@ -7,5 +7,5 @@ declare type Props = {
7
7
  size: number;
8
8
  }>;
9
9
  };
10
- declare const ProgressLoader: ({ progress, onPress, Icon, }: Props) => React.ReactElement;
10
+ declare const ProgressLoader: ({ progress, onPress, Icon }: Props) => React.ReactElement;
11
11
  export default ProgressLoader;
@@ -8,7 +8,7 @@ const normalizedRadius = radius - strokeWidth / 2;
8
8
  const circumference = normalizedRadius * 2 * Math.PI;
9
9
  const iconSize = radius * 0.88;
10
10
  const iconOffset = radius - iconSize / 2;
11
- const ProgressLoader = ({ progress = 0, onPress, Icon, }) => {
11
+ const ProgressLoader = ({ progress = 0, onPress, Icon }) => {
12
12
  const { colors } = useTheme();
13
13
  const backgroundColor = colors.primary.c20;
14
14
  const progressColor = colors.primary.c90;
@@ -2,7 +2,7 @@ import React, { useRef, useEffect } from "react";
2
2
  import { SafeAreaView } from "react-native";
3
3
  import Flex from "../../Layout/Flex";
4
4
  import ProgressBar from "../../ProgressBar";
5
- import { Transition, } from "../../transitions";
5
+ import { Transition } from "../../transitions";
6
6
  function FlowStepper({ activeIndex, header, footer, extraProps, progressBarProps, renderTransition, transitionDuration = 0, children, }) {
7
7
  const previousActiveIndex = useRef(null);
8
8
  const stepsLength = React.Children.count(children);
@@ -10,8 +10,7 @@ function FlowStepper({ activeIndex, header, footer, extraProps, progressBarProps
10
10
  previousActiveIndex.current = activeIndex;
11
11
  }, [activeIndex]);
12
12
  return (React.createElement(Flex, { flex: 1 },
13
- header &&
14
- header(Object.assign(Object.assign({}, extraProps), { activeIndex, stepsLength })),
13
+ header && header(Object.assign(Object.assign({}, extraProps), { activeIndex, stepsLength })),
15
14
  React.createElement(SafeAreaView, { style: { flex: 1 } },
16
15
  React.createElement(ProgressBar, Object.assign({ index: activeIndex, length: stepsLength }, progressBarProps)),
17
16
  React.createElement(Flex, { flex: 1 }, React.Children.map(children, (child, index) => {
@@ -32,7 +31,6 @@ function FlowStepper({ activeIndex, header, footer, extraProps, progressBarProps
32
31
  return index === activeIndex ? child : null;
33
32
  }
34
33
  })),
35
- footer &&
36
- footer(Object.assign(Object.assign({}, extraProps), { activeIndex, stepsLength })))));
34
+ footer && footer(Object.assign(Object.assign({}, extraProps), { activeIndex, stepsLength })))));
37
35
  }
38
36
  export default FlowStepper;
@@ -4,5 +4,5 @@ declare type Props = {
4
4
  activeIndex: number;
5
5
  onChange: (index: number) => void;
6
6
  };
7
- declare function SlideIndicator({ slidesLength, activeIndex, onChange, }: Props): React.ReactElement;
7
+ declare function SlideIndicator({ slidesLength, activeIndex, onChange }: Props): React.ReactElement;
8
8
  export default SlideIndicator;
@@ -30,11 +30,10 @@ const config = {
30
30
  duration: 200,
31
31
  easing: Easing.bezier(0.5, 0.01, 0, 1),
32
32
  };
33
- function SlideIndicator({ slidesLength, activeIndex = 0, onChange, }) {
33
+ function SlideIndicator({ slidesLength, activeIndex = 0, onChange }) {
34
34
  const slidesArray = useMemo(() => new Array(slidesLength).fill(0), [slidesLength]);
35
35
  const activeSize = useDerivedValue(() => {
36
- const size = (Math.max(0, Math.min(slidesLength - 1, activeIndex)) + 1) * (6 + 12) -
37
- 12;
36
+ const size = (Math.max(0, Math.min(slidesLength - 1, activeIndex)) + 1) * (6 + 12) - 12;
38
37
  return size;
39
38
  }, [activeIndex, slidesLength]);
40
39
  const animatedStyles = useAnimatedStyle(() => ({
@@ -13,5 +13,5 @@ export declare type StepperProps = {
13
13
  */
14
14
  errored?: boolean;
15
15
  };
16
- declare function Stepper({ steps, activeIndex, errored, }: StepperProps): React.ReactElement;
16
+ declare function Stepper({ steps, activeIndex, errored }: StepperProps): React.ReactElement;
17
17
  export default Stepper;
@@ -15,7 +15,7 @@ import { space, color } from "styled-system";
15
15
  import Text from "../../Text";
16
16
  import CheckAlone from "@ledgerhq/icons-ui/native/CheckAloneMedium";
17
17
  import CloseMedium from "@ledgerhq/icons-ui/native/CloseMedium";
18
- import Animated, { useAnimatedStyle, withTiming, withDelay, Easing, } from "react-native-reanimated";
18
+ import Animated, { useAnimatedStyle, withTiming, withDelay, Easing } from "react-native-reanimated";
19
19
  const Separator = styled.View `
20
20
  flex: 1;
21
21
  height: 1px;
@@ -75,8 +75,8 @@ const StepIcon = {
75
75
  border-radius: ${(p) => p.theme.space[1]}px;
76
76
  background-color: ${(p) => p.theme.colors.neutral.c70};
77
77
  `,
78
- Completed: ({ color }) => (React.createElement(CheckAlone, { size: 16, color: color })),
79
- Errored: ({ color }) => (React.createElement(CloseMedium, { size: 16, color: color })),
78
+ Completed: ({ color }) => React.createElement(CheckAlone, { size: 16, color: color }),
79
+ Errored: ({ color }) => React.createElement(CloseMedium, { size: 16, color: color }),
80
80
  };
81
81
  // #endregion
82
82
  // #region Step
@@ -133,7 +133,7 @@ const Container = styled.View `
133
133
  flex-direction: row;
134
134
  width: 100%;
135
135
  `;
136
- function Stepper({ steps, activeIndex, errored, }) {
136
+ function Stepper({ steps, activeIndex, errored }) {
137
137
  const { space } = useTheme();
138
138
  const separatorMarginTop = useMemo(() => Math.floor(space[5] / 2), [space]);
139
139
  return (React.createElement(Container, null, steps.map((label, i) => (React.createElement(React.Fragment, { key: i },
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import React from "react";
13
13
  import styled from "styled-components/native";
14
14
  import Flex from "../Layout/Flex";
15
- import Animated, { useDerivedValue, useAnimatedStyle, withTiming, } from "react-native-reanimated";
15
+ import Animated, { useDerivedValue, useAnimatedStyle, withTiming } from "react-native-reanimated";
16
16
  const ActiveBar = styled.View `
17
17
  background-color: ${(p) => p.theme.colors.neutral.c100};
18
18
  position: absolute;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
2
  import { BaseTabsProps, TabItemProps } from "../TemplateTabs";
3
- export declare const ChipTab: ({ onPress, isActive, label, }: TabItemProps) => React.ReactElement;
3
+ export declare const ChipTab: ({ onPress, isActive, label }: TabItemProps) => React.ReactElement;
4
4
  declare const ChipTabs: (props: BaseTabsProps) => React.ReactElement;
5
5
  export default ChipTabs;
@@ -9,10 +9,10 @@ const TabBox = styled(TouchableOpacity) `
9
9
  flex: 1;
10
10
  padding: ${(p) => p.theme.space[5]}px 0;
11
11
  border-radius: 8px;
12
- background-color: ${(p) => p.isActive ? p.theme.colors.palette.primary.c20 : "transparent"};
12
+ background-color: ${(p) => (p.isActive ? p.theme.colors.palette.primary.c20 : "transparent")};
13
13
  `;
14
14
  const StyledTabs = styled(TemplateTabs) ``;
15
- export const ChipTab = ({ onPress, isActive, label, }) => {
15
+ export const ChipTab = ({ onPress, isActive, label }) => {
16
16
  return (React.createElement(TabBox, { isActive: isActive, onPress: onPress },
17
17
  React.createElement(Text, { variant: "small", fontWeight: "semiBold", color: isActive ? "palette.neutral.c100" : "palette.neutral.c80", textAlign: "center" }, label)));
18
18
  };
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
2
  import { BaseTabsProps, TabItemProps } from "../TemplateTabs";
3
- export declare const GraphTab: ({ onPress, isActive, label, }: TabItemProps) => React.ReactElement;
3
+ export declare const GraphTab: ({ onPress, isActive, label }: TabItemProps) => React.ReactElement;
4
4
  declare const GraphTabs: (props: BaseTabsProps) => React.ReactElement;
5
5
  export default GraphTabs;
@@ -14,7 +14,7 @@ const StyledTabs = styled(TemplateTabs) `
14
14
  border-radius: 35px;
15
15
  padding: 4px;
16
16
  `;
17
- export const GraphTab = ({ onPress, isActive, label, }) => {
17
+ export const GraphTab = ({ onPress, isActive, label }) => {
18
18
  return (React.createElement(TabBbx, { onPress: onPress }, isActive ? (React.createElement(Button, { type: "main" }, label)) : (React.createElement(Text, { lineHeight: 36, textAlign: "center" }, label))));
19
19
  };
20
20
  const GraphTabs = (props) => (React.createElement(StyledTabs, Object.assign({}, props, { Item: GraphTab })));
@@ -7,6 +7,7 @@ export declare type ButtonProps = TouchableOpacityProps & BaseStyledProps & {
7
7
  size: number;
8
8
  color: string;
9
9
  }> | null;
10
+ iconName?: string;
10
11
  type?: "main" | "shade" | "error" | "color" | "default";
11
12
  size?: "small" | "medium" | "large";
12
13
  iconPosition?: "right" | "left";
@@ -7,19 +7,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import React, { useCallback, useState } from "react";
10
+ import React, { useCallback, useState, useMemo } from "react";
11
11
  import styled, { useTheme } from "styled-components/native";
12
- import { ActivityIndicator, TouchableOpacity, } from "react-native";
13
- import { buttonSizeStyle, getButtonColorStyle, } from "../../cta/Button/getButtonStyle";
12
+ import { ActivityIndicator, TouchableOpacity } from "react-native";
13
+ import { buttonSizeStyle, getButtonColorStyle } from "../../cta/Button/getButtonStyle";
14
14
  import { ctaIconSize, ctaTextType } from "../../cta/getCtaStyle";
15
15
  import Text from "../../Text";
16
+ import { Icon as IconComponent } from "../../Icon";
16
17
  import baseStyled from "../../styled";
17
18
  const IconContainer = styled.View `
18
- ${(p) => p.iconButton
19
- ? ""
20
- : p.iconPosition === "left"
21
- ? `margin-right: 10px;`
22
- : `margin-left: 10px;`}
19
+ ${(p) => p.iconButton ? "" : p.iconPosition === "left" ? `margin-right: 10px;` : `margin-left: 10px;`}
23
20
  `;
24
21
  export const Base = baseStyled(TouchableOpacity).attrs((p) => (Object.assign(Object.assign({}, getButtonColorStyle(p.theme.colors, p).button), {
25
22
  // Avoid conflict with styled-system's size property by nulling size and renaming it
@@ -58,13 +55,14 @@ const SpinnerContainer = styled.View `
58
55
  justify-content: center;
59
56
  `;
60
57
  const ButtonContainer = (props) => {
61
- const { Icon, iconPosition = "right", children, hide = false, size = "medium", } = props;
58
+ const { Icon, iconPosition = "right", children, hide = false, size = "medium", iconName } = props;
62
59
  const theme = useTheme();
63
60
  const { text } = getButtonColorStyle(theme.colors, props);
61
+ const IconNode = useMemo(() => (iconName && React.createElement(IconComponent, { name: iconName, size: ctaIconSize[size], color: text.color })) ||
62
+ (Icon && React.createElement(Icon, { size: ctaIconSize[size], color: text.color })), [iconName, size, Icon, text.color]);
64
63
  return (React.createElement(Container, { hide: hide },
65
64
  iconPosition === "right" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: text.color }, children)) : null,
66
- Icon ? (React.createElement(IconContainer, { iconButton: !children, iconPosition: iconPosition },
67
- React.createElement(Icon, { size: ctaIconSize[size], color: text.color }))) : null,
65
+ IconNode && (React.createElement(IconContainer, { iconButton: !children, iconPosition: iconPosition }, IconNode)),
68
66
  iconPosition === "left" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: text.color }, children)) : null));
69
67
  };
70
68
  const Button = (props) => {
@@ -5,11 +5,7 @@ import Text from "../../Text";
5
5
  import { getLinkColors } from "./getLinkStyle";
6
6
  import { ctaIconSize, ctaTextType } from "../getCtaStyle";
7
7
  const IconContainer = styled.View `
8
- ${(p) => p.iconLink
9
- ? ""
10
- : p.iconPosition === "left"
11
- ? `margin-right: 6px;`
12
- : `margin-left: 6px;`}
8
+ ${(p) => p.iconLink ? "" : p.iconPosition === "left" ? `margin-right: 6px;` : `margin-left: 6px;`}
13
9
  `;
14
10
  export const Base = styled(TouchableOpacity) `
15
11
  flex-direction: row;
@@ -4,5 +4,5 @@ export interface AlertProps {
4
4
  title: string;
5
5
  showIcon?: boolean;
6
6
  }
7
- export default function Alert({ type, title, showIcon, }: AlertProps): JSX.Element;
7
+ export default function Alert({ type, title, showIcon }: AlertProps): JSX.Element;
8
8
  export {};
@@ -39,7 +39,7 @@ const StyledAlertContainer = styled(FlexBox).attrs((p) => ({
39
39
  flex-direction: row;
40
40
  align-items: center;
41
41
  `;
42
- export default function Alert({ type = "info", title, showIcon = true, }) {
42
+ export default function Alert({ type = "info", title, showIcon = true }) {
43
43
  const theme = useTheme();
44
44
  const textColor = getColor(theme, alertColors[type || "info"].color);
45
45
  return (React.createElement(StyledAlertContainer, { type: type },
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import styled, { useTheme } from "styled-components/native";
3
3
  import FlexBox from "../../Layout/Flex";
4
- import { TouchableOpacity, } from "react-native";
4
+ import { TouchableOpacity } from "react-native";
5
5
  import Text from "../../Text";
6
6
  import CloseMedium from "@ledgerhq/icons-ui/native/CloseMedium";
7
7
  import { Flex } from "../../Layout";
@@ -8,4 +8,4 @@ export interface SlideProps extends TransitionProps {
8
8
  /**
9
9
  * A slide left/right transition translating its children based on their status and a given direction.
10
10
  */
11
- export declare function Slide({ status, duration, style, direction, children, }: SlideProps): JSX.Element;
11
+ export declare function Slide({ status, duration, style, direction, children }: SlideProps): JSX.Element;
@@ -4,7 +4,7 @@ const WEB = Platform.OS === "web";
4
4
  /**
5
5
  * A slide left/right transition translating its children based on their status and a given direction.
6
6
  */
7
- export function Slide({ status, duration, style, direction = "left", children, }) {
7
+ export function Slide({ status, duration, style, direction = "left", children }) {
8
8
  const [width, setWidth] = useState(Dimensions.get("window").width);
9
9
  const styleRef = useRef(new Animated.Value(0)).current;
10
10
  const previousStatus = useRef(null);
@@ -10,8 +10,7 @@ export function Transition({ in: inValue, timeout, mountOnEnter, unmountOnExit,
10
10
  const canMount = useRef(!mountOnEnter);
11
11
  canMount.current = canMount.current || inValue;
12
12
  useEffect(() => {
13
- if ((inValue && status === "entered") ||
14
- (!inValue && status === "exited")) {
13
+ if ((inValue && status === "entered") || (!inValue && status === "exited")) {
15
14
  return;
16
15
  }
17
16
  if (inValue && !enter) {
@@ -20,9 +19,7 @@ export function Transition({ in: inValue, timeout, mountOnEnter, unmountOnExit,
20
19
  if (!inValue && !exit) {
21
20
  return setStatus("exited");
22
21
  }
23
- const timeoutValue = typeof timeout === "number"
24
- ? timeout
25
- : timeout[inValue ? "enter" : "exit"];
22
+ const timeoutValue = typeof timeout === "number" ? timeout : timeout[inValue ? "enter" : "exit"];
26
23
  setStatus(inValue ? "entering" : "exiting");
27
24
  const timeoutRef = setTimeout(() => {
28
25
  setStatus(inValue ? "entered" : "exited");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/native-ui",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Ledger Live - Desktop UI",
5
5
  "repository": "https://github.com/LedgerHQ/ui",
6
6
  "license": "MIT",
@@ -15,8 +15,8 @@
15
15
  "index.js"
16
16
  ],
17
17
  "dependencies": {
18
- "@ledgerhq/icons-ui": "^0.2.1",
19
- "@ledgerhq/ui-shared": "^0.1.4",
18
+ "@ledgerhq/icons-ui": "^0.2.2",
19
+ "@ledgerhq/ui-shared": "^0.1.5",
20
20
  "@types/color": "^3.0.2",
21
21
  "@types/react": "^17.0.37",
22
22
  "@types/react-native": "^0.65.9",
@@ -9,5 +9,5 @@ declare module "styled-components" {
9
9
  interface DefaultTheme extends Theme {
10
10
  }
11
11
  }
12
- export declare const StyleProvider: ({ children, selectedPalette, }: Props) => React.ReactElement;
12
+ export declare const StyleProvider: ({ children, selectedPalette }: Props) => React.ReactElement;
13
13
  export {};
@@ -2,7 +2,7 @@ import React, { useMemo } from "react";
2
2
  import { ThemeProvider } from "styled-components/native";
3
3
  import defaultTheme from "./theme";
4
4
  import { palettes } from "@ledgerhq/ui-shared";
5
- export const StyleProvider = ({ children, selectedPalette, }) => {
5
+ export const StyleProvider = ({ children, selectedPalette }) => {
6
6
  const theme = useMemo(() => (Object.assign(Object.assign({}, defaultTheme), { colors: Object.assign(Object.assign(Object.assign({}, defaultTheme.colors), palettes[selectedPalette]), { palette: palettes[selectedPalette] }), theme: selectedPalette })), [selectedPalette]);
7
7
  return React.createElement(ThemeProvider, { theme: theme }, children);
8
8
  };
package/styles/helpers.js CHANGED
@@ -5,9 +5,7 @@ export const darken = (c, a) => Color(c).darken(a).toString();
5
5
  export const lighten = (c, a) => Color(c).lighten(a).toString();
6
6
  export const mix = (c, b, a) => Color(c).mix(Color(b), a).toString();
7
7
  const get = (object, path) => {
8
- const p = typeof path === "string"
9
- ? path.split(".").filter((key) => key.length)
10
- : path;
8
+ const p = typeof path === "string" ? path.split(".").filter((key) => key.length) : path;
11
9
  return p.reduce((dive, key) => dive && dive[key], object);
12
10
  };
13
11
  export const getColor = (p, color) => {
Binary file
Binary file