@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
@@ -3,9 +3,10 @@ import styled from "styled-components/native";
3
3
  import Input, { InputRenderLeftContainer } from "../BaseInput";
4
4
  import SearchMedium from "@ledgerhq/icons-ui/native/SearchMedium";
5
5
  const Icon = styled(SearchMedium).attrs((p) => ({
6
- color: p.theme.colors.palette.neutral.c70,
6
+ color: p.theme.colors.neutral.c70,
7
7
  })) ``;
8
- export default function SearchInput(props) {
9
- return (React.createElement(Input, Object.assign({}, props, { renderLeft: React.createElement(InputRenderLeftContainer, null,
8
+ function SearchInput(props, ref) {
9
+ return (React.createElement(Input, Object.assign({ ref: ref }, props, { renderLeft: React.createElement(InputRenderLeftContainer, null,
10
10
  React.createElement(Icon, null)) })));
11
11
  }
12
+ export default React.forwardRef(SearchInput);
@@ -1,10 +1,19 @@
1
- import React from "react";
1
+ import React, { ComponentType } from "react";
2
2
  import { GestureResponderEvent } from "react-native";
3
- export declare type ElementProps<V> = React.PropsWithChildren<{
3
+ import { IconType } from "../Icon/type";
4
+ declare type BaseElementProps<V> = {
4
5
  first?: boolean;
5
6
  selected?: boolean;
7
+ disabled?: boolean;
6
8
  value?: V;
7
9
  onPress?: ((event: GestureResponderEvent) => void) | undefined;
10
+ Icon?: IconType;
11
+ };
12
+ export declare type ElementProps<V> = React.PropsWithChildren<BaseElementProps<V> & {
13
+ /**
14
+ * A function that will render some content on the right side of the input.
15
+ */
16
+ renderRight?: ComponentType<BaseElementProps<V>> | React.ReactElement;
8
17
  }>;
9
18
  export declare type Props<V> = React.PropsWithChildren<{
10
19
  currentValue?: V;
@@ -12,6 +21,6 @@ export declare type Props<V> = React.PropsWithChildren<{
12
21
  }>;
13
22
  declare function SelectableList<V>({ currentValue, onChange, children }: Props<V>): JSX.Element;
14
23
  declare namespace SelectableList {
15
- var Element: <V>({ first, value, selected, onPress, children, }: ElementProps<V>) => JSX.Element;
24
+ var Element: <V>(props: ElementProps<V>) => JSX.Element;
16
25
  }
17
26
  export default SelectableList;
@@ -1,19 +1,20 @@
1
1
  import React from "react";
2
2
  import { TouchableOpacity } from "react-native";
3
3
  import styled from "styled-components/native";
4
- import { border } from "styled-system";
5
4
  import Flex from "../Layout/Flex";
6
5
  import { Text } from "../index";
7
6
  const ElementContainer = styled(Flex).attrs({
8
7
  accessible: true,
9
8
  accessibilityRole: "radio",
10
- }) `
11
- ${border}
12
- `;
13
- function Element({ first, value, selected, onPress, children, }) {
14
- return (React.createElement(TouchableOpacity, { onPress: onPress },
15
- React.createElement(ElementContainer, { p: 6, mt: first ? 0 : 4, backgroundColor: selected ? "palette.primary.c20" : "palette.neutral.c00", border: "1px solid", borderColor: selected ? "palette.primary.c100" : "palette.neutral.c40", borderRadius: 1 },
16
- React.createElement(Text, { variant: "large" }, children || value))));
9
+ }) ``;
10
+ function Element(props) {
11
+ const { first, value, selected, disabled, onPress, children, Icon, renderRight: RenderRight, } = props;
12
+ return (React.createElement(TouchableOpacity, { onPress: onPress, disabled: disabled },
13
+ React.createElement(ElementContainer, { p: 6, mt: first ? 0 : 4, backgroundColor: selected ? "primary.c20" : "neutral.c00", border: "1px solid", borderColor: selected ? "primary.c100" : "neutral.c40", borderRadius: 1, flexDirection: "row", alignItems: "center" },
14
+ Icon && (React.createElement(Flex, { mr: 6, flexShrink: 0 },
15
+ React.createElement(Icon, { size: 24, color: disabled ? "neutral.c50" : "neutral.c100" }))),
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
18
  }
18
19
  function SelectableList({ currentValue, onChange, children }) {
19
20
  return (React.createElement(Flex, { accessible: true, accessibilityRole: "radiogroup" }, React.Children.map(children, (child, index) => {
@@ -17,19 +17,19 @@ export const RailSelected = styled.View `
17
17
  margin-left: -5px;
18
18
  margin-right: -5px;
19
19
  height: 40px;
20
- background-color: ${(p) => p.theme.colors.palette.primary.c40};
20
+ background-color: ${(p) => p.theme.colors.primary.c40};
21
21
  border-radius: 30px;
22
22
  `;
23
23
  export const Rail = styled.View `
24
24
  flex: 1;
25
25
  height: 40px;
26
- background-color: ${(p) => p.theme.colors.palette.neutral.c30};
26
+ background-color: ${(p) => p.theme.colors.neutral.c30};
27
27
  border-radius: 30px;
28
28
  `;
29
29
  const ThumbContainer = styled.View `
30
30
  height: 40px;
31
31
  width: 40px;
32
- background-color: ${(p) => p.theme.colors.palette.primary.c90};
32
+ background-color: ${(p) => p.theme.colors.primary.c90};
33
33
  border-radius: 40px;
34
34
  display: flex;
35
35
  align-items: center;
@@ -38,7 +38,7 @@ const ThumbContainer = styled.View `
38
38
  export const Thumb = () => {
39
39
  const { colors } = useTheme();
40
40
  return (React.createElement(ThumbContainer, null,
41
- React.createElement(ArrowsHMedium, { color: colors.palette.neutral.c00, size: 24 })));
41
+ React.createElement(ArrowsHMedium, { color: colors.neutral.c00, size: 24 })));
42
42
  };
43
43
  const LabelContainer = styled.View `
44
44
  display: flex;
@@ -46,10 +46,10 @@ const LabelContainer = styled.View `
46
46
  justify-content: center;
47
47
  align-items: center;
48
48
  padding: 3.5px 6px;
49
- background-color: ${(p) => p.theme.colors.palette.primary.c20};
49
+ background-color: ${(p) => p.theme.colors.primary.c20};
50
50
  border-radius: 4px;
51
51
  `;
52
52
  export const Label = ({ children }) => {
53
53
  return (React.createElement(LabelContainer, null,
54
- React.createElement(Text, { variant: "body", fontWeight: "semiBold", color: "palette.primary.c90" }, children)));
54
+ React.createElement(Text, { variant: "body", fontWeight: "semiBold", color: "primary.c90" }, children)));
55
55
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { SliderProps } from "./index.native";
3
2
  declare const SliderScreen: (_props: SliderProps) => JSX.Element;
4
3
  export default SliderScreen;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare type SliderProps = {
3
2
  step: number;
4
3
  min: number;
@@ -20,7 +20,7 @@ const Slider = ({ value, min, max, step, onChange, disabled }) => {
20
20
  width: "100%",
21
21
  }, min: min, max: max, low: value, disabled: disabled, step: step, disableRange: true, floatingLabel: true, renderThumb: Thumb, renderRail: renderRail, renderRailSelected: renderRailSelected, renderLabel: renderLabel, renderNotch: renderNotch, onValueChanged: onChange }),
22
22
  React.createElement(MinMaxTextContainer, null,
23
- React.createElement(Text, { variant: "small", fontWeight: "medium", color: "palette.neutral.c70" }, min),
24
- React.createElement(Text, { variant: "small", fontWeight: "medium", color: "palette.neutral.c70" }, max))));
23
+ React.createElement(Text, { variant: "small", fontWeight: "medium", color: "neutral.c70" }, min),
24
+ React.createElement(Text, { variant: "small", fontWeight: "medium", color: "neutral.c70" }, max))));
25
25
  };
26
26
  export default Slider;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare type SwitchProps = {
3
2
  checked: boolean;
4
3
  onChange?: (value: boolean) => void;
@@ -7,9 +7,9 @@ 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: {
10
- false: colors.palette.neutral.c50,
11
- true: colors.palette.primary.c80,
12
- }, thumbColor: colors.palette.neutral.c00, onValueChange: onChange, value: checked, disabled: disabled, ios_backgroundColor: colors.palette.neutral.c50 }),
13
- label ? (React.createElement(Text, { variant: "body", color: checked ? colors.palette.primary.c90 : colors.palette.neutral.c100, style: { marginLeft: space[3] } }, label)) : null));
10
+ false: colors.neutral.c50,
11
+ true: colors.primary.c80,
12
+ }, thumbColor: colors.neutral.c00, onValueChange: onChange, value: checked, disabled: disabled, ios_backgroundColor: colors.neutral.c50 }),
13
+ label ? (React.createElement(Text, { variant: "body", color: checked ? colors.primary.c90 : colors.neutral.c100, style: { marginLeft: space[3], flexShrink: 1 } }, label)) : null));
14
14
  };
15
15
  export default Switch;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ButtonProps } from "../../cta/Button";
3
2
  declare type ToggleProps = {
4
3
  active?: boolean;
@@ -2,4 +2,5 @@ export { default as Checkbox } from "./Checkbox";
2
2
  export * from "./Input";
3
3
  export { default as Slider } from "./Slider";
4
4
  export { default as Switch } from "./Switch";
5
+ export { default as Toggle } from "./Toggle";
5
6
  export { default as SelectableList } from "./SelectableList";
@@ -2,4 +2,5 @@ export { default as Checkbox } from "./Checkbox";
2
2
  export * from "./Input";
3
3
  export { default as Slider } from "./Slider";
4
4
  export { default as Switch } from "./Switch";
5
+ export { default as Toggle } from "./Toggle";
5
6
  export { default as SelectableList } from "./SelectableList";
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ export declare const DEFAULT_BOX_SIZE = 40;
3
+ export declare const DEFAULT_ICON_SIZE = 16;
4
+ export declare const DEFAULT_BADGE_SIZE = 20;
5
+ export declare type IconProps = {
6
+ size?: number;
7
+ color?: string;
8
+ };
9
+ export declare type IconBoxProps = {
10
+ /**
11
+ * 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
+ */
13
+ Badge?: React.ComponentType<IconProps>;
14
+ /**
15
+ * Color of the border
16
+ */
17
+ borderColor?: string;
18
+ /**
19
+ * Badge color, will be applied to the component provided in the `Badge` prop
20
+ */
21
+ badgeColor?: string;
22
+ /**
23
+ * Badge size, will be applied to the component provided in the `Badge` prop
24
+ */
25
+ badgeSize?: number;
26
+ children?: JSX.Element;
27
+ /**
28
+ * Box size for preview
29
+ */
30
+ size?: number;
31
+ };
32
+ export declare type BoxedIconProps = IconBoxProps & {
33
+ /**
34
+ * 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
+ Icon: React.ComponentType<IconProps> | ((props: IconProps) => JSX.Element);
37
+ /**
38
+ * Icon size, will be applied to the component provided in the `Icon` prop
39
+ */
40
+ iconSize?: number;
41
+ /**
42
+ * Icon color, will be applied to the component provided in the `Icon` prop
43
+ */
44
+ iconColor?: string;
45
+ };
46
+ export declare const IconBox: ({ Badge, size, children, borderColor, badgeColor, badgeSize, }: IconBoxProps) => JSX.Element;
47
+ declare const BoxedIcon: ({ Icon, iconSize, iconColor, ...iconBoxProps }: BoxedIconProps) => JSX.Element;
48
+ export default BoxedIcon;
@@ -0,0 +1,87 @@
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 from "react";
13
+ import styled, { useTheme } from "styled-components/native";
14
+ import { PixelRatio } from "react-native";
15
+ import { Rect, ClipPath, Svg, Defs } from "react-native-svg";
16
+ import Flex from "../Layout/Flex";
17
+ import Box from "../Layout/Box";
18
+ export const DEFAULT_BOX_SIZE = 40;
19
+ export const DEFAULT_ICON_SIZE = 16;
20
+ export const DEFAULT_BADGE_SIZE = 20;
21
+ const BORDER_RADIUS = 2;
22
+ function getClipRectangleSize(badgeSize) {
23
+ return (3 / 4) * badgeSize;
24
+ }
25
+ const Container = styled(Flex).attrs((p) => ({
26
+ heigth: p.size,
27
+ width: p.size,
28
+ alignItems: "center",
29
+ justifyContent: "center",
30
+ position: "relative",
31
+ overflow: "visible",
32
+ })) ``;
33
+ const IconBoxBackground = styled(Flex) `
34
+ position: absolute;
35
+ height: ${(p) => p.size}px;
36
+ width: ${(p) => p.size}px;
37
+ border-radius: ${(p) => p.theme.radii[BORDER_RADIUS]}px;
38
+ `;
39
+ const BadgeContainer = styled.View `
40
+ position: absolute;
41
+ overflow: visible;
42
+ ${(p) => `
43
+ top: -${p.badgeSize / 2 - 2}px;
44
+ right: -${p.badgeSize / 2 - 2}px;
45
+ height: ${p.badgeSize}px;
46
+ width: ${p.badgeSize}px;`}
47
+ `;
48
+ /** This component is needed to draw a border that is clipped behind the badge icon */
49
+ const IconBoxBackgroundSVG = ({ size, borderColor, badgeSize, }) => {
50
+ const { colors, radii } = useTheme();
51
+ const borderRadius = radii[BORDER_RADIUS];
52
+ const borderWidth = 1;
53
+ const paletteStr = borderColor.split(".")[0];
54
+ // @ts-expect-error idk how to handle this properly pls help
55
+ const palette = colors[paletteStr];
56
+ const strokeColor = (palette ? palette[borderColor.split(".")[1]] : borderColor) ||
57
+ colors.neutral.c40;
58
+ const squareSize = getClipRectangleSize(badgeSize);
59
+ /**
60
+ * The following adjustments are necessary to have visual consistency
61
+ * between RN (native) Views with border and this component
62
+ */
63
+ const svgSize = size + borderWidth;
64
+ const rectSize = size - borderWidth;
65
+ const rectRadius = borderRadius - borderWidth / 2;
66
+ return (React.createElement(Box, { position: "absolute", overflow: "hidden" },
67
+ React.createElement(Svg, { height: svgSize, width: svgSize },
68
+ React.createElement(Defs, null,
69
+ React.createElement(ClipPath, { id: "clip" },
70
+ React.createElement(Rect, { x: "0", y: "0", width: svgSize - squareSize, height: squareSize }),
71
+ React.createElement(Rect, { x: "0", y: squareSize, width: "100%", height: svgSize - squareSize }))),
72
+ 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
+ };
74
+ export const IconBox = ({ Badge, size = DEFAULT_BOX_SIZE, children, borderColor = "neutral.c40", badgeColor, badgeSize = DEFAULT_BADGE_SIZE, }) => {
75
+ const hasBadge = !!Badge;
76
+ 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 })),
78
+ children,
79
+ hasBadge && (React.createElement(BadgeContainer, { badgeSize: badgeSize },
80
+ React.createElement(Badge, { size: badgeSize, color: badgeColor })))));
81
+ };
82
+ const BoxedIcon = (_a) => {
83
+ 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 })));
86
+ };
87
+ export default BoxedIcon;
@@ -1,9 +1,7 @@
1
1
  import React from "react";
2
+ import { IconOrElementType } from "../type";
2
3
  declare type Props = {
3
- Icon: (props: {
4
- size?: number;
5
- color?: string;
6
- }) => React.ReactElement;
4
+ Icon: IconOrElementType;
7
5
  color?: string;
8
6
  boxSize?: number;
9
7
  iconSize?: number;
@@ -9,11 +9,10 @@ const IconContainer = styled.View `
9
9
  align-items: center;
10
10
  justify-content: center;
11
11
  border-width: 1px;
12
- border-color: ${(p) => p.theme.colors.palette.neutral.c40};
12
+ border-color: ${(p) => p.theme.colors.neutral.c40};
13
13
  border-radius: ${(p) => `${p.theme.radii[1]}px`};
14
14
  `;
15
15
  export default function IconBox({ Icon, color, boxSize = DEFAULT_BOX_SIZE, iconSize = DEFAULT_ICON_SIZE, }) {
16
16
  const { colors } = useTheme();
17
- return (React.createElement(IconContainer, { size: boxSize },
18
- React.createElement(Icon, { size: iconSize, color: color || colors.palette.neutral.c100 })));
17
+ return (React.createElement(IconContainer, { size: boxSize }, React.isValidElement(Icon) ? (Icon) : (React.createElement(Icon, { size: iconSize, color: color || colors.neutral.c100 }))));
19
18
  }
@@ -1 +1,2 @@
1
1
  export { default as IconBox } from "./IconBox";
2
+ export { default as BoxedIcon } from "./BoxedIcon";
@@ -1 +1,2 @@
1
1
  export { default as IconBox } from "./IconBox";
2
+ export { default as BoxedIcon } from "./BoxedIcon";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export declare type IconProps = {
3
+ size?: number;
4
+ color?: string;
5
+ };
6
+ export declare type IconType = React.ComponentType<IconProps>;
7
+ export declare type IconOrElementType = IconType | React.ReactElement;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { BaseStyledProps } from "../../styled";
2
+ export declare type BoxProps = BaseStyledProps;
3
+ declare const Box: 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>> & {
4
+ columnGap?: string | number | undefined;
5
+ rowGap?: string | number | undefined;
6
+ color?: string | undefined;
7
+ display?: string | undefined;
8
+ position?: string | undefined;
9
+ maxHeight?: number | undefined;
10
+ }, never>;
11
+ export default Box;
@@ -0,0 +1,3 @@
1
+ import baseStyled from "../../styled";
2
+ const Box = baseStyled.View ``;
3
+ export default Box;
@@ -1,13 +1,12 @@
1
- /// <reference types="styled-components-react-native" />
2
- import React from "react";
3
- import { BackgroundProps, ColorProps, FlexboxProps, LayoutProps, SpaceProps } from "styled-system";
4
- export interface Props extends ColorProps, BackgroundProps, LayoutProps, FlexboxProps, SpaceProps {
5
- alignItems?: "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
6
- flexBasis?: string;
7
- flexDirection?: "row" | "row-reverse" | "column" | "column-reverse";
8
- justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
9
- children?: React.ReactNode;
10
- style?: Record<string, unknown>;
11
- }
12
- declare const FlexBox: import("styled-components").StyledComponent<typeof import("react-native").View, import("styled-components").DefaultTheme, Props, never>;
1
+ import { BaseStyledProps } from "../../styled";
2
+ export declare type FlexBoxProps = BaseStyledProps;
3
+ export declare type Props = FlexBoxProps;
4
+ declare const FlexBox: 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>> & {
5
+ columnGap?: string | number | undefined;
6
+ rowGap?: string | number | undefined;
7
+ color?: string | undefined;
8
+ display?: string | undefined;
9
+ position?: string | undefined;
10
+ maxHeight?: number | undefined;
11
+ }, never>;
13
12
  export default FlexBox;
@@ -1,11 +1,5 @@
1
- import styled from "styled-components/native";
2
- import { background, color, flexbox, layout, space, } from "styled-system";
3
- const FlexBox = styled.View `
1
+ import baseStyled from "../../styled";
2
+ const FlexBox = baseStyled.View `
4
3
  display: flex;
5
- ${flexbox};
6
- ${space};
7
- ${background};
8
- ${color};
9
- ${layout};
10
4
  `;
11
5
  export default FlexBox;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { BaseListItemProps, BaseListProps } from "../List";
3
+ import { IconType } from "../../../Icon/type";
4
+ export declare type IconBoxListItemProps = Omit<BaseListItemProps, "bullet"> & {
5
+ Icon: IconType;
6
+ };
7
+ export declare type IconBoxListProps = Omit<BaseListProps, "items"> & {
8
+ items: IconBoxListItemProps[];
9
+ };
10
+ export default function IconBoxList({ items, ...props }: IconBoxListProps): React.ReactElement;
@@ -0,0 +1,19 @@
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 { IconBox } from "../../../Icon";
15
+ export default function IconBoxList(_a) {
16
+ var { items } = _a, props = __rest(_a, ["items"]);
17
+ const iconBoxItems = useMemo(() => items.map((item) => (Object.assign(Object.assign({}, item), { bullet: React.createElement(IconBox, { Icon: item.Icon, boxSize: 48, iconSize: 20 }) }))), [items]);
18
+ return React.createElement(List, Object.assign({ items: iconBoxItems }, props));
19
+ }
@@ -0,0 +1,13 @@
1
+ import React from "react";
2
+ import { BaseStyledProps } from "../../../styled";
3
+ export declare type BaseListItemProps = {
4
+ title?: string;
5
+ description?: string;
6
+ bullet?: React.ReactNode;
7
+ };
8
+ export declare type BaseListProps = {
9
+ items: BaseListItemProps[];
10
+ itemContainerProps?: BaseStyledProps;
11
+ };
12
+ export declare const ListItem: ({ title, description, bullet, ...props }: BaseStyledProps & BaseListItemProps) => React.ReactElement;
13
+ export default function List({ items, itemContainerProps, ...props }: BaseListProps): React.ReactElement;
@@ -0,0 +1,29 @@
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, { useCallback } from "react";
13
+ import Text from "../../../Text";
14
+ import { Box, Flex } from "../../index";
15
+ import { FlatList } from "react-native";
16
+ export const ListItem = (_a) => {
17
+ var { title, description, bullet = null } = _a, props = __rest(_a, ["title", "description", "bullet"]);
18
+ return (React.createElement(Flex, Object.assign({ flexDirection: "row", alignItems: "center" }, props),
19
+ bullet && (React.createElement(Box, { mr: 7, flexShrink: 0 }, bullet)),
20
+ React.createElement(Flex, { flexDirection: "column", flexShrink: 1, flexWrap: "nowrap" },
21
+ title && (React.createElement(Text, { variant: "body", fontWeight: "semiBold", color: "neutral.c100", flexShrink: 1, mb: description ? 2 : null }, title)),
22
+ description && (React.createElement(Text, { variant: "body", fontWeight: "medium", color: "neutral.c80", flexShrink: 1 }, description)))));
23
+ };
24
+ export default function List(_a) {
25
+ var { items, itemContainerProps } = _a, props = __rest(_a, ["items", "itemContainerProps"]);
26
+ const renderItem = useCallback(({ item }) => (React.createElement(ListItem, Object.assign({}, item, { mb: 6, pb: 2 }, itemContainerProps))), [itemContainerProps]);
27
+ return (React.createElement(Flex, Object.assign({ flexDirection: "column" }, props),
28
+ React.createElement(FlatList, { data: items, renderItem: renderItem })));
29
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { BaseListItemProps, BaseListProps } from "../List";
3
+ export declare type NumberedListItemProps = Omit<BaseListItemProps, "bullet"> & {
4
+ number?: number;
5
+ };
6
+ export declare type NumberedListProps = Omit<BaseListProps, "items"> & {
7
+ items: NumberedListItemProps[];
8
+ };
9
+ export default function NumberedList({ items, ...props }: NumberedListProps): React.ReactElement;
@@ -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 { IconBox } from "../../../Icon";
15
+ import Text from "../../../Text";
16
+ export default function NumberedList(_a) {
17
+ var { items } = _a, props = __rest(_a, ["items"]);
18
+ const numberedItems = useMemo(() => items.map((item, index) => (Object.assign(Object.assign({}, item), { bullet: (React.createElement(IconBox, { Icon: React.createElement(Text, { variant: "body", fontWeight: "medium", color: "neutral.c100" }, item.number ? item.number : index), boxSize: 36 })) }))), [items]);
19
+ return React.createElement(List, Object.assign({ items: numberedItems }, props));
20
+ }
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { BaseListItemProps, BaseListProps } from "../List";
3
+ export declare type TipListItemProps = Omit<BaseListItemProps, "bullet"> & {
4
+ isPositive: boolean;
5
+ };
6
+ export declare type TipListProps = Omit<BaseListProps, "items"> & {
7
+ items: TipListItemProps[];
8
+ };
9
+ export default function TipList({ items, ...props }: TipListProps): React.ReactElement;
@@ -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";
@@ -19,7 +19,7 @@ import FlexBox from "../../../Layout/Flex";
19
19
  import Text from "../../../Text";
20
20
  const { width, height } = sizes;
21
21
  const Container = styled.View `
22
- background-color: ${(p) => p.theme.colors.palette.background.main};
22
+ background-color: ${(p) => p.theme.colors.background.main};
23
23
  width: 100%;
24
24
  padding: 16px;
25
25
  min-height: 350px;
@@ -43,14 +43,14 @@ const StyledTitle = styled(Text).attrs({ variant: "h3" }) `
43
43
  `;
44
44
  const StyledDescription = styled(Text).attrs({
45
45
  variant: "body",
46
- color: "palette.neutral.c80",
46
+ color: "neutral.c80",
47
47
  }) `
48
48
  text-transform: capitalize;
49
49
  margin-top: ${(p) => p.theme.space[2]}px;
50
50
  `;
51
51
  const StyledSubtitle = styled(Text).attrs({
52
52
  variant: "subtitle",
53
- color: "palette.neutral.c80",
53
+ color: "neutral.c80",
54
54
  }) `
55
55
  text-transform: uppercase;
56
56
  margin-bottom: ${(p) => p.theme.space[2]}px;
@@ -77,7 +77,7 @@ export default function BaseModal(_a) {
77
77
  Icon && (React.createElement(FlexBox, { mb: 24 }, typeof Icon === "function"
78
78
  ? Icon({
79
79
  size: 48,
80
- color: iconColor || colors.palette.neutral.c100,
80
+ color: iconColor || colors.neutral.c100,
81
81
  })
82
82
  : Icon)),
83
83
  subtitle && React.createElement(StyledSubtitle, null, subtitle),