@ledgerhq/native-ui 0.6.0 → 0.6.4

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 (81) 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.d.ts +1 -1
  6. package/components/Form/Input/BaseInput/index.js +19 -5
  7. package/components/Form/Input/NumberInput/index.js +2 -2
  8. package/components/Form/SelectableList.d.ts +11 -7
  9. package/components/Form/SelectableList.js +5 -3
  10. package/components/Form/Slider/index.native.js +1 -1
  11. package/components/Form/Switch/index.d.ts +1 -1
  12. package/components/Form/Switch/index.js +2 -2
  13. package/components/Form/Toggle/index.d.ts +1 -1
  14. package/components/Form/Toggle/index.js +1 -1
  15. package/components/Icon/BoxedIcon.d.ts +49 -0
  16. package/components/Icon/BoxedIcon.js +85 -0
  17. package/components/Icon/Icon.d.ts +9 -0
  18. package/components/Icon/Icon.js +20 -0
  19. package/components/Icon/IconBox/index.d.ts +9 -5
  20. package/components/Icon/IconBox/index.js +11 -11
  21. package/components/Icon/index.d.ts +2 -0
  22. package/components/Icon/index.js +2 -0
  23. package/components/Icon/type.d.ts +7 -0
  24. package/components/Icon/type.js +1 -0
  25. package/components/Layout/Collapse/Accordion/index.js +1 -1
  26. package/components/Layout/List/IconBoxList/index.d.ts +10 -0
  27. package/components/Layout/List/IconBoxList/index.js +19 -0
  28. package/components/Layout/List/List/index.d.ts +13 -0
  29. package/components/Layout/List/List/index.js +29 -0
  30. package/components/Layout/List/NumberedList/index.d.ts +9 -0
  31. package/components/Layout/List/NumberedList/index.js +23 -0
  32. package/components/Layout/List/TipList/index.d.ts +9 -0
  33. package/components/Layout/List/TipList/index.js +20 -0
  34. package/components/Layout/List/index.d.ts +4 -0
  35. package/components/Layout/List/index.js +4 -0
  36. package/components/Layout/ScrollContainer/index.d.ts +2 -1
  37. package/components/Layout/ScrollContainer/index.js +2 -2
  38. package/components/Layout/ScrollContainerHeader/Header.d.ts +1 -1
  39. package/components/Layout/ScrollContainerHeader/Header.js +23 -16
  40. package/components/Layout/ScrollContainerHeader/index.d.ts +5 -3
  41. package/components/Layout/ScrollContainerHeader/index.js +9 -4
  42. package/components/Layout/index.d.ts +1 -0
  43. package/components/Layout/index.js +1 -0
  44. package/components/Loader/InfiniteLoader/index.d.ts +9 -0
  45. package/components/Loader/InfiniteLoader/index.js +58 -0
  46. package/components/Loader/ProgressLoader/index.d.ts +11 -0
  47. package/components/Loader/ProgressLoader/index.js +24 -0
  48. package/components/Loader/index.d.ts +2 -11
  49. package/components/Loader/index.js +2 -24
  50. package/components/Navigation/FlowStepper/index.d.ts +7 -1
  51. package/components/Navigation/FlowStepper/index.js +5 -7
  52. package/components/Navigation/SlideIndicator/index.d.ts +1 -1
  53. package/components/Navigation/SlideIndicator/index.js +2 -3
  54. package/components/Navigation/Stepper/index.d.ts +1 -1
  55. package/components/Navigation/Stepper/index.js +4 -4
  56. package/components/ProgressBar/index.js +1 -1
  57. package/components/Tabs/Chip/index.d.ts +1 -1
  58. package/components/Tabs/Chip/index.js +2 -2
  59. package/components/Tabs/Graph/index.d.ts +1 -1
  60. package/components/Tabs/Graph/index.js +9 -3
  61. package/components/Tabs/TemplateTabs/index.d.ts +6 -0
  62. package/components/Tabs/TemplateTabs/index.js +2 -2
  63. package/components/Text/getTextStyle.d.ts +1 -0
  64. package/components/Text/getTextStyle.js +5 -0
  65. package/components/Text/index.d.ts +7 -9
  66. package/components/Text/index.js +15 -8
  67. package/components/cta/Button/index.d.ts +1 -0
  68. package/components/cta/Button/index.js +9 -11
  69. package/components/cta/Link/index.js +1 -5
  70. package/components/index.d.ts +1 -1
  71. package/components/index.js +1 -1
  72. package/components/message/Alert/index.d.ts +1 -1
  73. package/components/message/Alert/index.js +2 -2
  74. package/components/message/Notification/index.js +1 -1
  75. package/components/transitions/Slide.d.ts +1 -1
  76. package/components/transitions/Slide.js +1 -1
  77. package/components/transitions/Transition.js +2 -5
  78. package/package.json +3 -3
  79. package/styles/StyleProvider.d.ts +1 -1
  80. package/styles/StyleProvider.js +1 -1
  81. package/styles/helpers.js +1 -3
@@ -0,0 +1,20 @@
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, { useMemo } from "react";
13
+ import List from "../List";
14
+ import Check from "@ledgerhq/icons-ui/native/CheckAloneMedium";
15
+ import Close from "@ledgerhq/icons-ui/native/CloseMedium";
16
+ export default function TipList(_a) {
17
+ var { items } = _a, props = __rest(_a, ["items"]);
18
+ const tipItems = useMemo(() => items.map((item) => (Object.assign(Object.assign({}, item), { bullet: item.isPositive ? (React.createElement(Check, { size: 20, color: "success.c100" })) : (React.createElement(Close, { size: 20, color: "error.c100" })) }))), [items]);
19
+ return React.createElement(List, Object.assign({ items: tipItems }, props));
20
+ }
@@ -0,0 +1,4 @@
1
+ export { default as List } from "./List";
2
+ export { default as IconBoxList } from "./IconBoxList";
3
+ export { default as TipList } from "./TipList";
4
+ export { default as NumberedList } from "./NumberedList";
@@ -0,0 +1,4 @@
1
+ export { default as List } from "./List";
2
+ export { default as IconBoxList } from "./IconBoxList";
3
+ export { default as TipList } from "./TipList";
4
+ export { default as NumberedList } from "./NumberedList";
@@ -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,9 +1,11 @@
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"> & {
5
6
  children?: React.ReactNode;
6
7
  onScroll?: (y: number) => void;
8
+ containerProps?: BaseStyledProps;
7
9
  };
8
- declare const ScrollContainerHeader: ({ TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, children, onScroll, ...props }: ScrollContainerHeaderProps) => JSX.Element;
10
+ declare const ScrollContainerHeader: ({ TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, children, onScroll, containerProps, ...props }: ScrollContainerHeaderProps) => JSX.Element;
9
11
  export default ScrollContainerHeader;
@@ -10,18 +10,23 @@ 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";
15
+ import Flex from "../Flex";
14
16
  import Header from "./Header";
17
+ import baseStyled from "../../styled";
18
+ const StyledFlatList = baseStyled.FlatList ``;
19
+ const AnimatedFlatList = Animated.createAnimatedComponent(StyledFlatList);
15
20
  const ScrollContainerHeader = (_a) => {
16
- var { TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, children, onScroll } = _a, props = __rest(_a, ["TopLeftSection", "TopRightSection", "TopMiddleSection", "MiddleSection", "BottomSection", "children", "onScroll"]);
21
+ var { TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, children, onScroll, containerProps } = _a, props = __rest(_a, ["TopLeftSection", "TopRightSection", "TopMiddleSection", "MiddleSection", "BottomSection", "children", "onScroll", "containerProps"]);
17
22
  const currentPositionY = useSharedValue(0);
18
23
  const handleScroll = useAnimatedScrollHandler((event) => {
19
24
  currentPositionY.value = event.contentOffset.y;
20
25
  if (onScroll)
21
26
  onScroll(event.contentOffset.y);
22
27
  });
23
- return (React.createElement(Animated.ScrollView, Object.assign({}, props, { onScroll: handleScroll, scrollEventThrottle: 16, stickyHeaderIndices: [0] }),
28
+ return (React.createElement(Flex, Object.assign({ flex: 1 }, containerProps),
24
29
  React.createElement(Header, { TopLeftSection: TopLeftSection, TopRightSection: TopRightSection, TopMiddleSection: TopMiddleSection, MiddleSection: MiddleSection, BottomSection: BottomSection, currentPositionY: currentPositionY }),
25
- children));
30
+ React.createElement(AnimatedFlatList, Object.assign({}, props, { onScroll: handleScroll, scrollEventThrottle: 16, data: [...React.Children.toArray(children)], renderItem: ({ item }) => React.createElement(View, null, item), keyExtractor: (_, index) => index }))));
26
31
  };
27
32
  export default ScrollContainerHeader;
@@ -5,3 +5,4 @@ export * from "./Modals";
5
5
  export { default as ScrollContainer } from "./ScrollContainer";
6
6
  export { default as ScrollContainerHeader } from "./ScrollContainerHeader";
7
7
  export { default as Row } from "./Table/Row";
8
+ export * from "./List";
@@ -5,3 +5,4 @@ export * from "./Modals";
5
5
  export { default as ScrollContainer } from "./ScrollContainer";
6
6
  export { default as ScrollContainerHeader } from "./ScrollContainerHeader";
7
7
  export { default as Row } from "./Table/Row";
8
+ export * from "./List";
@@ -0,0 +1,9 @@
1
+ /// <reference types="styled-components-react-native" />
2
+ import React from "react";
3
+ import { SizeProps } from "styled-system";
4
+ declare const Loader: import("styled-components").StyledComponent<import("react").ComponentClass<import("react-native-svg").SvgProps, any>, import("styled-components").DefaultTheme, SizeProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Height<import("styled-system").TLengthStyledSystem>>, never>;
5
+ export declare type Props = React.ComponentProps<typeof Loader> & {
6
+ color?: string;
7
+ };
8
+ export default function InfiniteLoader({ size, color, ...extraProps }: Props): JSX.Element;
9
+ export {};
@@ -0,0 +1,58 @@
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, { useEffect } from "react";
13
+ import Svg, { LinearGradient, Stop, Mask, Path, Rect } from "react-native-svg";
14
+ import styled from "styled-components/native";
15
+ import { system, size } from "styled-system";
16
+ import Animated, { useAnimatedStyle, useSharedValue, withRepeat, withTiming, cancelAnimation, Easing, } from "react-native-reanimated";
17
+ const strokeSystem = system({
18
+ stroke: {
19
+ property: "stroke",
20
+ scale: "colors",
21
+ },
22
+ });
23
+ const Loader = styled(Svg).attrs((props) => (Object.assign({}, strokeSystem(props)))) `
24
+ ${size}
25
+ `;
26
+ export default function InfiniteLoader(_a) {
27
+ var { size = 38, color = "primary.c50" } = _a, extraProps = __rest(_a, ["size", "color"]);
28
+ const rotation = useSharedValue(0);
29
+ const animatedStyles = useAnimatedStyle(() => {
30
+ return {
31
+ transform: [
32
+ {
33
+ rotateZ: `${rotation.value}deg`,
34
+ },
35
+ ],
36
+ };
37
+ }, [rotation.value]);
38
+ useEffect(() => {
39
+ rotation.value = withRepeat(withTiming(360, {
40
+ duration: 1000,
41
+ easing: Easing.linear,
42
+ }), -1);
43
+ return () => cancelAnimation(rotation);
44
+ // eslint-disable-next-line react-hooks/exhaustive-deps
45
+ }, []);
46
+ return (React.createElement(Animated.View, { style: [{ display: "flex", justifyContent: "center", alignItems: "center" }, animatedStyles] },
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),
48
+ React.createElement(LinearGradient, { id: "gradient-start", gradientUnits: "userSpaceOnUse", gradientTransform: "rotate(-20)" },
49
+ React.createElement(Stop, { offset: 0, stopColor: "white", stopOpacity: 0.5 }),
50
+ React.createElement(Stop, { offset: 1, stopColor: "white", stopOpacity: 1 })),
51
+ React.createElement(LinearGradient, { id: "gradient-end", gradientUnits: "userSpaceOnUse", gradientTransform: "rotate(-20)" },
52
+ React.createElement(Stop, { offset: 0, stopColor: "white", stopOpacity: 0.5 }),
53
+ React.createElement(Stop, { offset: 1, stopColor: "white", stopOpacity: 0 })),
54
+ React.createElement(Mask, { id: "gradient-mask" },
55
+ React.createElement(Rect, { x: 0, y: -4, width: 44, height: 22, strokeWidth: 0, fill: "url(#gradient-start)", transform: "rotate(10)" }),
56
+ React.createElement(Rect, { x: 0, y: 18, width: 44, height: 21, strokeWidth: 0, fill: "url(#gradient-end)", transform: "rotate(10)" })),
57
+ React.createElement(Path, { d: "M34.8807 20.9499C35.3608 17.0398 34.3815 13.09 32.1304 9.85712C29.8793 6.6242 26.5146 4.33541 22.6808 3.42914C18.847 2.52287 14.8136 3.06283 11.3532 4.94559C7.89277 6.82836 5.24858 9.92158 3.92708 13.6328C2.60558 17.344 2.69968 21.4123 4.19135 25.0584C5.68302 28.7045 8.4674 31.6722 12.0112 33.3929C15.5549 35.1137 19.609 35.4666 23.3968 34.384C27.1846 33.3015 30.4398 30.8596 32.5391 27.526", strokeWidth: 6, strokeLinecap: "round", strokeLinejoin: "round", mask: "url(#gradient-mask)" }))));
58
+ }
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ declare type Props = {
3
+ progress?: number;
4
+ onPress?: () => void;
5
+ Icon?: React.ComponentType<{
6
+ color: string;
7
+ size: number;
8
+ }>;
9
+ };
10
+ declare const ProgressLoader: ({ progress, onPress, Icon }: Props) => React.ReactElement;
11
+ export default ProgressLoader;
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { Svg, Circle, G } from "react-native-svg";
3
+ import { useTheme } from "styled-components/native";
4
+ import { TouchableOpacity } from "react-native";
5
+ const radius = 25;
6
+ const strokeWidth = 2;
7
+ const normalizedRadius = radius - strokeWidth / 2;
8
+ const circumference = normalizedRadius * 2 * Math.PI;
9
+ const iconSize = radius * 0.88;
10
+ const iconOffset = radius - iconSize / 2;
11
+ const ProgressLoader = ({ progress = 0, onPress, Icon }) => {
12
+ const { colors } = useTheme();
13
+ const backgroundColor = colors.primary.c20;
14
+ const progressColor = colors.primary.c90;
15
+ const strokeDashoffset = circumference - progress * circumference;
16
+ return (React.createElement(TouchableOpacity, { disabled: !onPress, onPress: onPress },
17
+ React.createElement(Svg, { width: radius * 2, height: radius * 2 },
18
+ React.createElement(Circle, { cx: radius, cy: radius, r: radius * 0.92, fill: "transparent", stroke: backgroundColor, strokeDashoffset: 0, strokeWidth: strokeWidth }),
19
+ React.createElement(G, { transform: `rotate(-90) translate(-${radius * 2}, 0)` },
20
+ React.createElement(Circle, { cx: radius, cy: radius, r: radius * 0.92, fill: "transparent", stroke: progressColor, strokeWidth: strokeWidth, strokeDasharray: `${circumference} ${circumference}`, strokeDashoffset: strokeDashoffset })),
21
+ Icon ? (React.createElement(G, { transform: `translate(${iconOffset}, ${iconOffset})` },
22
+ React.createElement(Icon, { color: progressColor, size: iconSize }))) : null)));
23
+ };
24
+ export default ProgressLoader;
@@ -1,11 +1,2 @@
1
- import React from "react";
2
- declare type Props = {
3
- progress?: number;
4
- onPress?: () => void;
5
- Icon?: React.ComponentType<{
6
- color: string;
7
- size: number;
8
- }>;
9
- };
10
- declare const ProgressLoader: ({ progress, onPress, Icon, }: Props) => React.ReactElement;
11
- export default ProgressLoader;
1
+ export { default as Loader } from "./ProgressLoader";
2
+ export { default as InfiniteLoader } from "./InfiniteLoader";
@@ -1,24 +1,2 @@
1
- import React from "react";
2
- import { Svg, Circle, G } from "react-native-svg";
3
- import { useTheme } from "styled-components/native";
4
- import { TouchableOpacity } from "react-native";
5
- const radius = 25;
6
- const strokeWidth = 2;
7
- const normalizedRadius = radius - strokeWidth / 2;
8
- const circumference = normalizedRadius * 2 * Math.PI;
9
- const iconSize = radius * 0.88;
10
- const iconOffset = radius - iconSize / 2;
11
- const ProgressLoader = ({ progress = 0, onPress, Icon, }) => {
12
- const { colors } = useTheme();
13
- const backgroundColor = colors.primary.c20;
14
- const progressColor = colors.primary.c90;
15
- const strokeDashoffset = circumference - progress * circumference;
16
- return (React.createElement(TouchableOpacity, { disabled: !onPress, onPress: onPress },
17
- React.createElement(Svg, { width: radius * 2, height: radius * 2 },
18
- React.createElement(Circle, { cx: radius, cy: radius, r: radius * 0.92, fill: "transparent", stroke: backgroundColor, strokeDashoffset: 0, strokeWidth: strokeWidth }),
19
- React.createElement(G, { transform: `rotate(-90) translate(-${radius * 2}, 0)` },
20
- React.createElement(Circle, { cx: radius, cy: radius, r: radius * 0.92, fill: "transparent", stroke: progressColor, strokeWidth: strokeWidth, strokeDasharray: `${circumference} ${circumference}`, strokeDashoffset: strokeDashoffset })),
21
- Icon ? (React.createElement(G, { transform: `translate(${iconOffset}, ${iconOffset})` },
22
- React.createElement(Icon, { color: progressColor, size: iconSize }))) : null)));
23
- };
24
- export default ProgressLoader;
1
+ export { default as Loader } from "./ProgressLoader";
2
+ export { default as InfiniteLoader } from "./InfiniteLoader";
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { FlexBoxProps } from "../../Layout/Flex";
2
3
  import { TransitionProps } from "../../transitions";
3
4
  interface InnerProps {
4
5
  /**
@@ -37,6 +38,11 @@ export interface Props<ExtraProps> {
37
38
  * Extra props that are passed to the header and footer render functions.
38
39
  */
39
40
  extraProps?: ExtraProps;
41
+ /**
42
+ * Additional props to pass to the progressbar component.
43
+ * This component is a Flex element.
44
+ */
45
+ progressBarProps?: FlexBoxProps;
40
46
  /**
41
47
  * **Use this prop in combination with `transitionDuration`.**
42
48
  *
@@ -60,5 +66,5 @@ export interface Props<ExtraProps> {
60
66
  */
61
67
  children: React.ReactNode;
62
68
  }
63
- declare function FlowStepper<ExtraProps>({ activeIndex, header, footer, extraProps, renderTransition, transitionDuration, children, }: Props<ExtraProps>): JSX.Element;
69
+ declare function FlowStepper<ExtraProps>({ activeIndex, header, footer, extraProps, progressBarProps, renderTransition, transitionDuration, children, }: Props<ExtraProps>): JSX.Element;
64
70
  export default FlowStepper;
@@ -2,18 +2,17 @@ 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";
6
- function FlowStepper({ activeIndex, header, footer, extraProps, renderTransition, transitionDuration = 0, children, }) {
5
+ import { Transition } from "../../transitions";
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);
9
9
  useEffect(() => () => {
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
- React.createElement(ProgressBar, { index: activeIndex, length: stepsLength }),
15
+ React.createElement(ProgressBar, Object.assign({ index: activeIndex, length: stepsLength }, progressBarProps)),
17
16
  React.createElement(Flex, { flex: 1 }, React.Children.map(children, (child, index) => {
18
17
  if (renderTransition && transitionDuration) {
19
18
  return (React.createElement(Transition, { in: index === activeIndex, timeout: transitionDuration, mountOnEnter: true, unmountOnExit: true }, (status) => {
@@ -32,7 +31,6 @@ function FlowStepper({ activeIndex, header, footer, extraProps, renderTransition
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, activeColor, activeBg, }: TabItemProps) => React.ReactElement;
4
4
  declare const GraphTabs: (props: BaseTabsProps) => React.ReactElement;
5
5
  export default GraphTabs;
@@ -2,20 +2,26 @@ import React from "react";
2
2
  import styled from "styled-components/native";
3
3
  import Text from "../../Text";
4
4
  import { TouchableOpacity } from "react-native";
5
- import Button from "../../cta/Button";
6
5
  import TemplateTabs from "../TemplateTabs";
7
6
  const TabBbx = styled(TouchableOpacity) `
8
7
  text-align: center;
9
8
  margin: auto;
10
9
  flex: 1;
11
10
  `;
11
+ const TabText = styled(Text).attrs({
12
+ lineHeight: "48px",
13
+ textAlign: "center",
14
+ borderRadius: 48,
15
+ px: 24,
16
+ height: 48,
17
+ }) ``;
12
18
  const StyledTabs = styled(TemplateTabs) `
13
19
  border: ${(p) => `1px solid ${p.theme.colors.palette.neutral.c40}`};
14
20
  border-radius: 35px;
15
21
  padding: 4px;
16
22
  `;
17
- export const GraphTab = ({ onPress, isActive, label, }) => {
18
- return (React.createElement(TabBbx, { onPress: onPress }, isActive ? (React.createElement(Button, { type: "main" }, label)) : (React.createElement(Text, { lineHeight: 36, textAlign: "center" }, label))));
23
+ export const GraphTab = ({ onPress, isActive, label, activeColor = "neutral.c100", activeBg = "primary.c20", }) => {
24
+ return (React.createElement(TabBbx, { onPress: onPress }, isActive ? (React.createElement(TabText, { variant: "body", bg: activeBg, color: activeColor, fontWeight: "semiBold" }, label)) : (React.createElement(TabText, { variant: "body" }, label))));
19
25
  };
20
26
  const GraphTabs = (props) => (React.createElement(StyledTabs, Object.assign({}, props, { Item: GraphTab })));
21
27
  export default GraphTabs;
@@ -4,15 +4,21 @@ export declare type BaseTabsProps = {
4
4
  labels: string[];
5
5
  activeIndex: number;
6
6
  onChange: (newIndex: number) => void;
7
+ activeColor?: string;
8
+ activeBg?: string;
7
9
  };
8
10
  export declare type TabItemProps = Partial<BaseTabsProps> & {
9
11
  label: string;
10
12
  isActive: boolean;
11
13
  index: number;
12
14
  onPress: () => void;
15
+ activeColor?: string;
16
+ activeBg?: string;
13
17
  };
14
18
  export declare type TabsProps = BaseTabsProps & {
15
19
  Item: (props: TabItemProps) => React.ReactElement;
20
+ activeColor?: string;
21
+ activeBg?: string;
16
22
  };
17
23
  export declare const TabsContainer: 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>> & {
18
24
  columnGap?: string | number | undefined;
@@ -8,7 +8,7 @@ export const TabsContainer = styled(FlexBox).attrs({
8
8
  width: 100%;
9
9
  `;
10
10
  const TemplateTabsGroup = (props) => {
11
- const { labels, activeIndex, onChange, Item } = props;
12
- return (React.createElement(TabsContainer, Object.assign({}, props), labels.map((label, index) => (React.createElement(Item, Object.assign({ key: index }, props, { label: label, index: index, isActive: index === activeIndex, onPress: () => onChange(index) }))))));
11
+ const { labels, activeIndex, onChange, Item, activeColor, activeBg } = props;
12
+ return (React.createElement(TabsContainer, Object.assign({}, props), labels.map((label, index) => (React.createElement(Item, Object.assign({ key: index }, props, { label: label, index: index, isActive: index === activeIndex, onPress: () => onChange(index), activeColor: activeColor, activeBg: activeBg }))))));
13
13
  };
14
14
  export default TemplateTabsGroup;
@@ -7,6 +7,7 @@ export declare function getTextTypeStyle({ bracket }: {
7
7
  fontFamily: string;
8
8
  lineHeight?: number;
9
9
  paddingTop?: number;
10
+ textTransform?: string;
10
11
  }>;
11
12
  export declare function getTextStyle({ variant, bracket, fontWeight, }: Partial<BaseTextProps>): {
12
13
  fontFamily: string;
@@ -4,19 +4,23 @@ export function getTextTypeStyle({ bracket }) {
4
4
  fontFamily: "Alpha",
5
5
  lineHeight: 32,
6
6
  paddingTop: bracket ? 15 : 0,
7
+ textTransform: "uppercase",
7
8
  },
8
9
  h2: {
9
10
  fontFamily: "Alpha",
10
11
  lineHeight: 28,
11
12
  paddingTop: bracket ? 10 : 0,
13
+ textTransform: "uppercase",
12
14
  },
13
15
  h3: {
14
16
  fontFamily: "Alpha",
15
17
  lineHeight: 20,
16
18
  paddingTop: bracket ? 5 : 0,
19
+ textTransform: "uppercase",
17
20
  },
18
21
  h4: {
19
22
  fontFamily: "Inter",
23
+ textTransform: "uppercase",
20
24
  },
21
25
  large: {
22
26
  fontFamily: "Inter",
@@ -40,6 +44,7 @@ export function getTextTypeStyle({ bracket }) {
40
44
  },
41
45
  subtitle: {
42
46
  fontFamily: "Inter",
47
+ textTransform: "uppercase",
43
48
  },
44
49
  tiny: {
45
50
  fontFamily: "Inter",