@ledgerhq/native-ui 0.1.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +21 -21
  2. package/assets/icons.d.ts +1 -0
  3. package/assets/icons.js +1 -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 +105 -9
  11. package/components/Form/Input/BaseInput/index.js +25 -17
  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 -4
  15. package/components/Form/Input/NumberInput/index.js +17 -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 +17 -0
  21. package/components/Form/SelectableList.js +32 -0
  22. package/components/Form/Slider/components.js +6 -6
  23. package/components/Form/Slider/index.d.ts +2 -2
  24. package/components/Form/Slider/index.js +1 -1
  25. package/components/Form/Slider/index.native.d.ts +0 -1
  26. package/components/Form/Slider/index.native.js +2 -2
  27. package/components/Form/Switch/index.d.ts +0 -1
  28. package/components/Form/Switch/index.js +4 -4
  29. package/components/Form/Toggle/index.d.ts +0 -1
  30. package/components/Form/index.d.ts +1 -0
  31. package/components/Form/index.js +1 -0
  32. package/components/Icon/IconBox/index.js +2 -2
  33. package/components/Layout/Box/index.d.ts +11 -0
  34. package/components/Layout/Box/index.js +3 -0
  35. package/components/Layout/Flex/index.d.ts +11 -12
  36. package/components/Layout/Flex/index.js +2 -8
  37. package/components/Layout/Modals/BaseModal/index.d.ts +2 -2
  38. package/components/Layout/Modals/BaseModal/index.js +7 -7
  39. package/components/Layout/ScrollContainerHeader/Header.d.ts +0 -1
  40. package/components/Layout/ScrollContainerHeader/Header.js +1 -1
  41. package/components/Layout/Table/Row.d.ts +1 -1
  42. package/components/Layout/index.d.ts +3 -0
  43. package/components/Layout/index.js +3 -0
  44. package/components/Loader/index.d.ts +4 -1
  45. package/components/Loader/index.js +2 -2
  46. package/components/Navigation/SlideIndicator/index.js +15 -8
  47. package/components/Navigation/Stepper/index.js +13 -13
  48. package/components/Navigation/ToggleGroup/index.d.ts +8 -1
  49. package/components/Navigation/ToggleGroup/index.js +1 -1
  50. package/components/Text/getTextStyle.d.ts +10 -17
  51. package/components/Text/getTextStyle.js +24 -31
  52. package/components/Text/index.d.ts +6 -5
  53. package/components/Text/index.js +9 -3
  54. package/components/chart/index.d.ts +0 -1
  55. package/components/chart/index.js +6 -6
  56. package/components/cta/Button/getButtonStyle.js +12 -12
  57. package/components/cta/Button/index.d.ts +5 -16
  58. package/components/cta/Button/index.js +15 -16
  59. package/components/cta/Link/getLinkStyle.js +8 -8
  60. package/components/cta/Link/index.js +2 -2
  61. package/components/cta/getCtaStyle.d.ts +2 -2
  62. package/components/drawer/Notification/index.js +6 -12
  63. package/components/index.d.ts +1 -0
  64. package/components/index.js +1 -0
  65. package/components/message/Alert/index.d.ts +0 -1
  66. package/components/message/Alert/index.js +6 -6
  67. package/components/styled.d.ts +15 -0
  68. package/components/styled.js +12 -0
  69. package/components/tags/Badge/index.d.ts +2 -2
  70. package/components/tags/Badge/index.js +10 -10
  71. package/icons/Close.js +1 -1
  72. package/package.json +8 -10
  73. package/styles/InvertTheme.d.ts +0 -1
  74. package/styles/StyleProvider.d.ts +0 -9
  75. package/styles/StyleProvider.js +1 -1
  76. package/styles/helpers.d.ts +3 -1
  77. package/styles/helpers.js +4 -7
  78. package/styles/theme.d.ts +10 -34
  79. package/styles/theme.js +19 -37
@@ -2,61 +2,47 @@ export function getTextTypeStyle({ bracket }) {
2
2
  return {
3
3
  h1: {
4
4
  fontFamily: "Alpha",
5
- fontSize: 36,
6
- lineHeight: 43.2,
5
+ lineHeight: 32,
7
6
  paddingTop: bracket ? 15 : 0,
8
7
  },
9
8
  h2: {
10
9
  fontFamily: "Alpha",
11
- fontSize: 28,
12
- lineHeight: 33.6,
10
+ lineHeight: 28,
13
11
  paddingTop: bracket ? 10 : 0,
14
12
  },
15
13
  h3: {
16
14
  fontFamily: "Alpha",
17
- fontSize: 20,
18
- lineHeight: 24,
15
+ lineHeight: 20,
19
16
  paddingTop: bracket ? 5 : 0,
20
17
  },
21
- large: {
18
+ h4: {
22
19
  fontFamily: "Inter",
23
- fontSize: 16,
24
- lineHeight: 19.36,
25
20
  },
26
- emphasis: {
21
+ large: {
27
22
  fontFamily: "Inter",
28
- fontSize: 14,
29
- lineHeight: 20,
30
23
  },
31
24
  body: {
32
25
  fontFamily: "Inter",
33
- fontSize: 14,
26
+ },
27
+ bodyLineHeight: {
28
+ fontFamily: "Inter",
34
29
  lineHeight: 20,
35
30
  },
36
31
  paragraph: {
37
32
  fontFamily: "Inter",
38
- fontSize: 13,
39
- lineHeight: 15.73,
40
33
  },
41
- link: {
34
+ paragraphLineHeight: {
42
35
  fontFamily: "Inter",
43
- fontSize: 13,
44
- lineHeight: 16,
36
+ lineHeight: 18,
45
37
  },
46
- tiny: {
38
+ small: {
47
39
  fontFamily: "Inter",
48
- fontSize: 12,
49
- lineHeight: 16,
50
40
  },
51
- navigation: {
41
+ subtitle: {
52
42
  fontFamily: "Inter",
53
- fontSize: 12,
54
- lineHeight: 14.52,
55
43
  },
56
- subTitle: {
44
+ tiny: {
57
45
  fontFamily: "Inter",
58
- fontSize: 11,
59
- lineHeight: 13.31,
60
46
  },
61
47
  };
62
48
  }
@@ -65,12 +51,18 @@ const getConcatenedFontWeightFontFamily = {
65
51
  medium: {
66
52
  fontFamily: "HMAlphaMono-Medium",
67
53
  },
54
+ semiBold: {
55
+ fontFamily: "HMAlphaMono-Medium",
56
+ },
57
+ bold: {
58
+ fontFamily: "HMAlphaMono-Medium",
59
+ },
68
60
  },
69
61
  Inter: {
70
62
  medium: {
71
63
  fontFamily: "Inter-Medium",
72
64
  },
73
- semibold: {
65
+ semiBold: {
74
66
  fontFamily: "Inter-SemiBold",
75
67
  },
76
68
  bold: {
@@ -78,7 +70,8 @@ const getConcatenedFontWeightFontFamily = {
78
70
  },
79
71
  },
80
72
  };
81
- export function getTextStyle({ type = "body", bracket, fontWeight = "medium", }) {
82
- const style = getTextTypeStyle({ bracket })[type];
83
- return Object.assign(Object.assign({}, style), getConcatenedFontWeightFontFamily[style.fontFamily || "Inter"][fontWeight]);
73
+ export function getTextStyle({ variant = "paragraph", bracket = false, fontWeight = "medium", }) {
74
+ var _a;
75
+ const style = getTextTypeStyle({ bracket })[variant];
76
+ return Object.assign(Object.assign({}, style), getConcatenedFontWeightFontFamily[(_a = style === null || style === void 0 ? void 0 : style.fontFamily) !== null && _a !== void 0 ? _a : "Inter"][fontWeight]);
84
77
  }
@@ -1,12 +1,13 @@
1
1
  import React from "react";
2
2
  import { TextProps } from "react-native";
3
3
  import { FontSizeProps, TextAlignProps, ColorProps, SpaceProps, LineHeightProps, BorderProps } from "styled-system";
4
- import { FontWeightTypes, TextTypes } from "./getTextStyle";
5
- interface Props extends TextProps, FontSizeProps, TextAlignProps, ColorProps, SpaceProps, LineHeightProps, BorderProps {
6
- type?: TextTypes;
4
+ import { FontWeightTypes } from "./getTextStyle";
5
+ import { TextVariants } from "../../styles/theme";
6
+ export interface BaseTextProps extends TextProps, FontSizeProps, TextAlignProps, ColorProps, SpaceProps, LineHeightProps, BorderProps {
7
+ variant?: TextVariants;
7
8
  fontWeight?: FontWeightTypes;
8
9
  fontFamily?: string;
9
- fontSize?: number;
10
+ fontSize?: number | string | TextVariants;
10
11
  color?: string;
11
12
  mt?: number | string;
12
13
  mb?: number | string;
@@ -17,5 +18,5 @@ interface Props extends TextProps, FontSizeProps, TextAlignProps, ColorProps, Sp
17
18
  bracket?: boolean;
18
19
  children: React.ReactNode;
19
20
  }
20
- declare const Text: ({ children, bracket, ...props }: Props) => JSX.Element;
21
+ declare const Text: ({ children, bracket, ...props }: BaseTextProps) => JSX.Element;
21
22
  export default Text;
@@ -16,7 +16,14 @@ import BracketRight from "../../icons/BracketLeft";
16
16
  import BracketLeft from "../../icons/BracketRight";
17
17
  import { getColor } from "../../styles";
18
18
  import { getTextStyle } from "./getTextStyle";
19
- const Base = styled.Text.attrs((p) => (Object.assign(Object.assign({}, getTextStyle(p)), { color: p.color || "palette.neutral.c100" }))) `
19
+ const Base = styled.Text.attrs((p) => {
20
+ var _a;
21
+ return ({
22
+ fontSize: p.fontSize ? p.fontSize : (_a = p.variant) !== null && _a !== void 0 ? _a : "paragraph",
23
+ color: p.color || "neutral.c100",
24
+ });
25
+ }) `
26
+ ${(p) => getTextStyle(p)}
20
27
  ${lineHeight};
21
28
  ${fontSize};
22
29
  ${textAlign};
@@ -32,10 +39,9 @@ const T = styled.View `
32
39
  align-items: center;
33
40
  `;
34
41
  const BracketText = (_a) => {
35
- var { children, color = "palette.neutral.c100", lineHeight } = _a, props = __rest(_a, ["children", "color", "lineHeight"]);
42
+ var { children, color = "neutral.c100", lineHeight } = _a, props = __rest(_a, ["children", "color", "lineHeight"]);
36
43
  const size = lineHeight || getTextStyle(props).lineHeight;
37
44
  const theme = useTheme();
38
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
39
45
  const c = theme ? getColor(theme, color) : "transparent";
40
46
  return (React.createElement(T, null,
41
47
  React.createElement(BracketLeft, { fill: c, width: size, height: size }),
@@ -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.c0), 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,12 +1,12 @@
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;
9
- }>;
9
+ }> | null;
10
10
  type?: "main" | "shade" | "error" | "color" | "default";
11
11
  size?: "small" | "medium" | "large";
12
12
  iconPosition?: "right" | "left";
@@ -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
- }> | undefined;
25
- type?: "default" | "main" | "shade" | "error" | "color" | undefined;
26
- size?: "small" | "medium" | "large" | 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
  `;
@@ -63,18 +62,18 @@ const ButtonContainer = (props) => {
63
62
  const theme = useTheme();
64
63
  const { text } = getButtonColorStyle(theme.colors, props);
65
64
  return (React.createElement(Container, { hide: hide },
66
- iconPosition === "right" && children ? (React.createElement(Text, { type: ctaTextType[size], fontWeight: "semibold", color: text.color }, children)) : null,
65
+ iconPosition === "right" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: text.color }, children)) : null,
67
66
  Icon ? (React.createElement(IconContainer, { iconButton: !children, iconPosition: iconPosition },
68
67
  React.createElement(Icon, { size: ctaIconSize[size], color: text.color }))) : null,
69
- iconPosition === "left" && children ? (React.createElement(Text, { type: ctaTextType[size], fontWeight: "semibold", color: text.color }, children)) : null));
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
  }
@@ -22,10 +22,10 @@ const LinkContainer = (props) => {
22
22
  const { colors } = useTheme();
23
23
  const colorValue = getLinkColors(colors)[reversed ? "reversed" : "default"][disabled ? "disabled" : type];
24
24
  return (React.createElement(React.Fragment, null,
25
- iconPosition === "right" && children ? (React.createElement(Text, { type: ctaTextType[size], fontWeight: "semibold", color: colorValue }, children)) : null,
25
+ iconPosition === "right" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: colorValue }, children)) : null,
26
26
  Icon ? (React.createElement(IconContainer, { iconLink: !children, iconPosition: iconPosition },
27
27
  React.createElement(Icon, { size: ctaIconSize[size], color: colorValue }))) : null,
28
- iconPosition === "left" && children ? (React.createElement(Text, { type: ctaTextType[size], fontWeight: "semibold", color: colorValue }, children)) : null));
28
+ iconPosition === "left" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: colorValue }, children)) : null));
29
29
  };
30
30
  const Link = (props) => {
31
31
  const { type = "main", size = "medium" } = props;
@@ -1,6 +1,6 @@
1
- import { TextTypes } from "../Text/getTextStyle";
1
+ import { TextVariants } from "../../styles/theme";
2
2
  export declare const ctaTextType: {
3
- [index: string]: TextTypes;
3
+ [index: string]: TextVariants;
4
4
  };
5
5
  export declare const ctaIconSize: {
6
6
  [index: string]: number;
@@ -10,27 +10,21 @@ const NotificationContainer = styled.View `
10
10
  flex-direction: row;
11
11
  align-items: center;
12
12
  padding: 16px;
13
- background-color: ${(p) => p.variant === "primary"
14
- ? p.theme.colors.palette.primary.c90
15
- : "transparent"};
13
+ background-color: ${(p) => p.variant === "primary" ? p.theme.colors.primary.c90 : "transparent"};
16
14
  border-radius: ${(p) => `${p.theme.radii[1]}px`};
17
15
  `;
18
16
  export default function Notification({ Icon, color, variant = "primary", numberOfLines, title, subtitle, onClose, onLearnMore, }) {
19
17
  const { colors } = useTheme();
20
- const textColor = variant === "primary"
21
- ? colors.palette.neutral.c00
22
- : colors.palette.neutral.c100;
18
+ const textColor = variant === "primary" ? colors.neutral.c00 : colors.neutral.c100;
23
19
  return (React.createElement(NotificationContainer, { variant: variant },
24
20
  React.createElement(FlexBox, null,
25
21
  React.createElement(Icon, { size: 18, color: color || textColor })),
26
22
  React.createElement(FlexBox, { ml: 16, flexShrink: 1 },
27
- React.createElement(Text, { type: "body", fontWeight: "medium", color: color || textColor, numberOfLines: numberOfLines }, title),
28
- !!subtitle && (React.createElement(Text, { type: "body", fontWeight: "medium", color: color ||
29
- (variant === "primary"
30
- ? colors.palette.neutral.c00
31
- : colors.palette.neutral.c80), mt: "2px", mb: "2px" }, subtitle)),
23
+ React.createElement(Text, { variant: "body", fontWeight: "medium", color: color || textColor, numberOfLines: numberOfLines }, title),
24
+ !!subtitle && (React.createElement(Text, { variant: "body", fontWeight: "medium", color: color ||
25
+ (variant === "primary" ? colors.neutral.c00 : colors.neutral.c80), mt: "2px", mb: "2px" }, subtitle)),
32
26
  onLearnMore && (React.createElement(TouchableOpacity, { onPress: onLearnMore },
33
- React.createElement(Text, { type: "body", fontWeight: "semibold", color: color || textColor }, "Learn more")))),
27
+ React.createElement(Text, { variant: "body", fontWeight: "semiBold", color: color || textColor }, "Learn more")))),
34
28
  onClose && (React.createElement(FlexBox, { marginLeft: "auto", pl: 16 },
35
29
  React.createElement(TouchableOpacity, { onPress: onClose },
36
30
  React.createElement(CloseMedium, { size: 14, color: color || textColor }))))));
@@ -8,3 +8,4 @@ export * from "./message";
8
8
  export * from "./Navigation";
9
9
  export * from "./tags";
10
10
  export { default as Text } from "./Text";
11
+ export { default as Carousel } from "./Carousel";
@@ -8,3 +8,4 @@ export * from "./message";
8
8
  export * from "./Navigation";
9
9
  export * from "./tags";
10
10
  export { default as Text } from "./Text";
11
+ export { default as Carousel } from "./Carousel";
@@ -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 `
@@ -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;
@@ -1,9 +1,9 @@
1
1
  import React from "react";
2
2
  declare type BadgeType = "main" | "primary";
3
3
  export interface BadgeProps {
4
- variant?: BadgeType;
4
+ badgeVariant?: BadgeType;
5
5
  active?: boolean;
6
6
  children: React.ReactNode;
7
7
  }
8
- export default function Badge({ variant, active, children, }: BadgeProps): JSX.Element;
8
+ export default function Badge({ badgeVariant, active, children, }: BadgeProps): JSX.Element;
9
9
  export {};
@@ -4,29 +4,29 @@ 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
  };
26
- const StyledBadgeText = styled(Text).attrs((p) => (Object.assign({}, badgesStyle[p.variant || "main"][p.active ? "active" : "default"]))) `
26
+ const StyledBadgeText = styled(Text).attrs((p) => (Object.assign({}, badgesStyle[p.badgeVariant || "main"][p.active ? "active" : "default"]))) `
27
27
  border-radius: 32px;
28
28
  padding: 8px;
29
29
  `;
30
- export default function Badge({ variant = "main", active = false, children, }) {
31
- return (React.createElement(StyledBadgeText, { variant: variant, active: active, type: "subTitle", fontWeight: "semibold" }, children));
30
+ export default function Badge({ badgeVariant = "main", active = false, children, }) {
31
+ return (React.createElement(StyledBadgeText, { badgeVariant: badgeVariant, active: active, variant: "subtitle", fontWeight: "semiBold" }, children));
32
32
  }
package/icons/Close.js CHANGED
@@ -4,5 +4,5 @@ import { useTheme } from "styled-components/native";
4
4
  export default function Close({ size = 16, color }) {
5
5
  const { colors } = useTheme();
6
6
  return (React.createElement(Svg, { viewBox: "0 0 16 16", width: size, height: size },
7
- React.createElement(Path, { fill: color || colors.palette.neutral.c100, d: "M9.65 8.413l4.066-4.065a.375.375 0 0 0 0-.532l-.706-.706a.375.375 0 0 0-.531 0L8.413 7.176 4.348 3.11a.375.375 0 0 0-.532 0l-.706.706a.375.375 0 0 0 0 .532l4.066 4.065L3.11 12.48a.375.375 0 0 0 0 .531l.706.706a.375.375 0 0 0 .532 0l4.065-4.065 4.066 4.065a.375.375 0 0 0 .531 0l.706-.706a.375.375 0 0 0 0-.531L9.651 8.413z" })));
7
+ React.createElement(Path, { fill: color || colors.neutral.c100, d: "M9.65 8.413l4.066-4.065a.375.375 0 0 0 0-.532l-.706-.706a.375.375 0 0 0-.531 0L8.413 7.176 4.348 3.11a.375.375 0 0 0-.532 0l-.706.706a.375.375 0 0 0 0 .532l4.066 4.065L3.11 12.48a.375.375 0 0 0 0 .531l.706.706a.375.375 0 0 0 .532 0l4.065-4.065 4.066 4.065a.375.375 0 0 0 .531 0l.706-.706a.375.375 0 0 0 0-.531L9.651 8.413z" })));
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/native-ui",
3
- "version": "0.1.1",
3
+ "version": "0.5.0",
4
4
  "description": "Ledger Live - Desktop UI",
5
5
  "repository": "https://github.com/LedgerHQ/ui",
6
6
  "license": "MIT",
@@ -15,27 +15,25 @@
15
15
  "index.js"
16
16
  ],
17
17
  "dependencies": {
18
- "@ledgerhq/icons-ui": "^0.1.0",
19
- "@ledgerhq/ui-shared": "^0.1.1",
18
+ "@ledgerhq/icons-ui": "^0.2.0",
19
+ "@ledgerhq/ui-shared": "^0.1.3",
20
20
  "@types/color": "^3.0.2",
21
- "@types/react": "^17.0.30",
21
+ "@types/react": "^17.0.37",
22
22
  "@types/react-native": "^0.65.9",
23
- "@types/styled-components-react-native": "^5.1.1",
23
+ "@types/styled-components-react-native": "^5.1.3",
24
24
  "@types/styled-system": "^5.1.13",
25
25
  "color": "^3.1.3",
26
26
  "moment": "^2.29.1",
27
27
  "react-native-modal": "^12.0.3",
28
- "react-native-reanimated": "~2.2.3",
29
- "react-native-svg": "12.1.1",
30
28
  "rn-range-slider": "^2.1.1",
31
- "styled-components": "^5.3.3",
32
29
  "styled-system": "^5.1.5",
33
30
  "victory-native": "^35.5.5"
34
31
  },
35
32
  "peerDependencies": {
36
33
  "react": "^17.0.2",
37
34
  "react-native": "^0.64.0",
38
- "react-native-reanimated": "~2.2.3",
39
- "react-native-svg": "12.1.1"
35
+ "react-native-reanimated": "^2.2.4",
36
+ "react-native-svg": "^12.1.1",
37
+ "styled-components": "^5.3.3"
40
38
  }
41
39
  }