@ledgerhq/native-ui 0.3.0 → 0.6.1

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 (120) hide show
  1. package/README.md +13 -23
  2. package/assets/fonts/.DS_Store +0 -0
  3. package/assets/fonts/alpha/.DS_Store +0 -0
  4. package/assets/logos/LedgerLiveAltRegular.d.ts +0 -1
  5. package/assets/logos/LedgerLiveRegular.d.ts +0 -1
  6. package/components/Carousel/index.d.ts +45 -0
  7. package/components/Carousel/index.js +76 -0
  8. package/components/Form/Checkbox/index.d.ts +2 -2
  9. package/components/Form/Checkbox/index.js +5 -5
  10. package/components/Form/Input/BaseInput/index.d.ts +83 -5
  11. package/components/Form/Input/BaseInput/index.js +16 -16
  12. package/components/Form/Input/LegendInput/index.d.ts +14 -3
  13. package/components/Form/Input/LegendInput/index.js +4 -3
  14. package/components/Form/Input/NumberInput/index.d.ts +16 -5
  15. package/components/Form/Input/NumberInput/index.js +6 -9
  16. package/components/Form/Input/QrCodeInput/index.d.ts +15 -4
  17. package/components/Form/Input/QrCodeInput/index.js +5 -4
  18. package/components/Form/Input/SearchInput/index.d.ts +13 -2
  19. package/components/Form/Input/SearchInput/index.js +4 -3
  20. package/components/Form/SelectableList.d.ts +12 -3
  21. package/components/Form/SelectableList.js +9 -8
  22. package/components/Form/Slider/components.js +6 -6
  23. package/components/Form/Slider/index.d.ts +0 -1
  24. package/components/Form/Slider/index.native.d.ts +0 -1
  25. package/components/Form/Slider/index.native.js +2 -2
  26. package/components/Form/Switch/index.d.ts +0 -1
  27. package/components/Form/Switch/index.js +4 -4
  28. package/components/Form/Toggle/index.d.ts +0 -1
  29. package/components/Form/index.d.ts +1 -0
  30. package/components/Form/index.js +1 -0
  31. package/components/Icon/BoxedIcon.d.ts +48 -0
  32. package/components/Icon/BoxedIcon.js +87 -0
  33. package/components/Icon/IconBox/index.d.ts +2 -4
  34. package/components/Icon/IconBox/index.js +2 -3
  35. package/components/Icon/index.d.ts +1 -0
  36. package/components/Icon/index.js +1 -0
  37. package/components/Icon/type.d.ts +7 -0
  38. package/components/Icon/type.js +1 -0
  39. package/components/Layout/Box/index.d.ts +11 -0
  40. package/components/Layout/Box/index.js +3 -0
  41. package/components/Layout/Flex/index.d.ts +11 -12
  42. package/components/Layout/Flex/index.js +2 -8
  43. package/components/Layout/List/IconBoxList/index.d.ts +10 -0
  44. package/components/Layout/List/IconBoxList/index.js +19 -0
  45. package/components/Layout/List/List/index.d.ts +13 -0
  46. package/components/Layout/List/List/index.js +29 -0
  47. package/components/Layout/List/NumberedList/index.d.ts +9 -0
  48. package/components/Layout/List/NumberedList/index.js +20 -0
  49. package/components/Layout/List/TipList/index.d.ts +9 -0
  50. package/components/Layout/List/TipList/index.js +20 -0
  51. package/components/Layout/List/index.d.ts +4 -0
  52. package/components/Layout/List/index.js +4 -0
  53. package/components/Layout/Modals/BaseModal/index.js +4 -4
  54. package/components/Layout/ScrollContainerHeader/Header.d.ts +0 -1
  55. package/components/Layout/ScrollContainerHeader/Header.js +1 -1
  56. package/components/Layout/index.d.ts +4 -0
  57. package/components/Layout/index.js +4 -0
  58. package/components/Loader/InfiniteLoader/index.d.ts +9 -0
  59. package/components/Loader/InfiniteLoader/index.js +62 -0
  60. package/components/Loader/ProgressLoader/index.d.ts +11 -0
  61. package/components/Loader/ProgressLoader/index.js +24 -0
  62. package/components/Loader/index.d.ts +2 -11
  63. package/components/Loader/index.js +2 -24
  64. package/components/Navigation/FlowStepper/index.d.ts +70 -0
  65. package/components/Navigation/FlowStepper/index.js +38 -0
  66. package/components/Navigation/SlideIndicator/index.js +15 -8
  67. package/components/Navigation/Stepper/index.js +12 -12
  68. package/components/Navigation/index.d.ts +1 -0
  69. package/components/Navigation/index.js +1 -0
  70. package/components/ProgressBar/index.d.ts +15 -0
  71. package/components/ProgressBar/index.js +33 -0
  72. package/components/Tabs/Chip/index.d.ts +5 -0
  73. package/components/Tabs/Chip/index.js +20 -0
  74. package/components/Tabs/Graph/index.d.ts +5 -0
  75. package/components/Tabs/Graph/index.js +21 -0
  76. package/components/Tabs/TemplateTabs/index.d.ts +29 -0
  77. package/components/Tabs/TemplateTabs/index.js +14 -0
  78. package/components/Tabs/index.d.ts +2 -0
  79. package/components/Tabs/index.js +2 -0
  80. package/components/Text/getTextStyle.d.ts +1 -0
  81. package/components/Text/getTextStyle.js +5 -0
  82. package/components/Text/index.d.ts +6 -8
  83. package/components/Text/index.js +17 -10
  84. package/components/chart/index.d.ts +0 -1
  85. package/components/chart/index.js +6 -6
  86. package/components/cta/Button/getButtonStyle.js +12 -12
  87. package/components/cta/Button/index.d.ts +4 -15
  88. package/components/cta/Button/index.js +13 -14
  89. package/components/cta/Link/getLinkStyle.js +8 -8
  90. package/components/index.d.ts +5 -2
  91. package/components/index.js +6 -2
  92. package/components/message/Alert/index.d.ts +0 -1
  93. package/components/message/Alert/index.js +7 -7
  94. package/components/{drawer → message}/Notification/index.d.ts +5 -4
  95. package/components/message/Notification/index.js +35 -0
  96. package/components/message/index.d.ts +1 -0
  97. package/components/message/index.js +1 -0
  98. package/components/styled.d.ts +15 -0
  99. package/components/styled.js +12 -0
  100. package/components/tags/Badge/index.js +7 -7
  101. package/components/transitions/Fade.d.ts +5 -0
  102. package/components/transitions/Fade.js +32 -0
  103. package/components/transitions/Slide.d.ts +11 -0
  104. package/components/transitions/Slide.js +49 -0
  105. package/components/transitions/Transition.d.ts +49 -0
  106. package/components/transitions/Transition.js +42 -0
  107. package/components/transitions/index.d.ts +4 -0
  108. package/components/transitions/index.js +4 -0
  109. package/components/transitions/types.d.ts +21 -0
  110. package/components/transitions/types.js +1 -0
  111. package/icons/Close.js +1 -1
  112. package/package.json +6 -8
  113. package/styles/StyleProvider.js +1 -1
  114. package/styles/theme.d.ts +4 -1
  115. package/styles/theme.js +3 -3
  116. package/components/Navigation/ToggleGroup/index.d.ts +0 -15
  117. package/components/Navigation/ToggleGroup/index.js +0 -25
  118. package/components/drawer/Notification/index.js +0 -37
  119. package/components/drawer/index.d.ts +0 -1
  120. package/components/drawer/index.js +0 -1
@@ -1,21 +1,19 @@
1
1
  import React from "react";
2
- import { TextProps } from "react-native";
3
- import { FontSizeProps, TextAlignProps, ColorProps, SpaceProps, LineHeightProps, BorderProps } from "styled-system";
2
+ import { TextProps, TextStyle } from "react-native";
3
+ import { FontSizeProps, TextAlignProps, LineHeightProps } from "styled-system";
4
+ import { BaseStyledProps } from "../styled";
4
5
  import { FontWeightTypes } from "./getTextStyle";
5
6
  import { TextVariants } from "../../styles/theme";
6
- export interface BaseTextProps extends TextProps, FontSizeProps, TextAlignProps, ColorProps, SpaceProps, LineHeightProps, BorderProps {
7
+ export interface BaseTextProps extends TextProps, BaseStyledProps, FontSizeProps, TextAlignProps, LineHeightProps {
7
8
  variant?: TextVariants;
8
9
  fontWeight?: FontWeightTypes;
9
10
  fontFamily?: string;
10
11
  fontSize?: number | string | TextVariants;
11
12
  color?: string;
12
- mt?: number | string;
13
- mb?: number | string;
14
- ml?: number | string;
15
- mr?: number | string;
16
- paddingTop?: number;
17
13
  lineHeight?: number;
18
14
  bracket?: boolean;
15
+ textTransform?: TextStyle["textTransform"];
16
+ uppercase?: boolean;
19
17
  children: React.ReactNode;
20
18
  }
21
19
  declare const Text: ({ children, bracket, ...props }: BaseTextProps) => JSX.Element;
@@ -11,25 +11,32 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React from "react";
13
13
  import styled, { useTheme } from "styled-components/native";
14
- import { fontSize, textAlign, color, space, lineHeight, border, } from "styled-system";
14
+ import { compose, fontSize, textAlign, lineHeight, system, } from "styled-system";
15
+ import baseStyled from "../styled";
15
16
  import BracketRight from "../../icons/BracketLeft";
16
17
  import BracketLeft from "../../icons/BracketRight";
17
18
  import { getColor } from "../../styles";
18
19
  import { getTextStyle } from "./getTextStyle";
19
- const Base = styled.Text.attrs((p) => {
20
+ const uppercase = system({
21
+ uppercase: {
22
+ property: "textTransform",
23
+ transform: (value) => (value ? "uppercase" : "none"),
24
+ },
25
+ });
26
+ const textTransform = system({
27
+ textTransform: {
28
+ property: "textTransform",
29
+ },
30
+ });
31
+ const Base = baseStyled.Text.attrs((p) => {
20
32
  var _a;
21
33
  return ({
22
34
  fontSize: p.fontSize ? p.fontSize : (_a = p.variant) !== null && _a !== void 0 ? _a : "paragraph",
23
- color: p.color || "palette.neutral.c100",
35
+ color: p.color || "neutral.c100",
24
36
  });
25
37
  }) `
26
38
  ${(p) => getTextStyle(p)}
27
- ${lineHeight};
28
- ${fontSize};
29
- ${textAlign};
30
- ${color};
31
- ${space};
32
- ${border};
39
+ ${compose(lineHeight, fontSize, textAlign, uppercase, textTransform)}
33
40
  justify-content: center;
34
41
  align-items: center;
35
42
  `;
@@ -39,7 +46,7 @@ const T = styled.View `
39
46
  align-items: center;
40
47
  `;
41
48
  const BracketText = (_a) => {
42
- var { children, color = "palette.neutral.c100", lineHeight } = _a, props = __rest(_a, ["children", "color", "lineHeight"]);
49
+ var { children, color = "neutral.c100", lineHeight } = _a, props = __rest(_a, ["children", "color", "lineHeight"]);
43
50
  const size = lineHeight || getTextStyle(props).lineHeight;
44
51
  const theme = useTheme();
45
52
  const c = theme ? getColor(theme, color) : "transparent";
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { Item } from "./types";
3
2
  export declare type ChartProps = {
4
3
  data: Array<Item>;
@@ -6,7 +6,7 @@ import { VictoryLine, VictoryChart, VictoryAxis, VictoryArea, VictoryScatter, }
6
6
  import { hex } from "../../styles/helpers";
7
7
  import Flex from "../Layout/Flex";
8
8
  const Container = styled(Flex) `
9
- background-color: ${(p) => p.theme.colors.palette.background.main};
9
+ background-color: ${(p) => p.theme.colors.background.main};
10
10
  `;
11
11
  const sortByDate = (a, b) => {
12
12
  if (a.date.getTime() < b.date.getTime())
@@ -22,7 +22,7 @@ const Chart = ({ data, color, tickFormat = "MMM", valueKey = "value", height = 1
22
22
  React.createElement(VictoryChart, { scale: { x: "time" }, height: height, domainPadding: { x: [0, 5], y: [30, 10] } },
23
23
  React.createElement(VictoryAxis, { dependentAxis: true, crossAxis: true, style: {
24
24
  grid: {
25
- stroke: theme.colors.palette.neutral.c40,
25
+ stroke: theme.colors.neutral.c40,
26
26
  strokeDasharray: "4 4",
27
27
  },
28
28
  axisLabel: { display: "none" },
@@ -32,11 +32,11 @@ const Chart = ({ data, color, tickFormat = "MMM", valueKey = "value", height = 1
32
32
  } }),
33
33
  React.createElement(VictoryAxis, { crossAxis: false, tickFormat: (timestamp) => moment(timestamp).format(tickFormat), style: {
34
34
  axis: {
35
- stroke: theme.colors.palette.neutral.c40,
35
+ stroke: theme.colors.neutral.c40,
36
36
  strokeDasharray: "4 4",
37
37
  },
38
38
  tickLabels: {
39
- fill: theme.colors.palette.neutral.c80,
39
+ fill: theme.colors.neutral.c80,
40
40
  fontSize: 12,
41
41
  lineHeight: 14.52,
42
42
  },
@@ -45,14 +45,14 @@ const Chart = ({ data, color, tickFormat = "MMM", valueKey = "value", height = 1
45
45
  React.createElement(Defs, null,
46
46
  React.createElement(LinearGradient, { id: "chartGradient", x1: "0.5", x2: "0.5", y1: "0", y2: "1" },
47
47
  React.createElement(Stop, { stopColor: hex(color), stopOpacity: "0.11" }),
48
- React.createElement(Stop, { offset: "1", stopColor: hex(theme.colors.palette.neutral.c00), stopOpacity: "0" }))),
48
+ React.createElement(Stop, { offset: "1", stopColor: hex(theme.colors.neutral.c00), stopOpacity: "0" }))),
49
49
  React.createElement(VictoryArea, { data: sortData, interpolation: "monotoneX", sortKey: "date", x: "date", y: valueKey, style: { data: { fill: `url(#chartGradient)` } }, standalone: false }),
50
50
  React.createElement(VictoryLine, { data: sortData, interpolation: "monotoneX", x: "date", y: valueKey, style: { data: { stroke: color } } }),
51
51
  React.createElement(VictoryScatter, { style: {
52
52
  data: {
53
53
  stroke: color,
54
54
  strokeWidth: 3,
55
- fill: theme.colors.palette.background.main,
55
+ fill: theme.colors.background.main,
56
56
  },
57
57
  }, size: 5, data: [sortData[sortData.length - 1]], x: "date", y: valueKey }))));
58
58
  };
@@ -1,29 +1,29 @@
1
1
  export function getButtonColors(colors) {
2
2
  return {
3
3
  default: {
4
- primaryColor: colors.palette.neutral.c100,
4
+ primaryColor: colors.neutral.c100,
5
5
  secondaryColor: "rgba(0,0,0,0)",
6
6
  },
7
7
  disabled: {
8
- primaryColor: colors.palette.neutral.c50,
9
- secondaryColor: colors.palette.neutral.c30,
8
+ primaryColor: colors.neutral.c50,
9
+ secondaryColor: colors.neutral.c30,
10
10
  },
11
11
  main: {
12
- primaryColor: colors.palette.neutral.c00,
13
- secondaryColor: colors.palette.neutral.c100,
12
+ primaryColor: colors.neutral.c00,
13
+ secondaryColor: colors.neutral.c100,
14
14
  },
15
15
  shade: {
16
- primaryColor: colors.palette.neutral.c00,
17
- secondaryColor: colors.palette.neutral.c100,
18
- tertiaryColor: colors.palette.neutral.c40,
16
+ primaryColor: colors.neutral.c00,
17
+ secondaryColor: colors.neutral.c100,
18
+ tertiaryColor: colors.neutral.c40,
19
19
  },
20
20
  error: {
21
- primaryColor: colors.palette.neutral.c00,
22
- secondaryColor: colors.palette.error.c100,
21
+ primaryColor: colors.neutral.c00,
22
+ secondaryColor: colors.error.c100,
23
23
  },
24
24
  color: {
25
- primaryColor: colors.palette.neutral.c00,
26
- secondaryColor: colors.palette.primary.c80,
25
+ primaryColor: colors.neutral.c00,
26
+ secondaryColor: colors.primary.c80,
27
27
  },
28
28
  };
29
29
  }
@@ -1,8 +1,8 @@
1
1
  /// <reference types="styled-components-react-native" />
2
2
  import React from "react";
3
- import { SpaceProps } from "styled-system";
4
3
  import { TouchableOpacity, TouchableOpacityProps } from "react-native";
5
- export declare type ButtonProps = TouchableOpacityProps & SpaceProps & {
4
+ import { BaseStyledProps } from "../../styled";
5
+ export declare type ButtonProps = TouchableOpacityProps & BaseStyledProps & {
6
6
  Icon?: React.ComponentType<{
7
7
  size: number;
8
8
  color: string;
@@ -17,19 +17,8 @@ export declare type ButtonProps = TouchableOpacityProps & SpaceProps & {
17
17
  };
18
18
  export declare const Base: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, {
19
19
  iconButton?: boolean | undefined;
20
- } & TouchableOpacityProps & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & {
21
- Icon?: React.ComponentType<{
22
- size: number;
23
- color: string;
24
- }> | null | undefined;
25
- type?: "default" | "main" | "shade" | "error" | "color" | undefined;
26
- size?: "large" | "small" | "medium" | undefined;
27
- iconPosition?: "left" | "right" | undefined;
28
- outline?: boolean | undefined;
29
- disabled?: boolean | undefined;
30
- pressed?: boolean | undefined;
31
- children?: React.ReactNode;
32
- }, never>;
20
+ sizeVariant?: ButtonProps["size"];
21
+ } & Omit<ButtonProps, "size">, never>;
33
22
  declare const Button: (props: ButtonProps) => React.ReactElement;
34
23
  export declare const PromisableButton: (props: ButtonProps) => React.ReactElement;
35
24
  export default Button;
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import React, { useCallback, useState } from "react";
11
11
  import styled, { useTheme } from "styled-components/native";
12
- import { color, border, space } from "styled-system";
13
12
  import { ActivityIndicator, TouchableOpacity, } from "react-native";
14
13
  import { buttonSizeStyle, getButtonColorStyle, } from "../../cta/Button/getButtonStyle";
15
14
  import { ctaIconSize, ctaTextType } from "../../cta/getCtaStyle";
16
15
  import Text from "../../Text";
16
+ import baseStyled from "../../styled";
17
17
  const IconContainer = styled.View `
18
18
  ${(p) => p.iconButton
19
19
  ? ""
@@ -21,12 +21,11 @@ const IconContainer = styled.View `
21
21
  ? `margin-right: 10px;`
22
22
  : `margin-left: 10px;`}
23
23
  `;
24
- export const Base = styled(TouchableOpacity).attrs((p) => (Object.assign({}, getButtonColorStyle(p.theme.colors, p).button))) `
25
- ${color};
26
- ${border};
27
- ${space};
24
+ export const Base = baseStyled(TouchableOpacity).attrs((p) => (Object.assign(Object.assign({}, getButtonColorStyle(p.theme.colors, p).button), {
25
+ // Avoid conflict with styled-system's size property by nulling size and renaming it
26
+ size: undefined, sizeVariant: p.size }))) `
27
+
28
28
  border-radius: ${(p) => p.theme.space[10]}px;
29
- height: ${(p) => p.theme.space[10]}px;
30
29
  padding: 0 ${(p) => p.theme.space[7]}px;
31
30
  flex-direction: row;
32
31
  border-style: solid;
@@ -36,7 +35,7 @@ export const Base = styled(TouchableOpacity).attrs((p) => (Object.assign({}, get
36
35
  align-content: center;
37
36
  overflow: hidden;
38
37
  position: relative;
39
- ${(p) => buttonSizeStyle[p.size || "medium"]}
38
+ ${(p) => buttonSizeStyle[p.sizeVariant || "medium"]}
40
39
 
41
40
  ${(p) => (p.iconButton ? `padding: 0; width: ${p.theme.space[10]}px;` : "")}
42
41
  `;
@@ -69,12 +68,12 @@ const ButtonContainer = (props) => {
69
68
  iconPosition === "left" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: text.color }, children)) : null));
70
69
  };
71
70
  const Button = (props) => {
72
- const { Icon, children, type = "default", size = "medium" } = props;
73
- return (React.createElement(Base, Object.assign({}, props, { type: type, size: size, iconButton: !!Icon && !children, activeOpacity: 0.5 }),
74
- React.createElement(ButtonContainer, Object.assign({}, props, { type: type, size: size }))));
71
+ const { Icon, children, type = "default" } = props;
72
+ return (React.createElement(Base, Object.assign({}, props, { type: type, iconButton: !!Icon && !children, activeOpacity: 0.5 }),
73
+ React.createElement(ButtonContainer, Object.assign({}, props, { type: type }))));
75
74
  };
76
75
  export const PromisableButton = (props) => {
77
- const { Icon, children, onPress, type = "main", size = "medium", disabled = false, } = props;
76
+ const { Icon, children, onPress, type = "main", disabled = false } = props;
78
77
  const [spinnerOn, setSpinnerOn] = useState(false);
79
78
  const theme = useTheme();
80
79
  const onPressHandler = useCallback((event) => __awaiter(void 0, void 0, void 0, function* () {
@@ -88,9 +87,9 @@ export const PromisableButton = (props) => {
88
87
  setSpinnerOn(false);
89
88
  }
90
89
  }), [onPress]);
91
- return (React.createElement(Base, Object.assign({}, props, { type: type, size: size, iconButton: !!Icon && !children, disabled: disabled || spinnerOn, onPress: onPressHandler }),
92
- React.createElement(ButtonContainer, Object.assign({}, props, { type: type, size: size, hide: spinnerOn })),
90
+ return (React.createElement(Base, Object.assign({}, props, { type: type, iconButton: !!Icon && !children, disabled: disabled || spinnerOn, onPress: onPressHandler }),
91
+ React.createElement(ButtonContainer, Object.assign({}, props, { type: type, hide: spinnerOn })),
93
92
  React.createElement(SpinnerContainer, null,
94
- React.createElement(ActivityIndicator, { color: theme.colors.palette.neutral.c50, animating: spinnerOn }))));
93
+ React.createElement(ActivityIndicator, { color: theme.colors.neutral.c50, animating: spinnerOn }))));
95
94
  };
96
95
  export default Button;
@@ -1,16 +1,16 @@
1
1
  export function getLinkColors(colors) {
2
2
  return {
3
3
  default: {
4
- disabled: colors.palette.neutral.c50,
5
- main: colors.palette.neutral.c100,
6
- color: colors.palette.primary.c80,
7
- shade: colors.palette.neutral.c70,
4
+ disabled: colors.neutral.c50,
5
+ main: colors.neutral.c100,
6
+ color: colors.primary.c80,
7
+ shade: colors.neutral.c70,
8
8
  },
9
9
  reversed: {
10
- disabled: colors.palette.neutral.c80,
11
- main: colors.palette.neutral.c00,
12
- color: colors.palette.primary.c60,
13
- shade: colors.palette.neutral.c50,
10
+ disabled: colors.neutral.c80,
11
+ main: colors.neutral.c00,
12
+ color: colors.primary.c60,
13
+ shade: colors.neutral.c50,
14
14
  },
15
15
  };
16
16
  }
@@ -1,10 +1,13 @@
1
1
  export * from "./cta";
2
- export * from "./drawer";
3
2
  export * from "./Form";
4
3
  export * from "./Icon";
5
4
  export * from "./Layout";
6
- export { default as Loader } from "./Loader";
7
5
  export * from "./message";
8
6
  export * from "./Navigation";
9
7
  export * from "./tags";
10
8
  export { default as Text } from "./Text";
9
+ export { default as Carousel } from "./Carousel";
10
+ export * from "./Tabs";
11
+ export * from "./Loader";
12
+ export { default as ProgressBar } from "./ProgressBar";
13
+ export * as Transitions from "./transitions";
@@ -1,10 +1,14 @@
1
1
  export * from "./cta";
2
- export * from "./drawer";
3
2
  export * from "./Form";
4
3
  export * from "./Icon";
5
4
  export * from "./Layout";
6
- export { default as Loader } from "./Loader";
7
5
  export * from "./message";
8
6
  export * from "./Navigation";
9
7
  export * from "./tags";
10
8
  export { default as Text } from "./Text";
9
+ export { default as Carousel } from "./Carousel";
10
+ export * from "./Tabs";
11
+ export * from "./Loader";
12
+ export { default as ProgressBar } from "./ProgressBar";
13
+ import * as Transitions_1 from "./transitions";
14
+ export { Transitions_1 as Transitions };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare type AlertType = "info" | "warning" | "error";
3
2
  export interface AlertProps {
4
3
  type?: AlertType;
@@ -13,16 +13,16 @@ const icons = {
13
13
  };
14
14
  const alertColors = {
15
15
  info: {
16
- backgroundColor: "palette.primary.c20",
17
- color: "palette.primary.c90",
16
+ backgroundColor: "primary.c20",
17
+ color: "primary.c90",
18
18
  },
19
19
  warning: {
20
- backgroundColor: "palette.warning.c30",
21
- color: "palette.warning.c100",
20
+ backgroundColor: "warning.c30",
21
+ color: "warning.c100",
22
22
  },
23
23
  error: {
24
- backgroundColor: "palette.error.c30",
25
- color: "palette.error.c100",
24
+ backgroundColor: "error.c30",
25
+ color: "error.c100",
26
26
  },
27
27
  };
28
28
  const StyledIconContainer = styled.View `
@@ -44,5 +44,5 @@ export default function Alert({ type = "info", title, showIcon = true, }) {
44
44
  const textColor = getColor(theme, alertColors[type || "info"].color);
45
45
  return (React.createElement(StyledAlertContainer, { type: type },
46
46
  showIcon && !!icons[type] && (React.createElement(StyledIconContainer, null, icons[type || "info"]({ size: 20, color: textColor }))),
47
- React.createElement(Text, { color: textColor }, title)));
47
+ React.createElement(Text, { color: textColor, flexShrink: 1 }, title)));
48
48
  }
@@ -1,17 +1,18 @@
1
1
  import React from "react";
2
2
  import { TextProps, TouchableOpacityProps } from "react-native";
3
3
  declare type Props = {
4
- Icon: React.ComponentType<{
4
+ Icon?: React.ComponentType<{
5
5
  size: number;
6
6
  color?: string;
7
7
  }>;
8
- color?: string;
8
+ iconColor?: string;
9
9
  variant?: "primary" | "secondary";
10
10
  title: string;
11
11
  subtitle?: string;
12
12
  numberOfLines?: TextProps["numberOfLines"];
13
13
  onClose?: TouchableOpacityProps["onPress"];
14
- onLearnMore?: TouchableOpacityProps["onPress"];
14
+ linkText?: string;
15
+ onLinkPress?: TouchableOpacityProps["onPress"];
15
16
  };
16
- export default function Notification({ Icon, color, variant, numberOfLines, title, subtitle, onClose, onLearnMore, }: Props): React.ReactElement;
17
+ export default function Notification({ Icon, iconColor, variant, numberOfLines, title, subtitle, onClose, linkText, onLinkPress, }: Props): React.ReactElement;
17
18
  export {};
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ import styled, { useTheme } from "styled-components/native";
3
+ import FlexBox from "../../Layout/Flex";
4
+ import { TouchableOpacity, } from "react-native";
5
+ import Text from "../../Text";
6
+ import CloseMedium from "@ledgerhq/icons-ui/native/CloseMedium";
7
+ import { Flex } from "../../Layout";
8
+ const NotificationContainer = styled.View `
9
+ display: flex;
10
+ width: 100%;
11
+ flex-direction: row;
12
+ align-items: center;
13
+ ${(p) => p.variant === "primary" &&
14
+ `
15
+ padding: 16px;
16
+ `}
17
+ background-color: ${(p) => p.variant === "primary" ? p.theme.colors.primary.c90 : "transparent"};
18
+ border-radius: ${(p) => `${p.theme.radii[1]}px`};
19
+ `;
20
+ export default function Notification({ Icon, iconColor, variant = "primary", numberOfLines, title, subtitle, onClose, linkText, onLinkPress, }) {
21
+ const { colors } = useTheme();
22
+ const textColor = variant === "primary" ? colors.neutral.c00 : colors.neutral.c100;
23
+ return (React.createElement(NotificationContainer, { variant: variant },
24
+ Icon && (React.createElement(FlexBox, { mr: 16 },
25
+ React.createElement(Icon, { size: 20, color: iconColor || textColor }))),
26
+ React.createElement(FlexBox, { flexShrink: 1 },
27
+ React.createElement(Text, { variant: "body", fontWeight: "medium", color: textColor, numberOfLines: numberOfLines }, title),
28
+ !!subtitle && (React.createElement(Text, { variant: "body", fontWeight: "medium", color: variant === "primary" ? colors.neutral.c00 : colors.neutral.c80, mt: 2 }, subtitle)),
29
+ linkText && onLinkPress && (React.createElement(Flex, { mt: 3 },
30
+ React.createElement(TouchableOpacity, { onPress: onLinkPress },
31
+ React.createElement(Text, { variant: "body", fontWeight: "semiBold", color: textColor }, linkText))))),
32
+ onClose && (React.createElement(FlexBox, { marginLeft: "auto", pl: 16 },
33
+ React.createElement(TouchableOpacity, { onPress: onClose },
34
+ React.createElement(CloseMedium, { size: 14, color: textColor }))))));
35
+ }
@@ -1 +1,2 @@
1
1
  export { default as Alert } from "./Alert";
2
+ export { default as Notification } from "./Notification";
@@ -1 +1,2 @@
1
1
  export { default as Alert } from "./Alert";
2
+ export { default as Notification } from "./Notification";
@@ -0,0 +1,15 @@
1
+ /// <reference types="styled-components-react-native" />
2
+ import { ReactNativeStyledInterface, DefaultTheme } from "styled-components/native";
3
+ import { FlexboxProps, SpaceProps, PositionProps, ColorProps, LayoutProps, OverflowProps, BorderProps, BackgroundProps } from "styled-system";
4
+ import { InterpolationFunction } from "styled-components";
5
+ export declare type BaseStyledProps = SpaceProps & FlexboxProps & PositionProps & ColorProps & LayoutProps & OverflowProps & BorderProps & BackgroundProps & {
6
+ columnGap?: string | number;
7
+ rowGap?: string | number;
8
+ color?: string;
9
+ display?: string;
10
+ position?: string;
11
+ maxHeight?: number;
12
+ };
13
+ export declare const baseStyles: InterpolationFunction<unknown>;
14
+ declare const _default: ReactNativeStyledInterface<DefaultTheme>;
15
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import styled from "styled-components/native";
2
+ import { compose, flexbox, space, position, color, layout, overflow, border, background, } from "styled-system";
3
+ export const baseStyles = compose(flexbox, space, position, color, layout, overflow, border, background);
4
+ const proxyStyled = new Proxy(styled, {
5
+ apply(target, thisArg, argumentsList) {
6
+ return styled(target.apply(thisArg, argumentsList)(baseStyles));
7
+ },
8
+ get(target, property) {
9
+ return styled(target[property].apply(styled, [baseStyles]));
10
+ },
11
+ });
12
+ export default proxyStyled;
@@ -4,22 +4,22 @@ import Text from "../../Text";
4
4
  const badgesStyle = {
5
5
  main: {
6
6
  default: {
7
- color: "palette.neutral.c80",
7
+ color: "neutral.c80",
8
8
  borderWidth: 1,
9
- borderColor: "palette.neutral.c40",
9
+ borderColor: "neutral.c40",
10
10
  },
11
11
  active: {
12
- color: "palette.neutral.c00",
13
- backgroundColor: "palette.neutral.c100",
12
+ color: "neutral.c00",
13
+ backgroundColor: "neutral.c100",
14
14
  },
15
15
  },
16
16
  primary: {
17
17
  default: {
18
- color: "palette.primary.c90",
18
+ color: "primary.c90",
19
19
  },
20
20
  active: {
21
- color: "palette.primary.c90",
22
- backgroundColor: "palette.primary.c20",
21
+ color: "primary.c90",
22
+ backgroundColor: "primary.c20",
23
23
  },
24
24
  },
25
25
  };
@@ -0,0 +1,5 @@
1
+ import { TransitionProps } from "./types";
2
+ /**
3
+ * A fade-in / fade-out transition changing the opacity of its children based on their status.
4
+ */
5
+ export declare function Fade({ status, duration, style, children }: TransitionProps): JSX.Element;
@@ -0,0 +1,32 @@
1
+ import React, { useRef, useMemo, useEffect } from "react";
2
+ import { Animated } from "react-native";
3
+ /**
4
+ * A fade-in / fade-out transition changing the opacity of its children based on their status.
5
+ */
6
+ export function Fade({ status, duration, style, children }) {
7
+ const fadeAnim = useRef(new Animated.Value(status === "entered" ? 1 : 0)).current;
8
+ const fadeIn = useMemo(() => Animated.timing(fadeAnim, {
9
+ toValue: 1,
10
+ duration,
11
+ useNativeDriver: true,
12
+ }), [duration, fadeAnim]);
13
+ const fadeOut = useMemo(() => Animated.timing(fadeAnim, {
14
+ toValue: 0,
15
+ duration,
16
+ useNativeDriver: true,
17
+ }), [duration, fadeAnim]);
18
+ useEffect(() => {
19
+ if (status === "entering") {
20
+ fadeIn.start();
21
+ }
22
+ if (status === "exiting") {
23
+ fadeOut.start();
24
+ }
25
+ }, [fadeIn, fadeOut, status]);
26
+ return (React.createElement(Animated.View, { style: [
27
+ {
28
+ opacity: fadeAnim,
29
+ },
30
+ style,
31
+ ] }, children));
32
+ }
@@ -0,0 +1,11 @@
1
+ import { TransitionProps } from "./types";
2
+ export interface SlideProps extends TransitionProps {
3
+ /**
4
+ * The direction of the slide animation.
5
+ */
6
+ direction?: "left" | "right";
7
+ }
8
+ /**
9
+ * A slide left/right transition translating its children based on their status and a given direction.
10
+ */
11
+ export declare function Slide({ status, duration, style, direction, children, }: SlideProps): JSX.Element;
@@ -0,0 +1,49 @@
1
+ import React, { useState, useRef, useEffect, useMemo } from "react";
2
+ import { Animated, Platform, Dimensions } from "react-native";
3
+ const WEB = Platform.OS === "web";
4
+ /**
5
+ * A slide left/right transition translating its children based on their status and a given direction.
6
+ */
7
+ export function Slide({ status, duration, style, direction = "left", children, }) {
8
+ const [width, setWidth] = useState(Dimensions.get("window").width);
9
+ const styleRef = useRef(new Animated.Value(0)).current;
10
+ const previousStatus = useRef(null);
11
+ useEffect(() => () => {
12
+ previousStatus.current = status;
13
+ }, [status]);
14
+ const animateIn = useMemo(() => Animated.timing(styleRef, {
15
+ toValue: 0,
16
+ duration,
17
+ useNativeDriver: true,
18
+ }), [duration, styleRef]);
19
+ const animateOut = useMemo(() => Animated.timing(styleRef, {
20
+ toValue: direction === "left" ? -1 : 1,
21
+ duration,
22
+ useNativeDriver: true,
23
+ }), [direction, duration, styleRef]);
24
+ useEffect(() => {
25
+ if (status === "entering") {
26
+ if (previousStatus.current !== "exiting") {
27
+ styleRef.setValue(direction === "left" ? 1 : -1);
28
+ }
29
+ animateIn.start();
30
+ }
31
+ if (status === "exiting") {
32
+ animateOut.start();
33
+ }
34
+ // eslint-disable-next-line react-hooks/exhaustive-deps
35
+ }, [status]);
36
+ return (React.createElement(Animated.View, { style: [
37
+ {
38
+ transform: [
39
+ {
40
+ translateX: styleRef.interpolate({
41
+ inputRange: [-1, 1],
42
+ outputRange: WEB ? ["-100%", "100%"] : [-width, width],
43
+ }),
44
+ },
45
+ ],
46
+ },
47
+ style,
48
+ ], onLayout: ({ nativeEvent }) => setWidth(nativeEvent.layout.width) }, children));
49
+ }