@ledgerhq/native-ui 0.3.0 → 0.4.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 (35) 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/components/Form/Checkbox/index.js +5 -5
  5. package/components/Form/Input/BaseInput/index.js +11 -11
  6. package/components/Form/Input/LegendInput/index.js +1 -1
  7. package/components/Form/Input/NumberInput/index.js +3 -7
  8. package/components/Form/Input/QrCodeInput/index.js +2 -2
  9. package/components/Form/Input/SearchInput/index.js +1 -1
  10. package/components/Form/SelectableList.js +1 -1
  11. package/components/Form/Slider/components.js +6 -6
  12. package/components/Form/Slider/index.native.js +2 -2
  13. package/components/Form/Switch/index.js +4 -4
  14. package/components/Icon/IconBox/index.js +2 -2
  15. package/components/Layout/Modals/BaseModal/index.js +4 -4
  16. package/components/Layout/ScrollContainerHeader/Header.js +1 -1
  17. package/components/Layout/index.d.ts +2 -0
  18. package/components/Layout/index.js +2 -0
  19. package/components/Loader/index.js +2 -2
  20. package/components/Navigation/SlideIndicator/index.js +2 -2
  21. package/components/Navigation/Stepper/index.js +12 -12
  22. package/components/Navigation/ToggleGroup/index.js +1 -1
  23. package/components/Text/index.js +2 -2
  24. package/components/chart/index.js +6 -6
  25. package/components/cta/Button/getButtonStyle.js +12 -12
  26. package/components/cta/Button/index.js +1 -1
  27. package/components/cta/Link/getLinkStyle.js +8 -8
  28. package/components/drawer/Notification/index.js +3 -9
  29. package/components/message/Alert/index.js +6 -6
  30. package/components/tags/Badge/index.js +7 -7
  31. package/icons/Close.js +1 -1
  32. package/package.json +3 -5
  33. package/styles/StyleProvider.js +1 -1
  34. package/styles/theme.d.ts +4 -1
  35. package/styles/theme.js +1 -3
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## Reference
12
12
 
13
- [📚 The storybook is hosted here.](https://ledger-live-ui-native.vercel.app/)
13
+ **[🔗 Storybook](https://ledger-live-ui-native.vercel.app/)**
14
14
 
15
15
  ## Installation
16
16
 
@@ -22,31 +22,21 @@ npm i @ledgerhq/native-ui
22
22
 
23
23
  ### Peer dependencies
24
24
 
25
- This library uses [styled components](https://styled-components.com/) heavily relies on it being installed separately (to avoid package duplication).
25
+ _This library uses the following packages under the hood and relies on them being installed separately to avoid package duplication._
26
26
 
27
27
  ```sh
28
- npm i styled-components
28
+ npm i styled-components react-native-reanimated react-native-svg
29
29
  ```
30
30
 
31
- ### Required Dependencies
31
+ ### Additional setup
32
32
 
33
- **Skip this step if your project is using Expo! ✨**
33
+ **Skip this step if your project is managed by Expo.**
34
34
 
35
- ```sh
36
- npm i react react-native@^0.64.0 react-native-reanimated@~2.2.3 react-native-svg@^12.1.1
37
- ```
38
-
39
- Then, follow the installation instructions for:
35
+ Follow the installation instructions for:
40
36
 
41
37
  - [react-native-reanimated](https://docs.swmansion.com/react-native-reanimated/docs/2.2.0/installation)
42
38
  - [react-native-svg](https://github.com/react-native-svg/react-native-svg#installation)
43
39
 
44
- ### Recommended Dependencies
45
-
46
- ```sh
47
- npm i styled-components
48
- ```
49
-
50
40
  ## Usage
51
41
 
52
42
  ### Provider
@@ -72,7 +62,7 @@ import { Flex, Text } from "@ledgerhq/native-ui";
72
62
  function Hello() {
73
63
  return (
74
64
  <Flex flexDirection="column" alignItems="center">
75
- <Text variant="h1" color="palette.neutral.c100">
65
+ <Text variant="h1" color="neutral.c100">
76
66
  Hello, world!
77
67
  </Text>
78
68
  </Flex>
@@ -143,7 +133,7 @@ import { useFonts } from "expo-font";
143
133
 
144
134
  function Logo() {
145
135
  const theme = useTheme();
146
- return <Logos.LedgerLiveRegular color={theme.colors.palette.neutral.c100} />;
136
+ return <Logos.LedgerLiveRegular color={theme.colors.neutral.c100} />;
147
137
  }
148
138
 
149
139
  function FontProvider({ children }) {
@@ -173,10 +163,10 @@ export default function App() {
173
163
  justifyContent="center"
174
164
  alignItems="center"
175
165
  flexDirection="column"
176
- backgroundColor="palette.neutral.c00"
166
+ backgroundColor="neutral.c00"
177
167
  >
178
168
  <Logo />
179
- <Text variant="h2" color="palette.neutral.c100" my={10}>
169
+ <Text variant="h2" color="neutral.c100" my={10}>
180
170
  Hello, world!
181
171
  </Text>
182
172
  <Switch
@@ -200,7 +190,7 @@ import { useTheme } from "styled-components/native";
200
190
 
201
191
  function Logo() {
202
192
  const theme = useTheme();
203
- return <Logos.LedgerLiveRegular color={theme.colors.palette.neutral.c100} />;
193
+ return <Logos.LedgerLiveRegular color={theme.colors.neutral.c100} />;
204
194
  }
205
195
 
206
196
  export default function App() {
@@ -215,10 +205,10 @@ export default function App() {
215
205
  justifyContent="center"
216
206
  alignItems="center"
217
207
  flexDirection="column"
218
- backgroundColor="palette.neutral.c00"
208
+ backgroundColor="neutral.c00"
219
209
  >
220
210
  <Logo />
221
- <Text variant="h2" color="palette.neutral.c100" my={10}>
211
+ <Text variant="h2" color="neutral.c100" my={10}>
222
212
  Hello, world!
223
213
  </Text>
224
214
  <Switch
Binary file
Binary file
@@ -11,16 +11,16 @@ const Square = styled(Flex).attrs({
11
11
  width: 18px;
12
12
  height: 18px;
13
13
  border-radius: 4px;
14
- color: ${({ theme }) => theme.colors.palette.neutral.c00};
14
+ color: ${({ theme }) => theme.colors.neutral.c00};
15
15
  ${({ checked, theme }) => checked
16
- ? `background-color: ${theme.colors.palette.primary.c90};`
17
- : `border: 1px solid ${theme.colors.palette.neutral.c50};`}
16
+ ? `background-color: ${theme.colors.primary.c90};`
17
+ : `border: 1px solid ${theme.colors.neutral.c50};`}
18
18
  `;
19
19
  const Checkbox = ({ checked, onChange, disabled, label, }) => {
20
20
  const { colors, space } = useTheme();
21
21
  return (React.createElement(Pressable, { onPress: onChange, disabled: disabled },
22
22
  React.createElement(Flex, { flexDirection: "row", alignItems: "center" },
23
- React.createElement(Square, { checked: checked }, checked ? (React.createElement(CheckAlone, { size: 13, color: colors.palette.neutral.c00 })) : null),
24
- label ? (React.createElement(Text, { variant: "body", color: checked ? colors.palette.primary.c90 : colors.palette.neutral.c100, style: { marginLeft: space[2] } }, label)) : null)));
23
+ React.createElement(Square, { checked: checked }, checked ? React.createElement(CheckAlone, { size: 13, color: colors.neutral.c00 }) : null),
24
+ label ? (React.createElement(Text, { variant: "body", color: checked ? colors.primary.c90 : colors.neutral.c100, style: { marginLeft: space[2] } }, label)) : null)));
25
25
  };
26
26
  export default Checkbox;
@@ -18,38 +18,38 @@ const InputContainer = styled.View `
18
18
  display: flex;
19
19
  flex-direction: row;
20
20
  width: 100%;
21
- background: ${(p) => p.theme.colors.palette.neutral.c00};
21
+ background: ${(p) => p.theme.colors.neutral.c00};
22
22
  height: 48px;
23
- border: ${(p) => `1px solid ${p.theme.colors.palette.neutral.c40}`};
23
+ border: ${(p) => `1px solid ${p.theme.colors.neutral.c40}`};
24
24
  border-radius: 24px;
25
- color: ${(p) => p.theme.colors.palette.neutral.c100};
25
+ color: ${(p) => p.theme.colors.neutral.c100};
26
26
 
27
27
  ${(p) => p.disabled &&
28
28
  css `
29
- color: ${p.theme.colors.palette.neutral.c60};
30
- background: ${(p) => p.theme.colors.palette.neutral.c30};
29
+ color: ${p.theme.colors.neutral.c60};
30
+ background: ${(p) => p.theme.colors.neutral.c30};
31
31
  `};
32
32
 
33
33
  ${(p) => p.focus &&
34
34
  !p.error &&
35
35
  css `
36
- border: 1px solid ${p.theme.colors.palette.primary.c80};
36
+ border: 1px solid ${p.theme.colors.primary.c80};
37
37
  `};
38
38
 
39
39
  ${(p) => p.error &&
40
40
  !p.disabled &&
41
41
  css `
42
- border: 1px solid ${p.theme.colors.palette.error.c100};
42
+ border: 1px solid ${p.theme.colors.error.c100};
43
43
  `};
44
44
 
45
45
  ${(p) => p.disabled &&
46
46
  css `
47
- color: ${p.theme.colors.palette.neutral.c60};
48
- background: ${(p) => p.theme.colors.palette.neutral.c30};
47
+ color: ${p.theme.colors.neutral.c60};
48
+ background: ${(p) => p.theme.colors.neutral.c30};
49
49
  `};
50
50
  `;
51
51
  const BaseInput = styled.TextInput.attrs((p) => ({
52
- selectionColor: p.theme.colors.palette.primary.c80,
52
+ selectionColor: p.theme.colors.primary.c80,
53
53
  })) `
54
54
  height: 100%;
55
55
  width: 100%;
@@ -61,7 +61,7 @@ const BaseInput = styled.TextInput.attrs((p) => ({
61
61
  padding-right: 20px;
62
62
  `;
63
63
  const InputErrorContainer = styled(Text) `
64
- color: ${(p) => p.theme.colors.palette.error.c100};
64
+ color: ${(p) => p.theme.colors.error.c100};
65
65
  margin-left: 12px;
66
66
  `;
67
67
  export const InputRenderLeftContainer = styled(FlexBox).attrs(() => ({
@@ -15,5 +15,5 @@ import Text from "../../../Text";
15
15
  export default function LegendInput(_a) {
16
16
  var { legend } = _a, inputProps = __rest(_a, ["legend"]);
17
17
  return (React.createElement(Input, Object.assign({}, inputProps, { renderRight: React.createElement(InputRenderRightContainer, null,
18
- React.createElement(Text, { color: "palette.neutral.c70", variant: "body" }, legend)) })));
18
+ React.createElement(Text, { color: "neutral.c70", variant: "body" }, legend)) })));
19
19
  }
@@ -16,12 +16,8 @@ import Input from "../BaseInput";
16
16
  import FlexBox from "../../../Layout/Flex";
17
17
  import Text from "../../../Text";
18
18
  const PercentButton = styled(TouchableOpacity) `
19
- color: ${(p) => p.active
20
- ? p.theme.colors.palette.neutral.c00
21
- : p.theme.colors.palette.neutral.c70};
22
- background-color: ${(p) => p.active
23
- ? p.theme.colors.palette.neutral.c100
24
- : p.theme.colors.palette.neutral.c00};
19
+ color: ${(p) => p.active ? p.theme.colors.neutral.c00 : p.theme.colors.neutral.c70};
20
+ background-color: ${(p) => p.active ? p.theme.colors.neutral.c100 : p.theme.colors.neutral.c00};
25
21
  border-radius: 100px;
26
22
  border-width: 0;
27
23
  height: 31px;
@@ -47,7 +43,7 @@ export default function NumberInput(_a) {
47
43
  return (React.createElement(Input, Object.assign({ serialize: serialize, deserialize: deserialize }, inputProps, { value: value, disabled: disabled, keyboardType: "numeric", renderRight: React.createElement(FlexBox, { alignItems: "center", justifyContent: "center", py: "3px", mr: "8px", flexDirection: "row" }, [0.25, 0.5, 0.75, 1].map((percent) => {
48
44
  const active = !!value && !!max && Number(value) === percent * Number(max);
49
45
  return (React.createElement(PercentButton, { key: percent, onPress: () => onPercentClick(percent), active: active, disabled: disabled },
50
- React.createElement(Text, { variant: "small", color: active ? "palette.neutral.c00" : "palette.neutral.c70" },
46
+ React.createElement(Text, { variant: "small", color: active ? "neutral.c00" : "neutral.c70" },
51
47
  percent * 100,
52
48
  "%")));
53
49
  })) })));
@@ -16,7 +16,7 @@ import Input from "../BaseInput";
16
16
  import FlexBox from "../../../Layout/Flex";
17
17
  import QrCodeMedium from "@ledgerhq/icons-ui/native/QrCodeMedium";
18
18
  const QrCodeButton = styled(TouchableOpacity) `
19
- background-color: ${(p) => p.theme.colors.palette.neutral.c100};
19
+ background-color: ${(p) => p.theme.colors.neutral.c100};
20
20
  display: flex;
21
21
  align-items: center;
22
22
  justify-content: center;
@@ -26,7 +26,7 @@ const QrCodeButton = styled(TouchableOpacity) `
26
26
  border-width: 0;
27
27
  `;
28
28
  const Icon = styled(QrCodeMedium).attrs((p) => ({
29
- color: p.theme.colors.palette.neutral.c00,
29
+ color: p.theme.colors.neutral.c00,
30
30
  })) ``;
31
31
  export default function QrCodeInput(_a) {
32
32
  var { onQrCodeClick } = _a, inputProps = __rest(_a, ["onQrCodeClick"]);
@@ -3,7 +3,7 @@ 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
8
  export default function SearchInput(props) {
9
9
  return (React.createElement(Input, Object.assign({}, props, { renderLeft: React.createElement(InputRenderLeftContainer, null,
@@ -12,7 +12,7 @@ const ElementContainer = styled(Flex).attrs({
12
12
  `;
13
13
  function Element({ first, value, selected, onPress, children, }) {
14
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 },
15
+ 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 },
16
16
  React.createElement(Text, { variant: "large" }, children || value))));
17
17
  }
18
18
  function SelectableList({ currentValue, onChange, children }) {
@@ -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
  };
@@ -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;
@@ -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] } }, label)) : null));
14
14
  };
15
15
  export default Switch;
@@ -9,11 +9,11 @@ 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
17
  return (React.createElement(IconContainer, { size: boxSize },
18
- React.createElement(Icon, { size: iconSize, color: color || colors.palette.neutral.c100 })));
18
+ React.createElement(Icon, { size: iconSize, color: color || colors.neutral.c100 })));
19
19
  }
@@ -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),
@@ -6,7 +6,7 @@ import Flex from "../Flex";
6
6
  const Container = styled(Flex).attrs({
7
7
  paddingHorizontal: 16,
8
8
  }) `
9
- background-color: ${(p) => p.theme.colors.palette.background.main};
9
+ background-color: ${(p) => p.theme.colors.background.main};
10
10
  width: 100%;
11
11
  `;
12
12
  const SCROLL_BREAKPOINT = 80;
@@ -1,4 +1,6 @@
1
+ export { default as Accordion } from "./Collapse/Accordion";
1
2
  export { default as Flex } from "./Flex";
2
3
  export * from "./Modals";
3
4
  export { default as ScrollContainer } from "./ScrollContainer";
5
+ export { default as ScrollContainerHeader } from "./ScrollContainerHeader";
4
6
  export { default as Row } from "./Table/Row";
@@ -1,4 +1,6 @@
1
+ export { default as Accordion } from "./Collapse/Accordion";
1
2
  export { default as Flex } from "./Flex";
2
3
  export * from "./Modals";
3
4
  export { default as ScrollContainer } from "./ScrollContainer";
5
+ export { default as ScrollContainerHeader } from "./ScrollContainerHeader";
4
6
  export { default as Row } from "./Table/Row";
@@ -10,8 +10,8 @@ const iconSize = radius * 0.88;
10
10
  const iconOffset = radius - iconSize / 2;
11
11
  const ProgressLoader = ({ progress = 0, onPress, Icon, }) => {
12
12
  const { colors } = useTheme();
13
- const backgroundColor = colors.palette.primary.c20;
14
- const progressColor = colors.palette.primary.c90;
13
+ const backgroundColor = colors.primary.c20;
14
+ const progressColor = colors.primary.c90;
15
15
  const strokeDashoffset = circumference - progress * circumference;
16
16
  return (React.createElement(TouchableOpacity, { disabled: !onPress, onPress: onPress },
17
17
  React.createElement(Svg, { width: radius * 2, height: radius * 2 },
@@ -13,10 +13,10 @@ const Bullet = styled.TouchableOpacity `
13
13
  height: 6px;
14
14
  border-radius: 6px;
15
15
  margin: 0 6px;
16
- background-color: ${(p) => p.theme.colors.palette.neutral.c40};
16
+ background-color: ${(p) => p.theme.colors.neutral.c40};
17
17
  `;
18
18
  const ActiveBullet = styled(Bullet) `
19
- background-color: ${(p) => p.theme.colors.palette.neutral.c100};
19
+ background-color: ${(p) => p.theme.colors.neutral.c100};
20
20
  position: absolute;
21
21
  top: 0;
22
22
  left: 0;
@@ -19,12 +19,12 @@ import Animated, { useAnimatedStyle, withTiming, withDelay, Easing, } from "reac
19
19
  const Separator = styled.View `
20
20
  flex: 1;
21
21
  height: 1px;
22
- background-color: ${(p) => p.theme.colors.palette.neutral.c40};
22
+ background-color: ${(p) => p.theme.colors.neutral.c40};
23
23
  ${space}
24
24
  `;
25
25
  const SeparatorFilling = Animated.createAnimatedComponent(styled.View `
26
26
  height: 100%;
27
- background-color: ${(p) => p.theme.colors.palette.neutral.c100};
27
+ background-color: ${(p) => p.theme.colors.neutral.c100};
28
28
  `);
29
29
  const AnimatedSeparator = (_a) => {
30
30
  var { filled, delay, duration } = _a, spaceProps = __rest(_a, ["filled", "delay", "duration"]);
@@ -67,13 +67,13 @@ const StepIcon = {
67
67
  width: ${(p) => p.theme.space[2]}px;
68
68
  height: ${(p) => p.theme.space[2]}px;
69
69
  border-radius: ${(p) => p.theme.radii[2]}px;
70
- background-color: ${(p) => p.theme.colors.palette.primary.c90};
70
+ background-color: ${(p) => p.theme.colors.primary.c90};
71
71
  `,
72
72
  Pending: styled.View `
73
73
  width: ${(p) => p.theme.space[1]}px;
74
74
  height: ${(p) => p.theme.space[1]}px;
75
75
  border-radius: ${(p) => p.theme.space[1]}px;
76
- background-color: ${(p) => p.theme.colors.palette.neutral.c70};
76
+ background-color: ${(p) => p.theme.colors.neutral.c70};
77
77
  `,
78
78
  Completed: ({ color }) => (React.createElement(CheckAlone, { size: 16, color: color })),
79
79
  Errored: ({ color }) => (React.createElement(CloseMedium, { size: 16, color: color })),
@@ -85,13 +85,13 @@ const StepView = styled.View `
85
85
  justify-content: center;
86
86
  `;
87
87
  const ActiveText = styled(Text) `
88
- color: ${(p) => p.theme.colors.palette.neutral.c100};
88
+ color: ${(p) => p.theme.colors.neutral.c100};
89
89
  `;
90
90
  const PendingText = styled(Text) `
91
- color: ${(p) => p.theme.colors.palette.neutral.c70};
91
+ color: ${(p) => p.theme.colors.neutral.c70};
92
92
  `;
93
93
  const ErroredText = styled(Text) `
94
- color: ${(p) => p.theme.colors.palette.error.c100};
94
+ color: ${(p) => p.theme.colors.error.c100};
95
95
  `;
96
96
  function Step({ state, label, showLeftSeparator, showRightSeparator, }) {
97
97
  const labelText = useMemo(() => {
@@ -109,14 +109,14 @@ function Step({ state, label, showLeftSeparator, showRightSeparator, }) {
109
109
  const icon = useMemo(() => {
110
110
  switch (state) {
111
111
  case "COMPLETED":
112
- return (React.createElement(StepIcon.Background, { backgroundColor: "palette.primary.c20" },
113
- React.createElement(StepIcon.Completed, { color: colors.palette.primary.c90 })));
112
+ return (React.createElement(StepIcon.Background, { backgroundColor: "primary.c20" },
113
+ React.createElement(StepIcon.Completed, { color: colors.primary.c90 })));
114
114
  case "CURRENT":
115
- return (React.createElement(StepIcon.Background, { backgroundColor: "palette.primary.c20" },
115
+ return (React.createElement(StepIcon.Background, { backgroundColor: "primary.c20" },
116
116
  React.createElement(StepIcon.Current, null)));
117
117
  case "ERRORED":
118
- return (React.createElement(StepIcon.Background, { backgroundColor: "palette.warning.c30" },
119
- React.createElement(StepIcon.Errored, { color: colors.palette.error.c100 })));
118
+ return (React.createElement(StepIcon.Background, { backgroundColor: "warning.c30" },
119
+ React.createElement(StepIcon.Errored, { color: colors.error.c100 })));
120
120
  case "PENDING":
121
121
  return (React.createElement(StepIcon.Background, null,
122
122
  React.createElement(StepIcon.Pending, null)));
@@ -9,7 +9,7 @@ export const ToggleGroupContainer = styled(FlexBox).attrs({
9
9
  alignItems: "stretch",
10
10
  }) `
11
11
  width: 100%;
12
- border: ${(p) => `1px solid ${p.theme.colors.palette.neutral.c40}`};
12
+ border: ${(p) => `1px solid ${p.theme.colors.neutral.c40}`};
13
13
  border-radius: 35px;
14
14
  padding: 4px;
15
15
  `;
@@ -20,7 +20,7 @@ const Base = styled.Text.attrs((p) => {
20
20
  var _a;
21
21
  return ({
22
22
  fontSize: p.fontSize ? p.fontSize : (_a = p.variant) !== null && _a !== void 0 ? _a : "paragraph",
23
- color: p.color || "palette.neutral.c100",
23
+ color: p.color || "neutral.c100",
24
24
  });
25
25
  }) `
26
26
  ${(p) => getTextStyle(p)}
@@ -39,7 +39,7 @@ const T = styled.View `
39
39
  align-items: center;
40
40
  `;
41
41
  const BracketText = (_a) => {
42
- 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"]);
43
43
  const size = lineHeight || getTextStyle(props).lineHeight;
44
44
  const theme = useTheme();
45
45
  const c = theme ? getColor(theme, color) : "transparent";
@@ -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
  }
@@ -91,6 +91,6 @@ export const PromisableButton = (props) => {
91
91
  return (React.createElement(Base, Object.assign({}, props, { type: type, size: size, iconButton: !!Icon && !children, disabled: disabled || spinnerOn, onPress: onPressHandler }),
92
92
  React.createElement(ButtonContainer, Object.assign({}, props, { type: type, size: size, hide: spinnerOn })),
93
93
  React.createElement(SpinnerContainer, null,
94
- React.createElement(ActivityIndicator, { color: theme.colors.palette.neutral.c50, animating: spinnerOn }))));
94
+ React.createElement(ActivityIndicator, { color: theme.colors.neutral.c50, animating: spinnerOn }))));
95
95
  };
96
96
  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
  }
@@ -10,25 +10,19 @@ 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
23
  React.createElement(Text, { variant: "body", fontWeight: "medium", color: color || textColor, numberOfLines: numberOfLines }, title),
28
24
  !!subtitle && (React.createElement(Text, { variant: "body", fontWeight: "medium", color: color ||
29
- (variant === "primary"
30
- ? colors.palette.neutral.c00
31
- : colors.palette.neutral.c80), mt: "2px", mb: "2px" }, subtitle)),
25
+ (variant === "primary" ? colors.neutral.c00 : colors.neutral.c80), mt: "2px", mb: "2px" }, subtitle)),
32
26
  onLearnMore && (React.createElement(TouchableOpacity, { onPress: onLearnMore },
33
27
  React.createElement(Text, { variant: "body", fontWeight: "semiBold", color: color || textColor }, "Learn more")))),
34
28
  onClose && (React.createElement(FlexBox, { marginLeft: "auto", pl: 16 },
@@ -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 `
@@ -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
  };
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.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Ledger Live - Desktop UI",
5
5
  "repository": "https://github.com/LedgerHQ/ui",
6
6
  "license": "MIT",
@@ -25,8 +25,6 @@
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.4",
29
- "react-native-svg": "12.1.1",
30
28
  "rn-range-slider": "^2.1.1",
31
29
  "styled-system": "^5.1.5",
32
30
  "victory-native": "^35.5.5"
@@ -34,8 +32,8 @@
34
32
  "peerDependencies": {
35
33
  "react": "^17.0.2",
36
34
  "react-native": "^0.64.0",
37
- "react-native-reanimated": "~2.2.3",
38
- "react-native-svg": "12.1.1",
35
+ "react-native-reanimated": "^2.2.4",
36
+ "react-native-svg": "^12.1.1",
39
37
  "styled-components": "^5.3.3"
40
38
  }
41
39
  }
@@ -3,6 +3,6 @@ import { ThemeProvider } from "styled-components/native";
3
3
  import defaultTheme from "./theme";
4
4
  import { palettes } from "@ledgerhq/ui-shared";
5
5
  export const StyleProvider = ({ children, selectedPalette, }) => {
6
- const theme = useMemo(() => (Object.assign(Object.assign({}, defaultTheme), { colors: Object.assign(Object.assign({}, defaultTheme.colors), { palette: palettes[selectedPalette] }), theme: selectedPalette })), [selectedPalette]);
6
+ const theme = useMemo(() => (Object.assign(Object.assign({}, defaultTheme), { colors: Object.assign(Object.assign(Object.assign({}, defaultTheme.colors), palettes[selectedPalette]), { palette: palettes[selectedPalette] }), theme: selectedPalette })), [selectedPalette]);
7
7
  return React.createElement(ThemeProvider, { theme: theme }, children);
8
8
  };
package/styles/theme.d.ts CHANGED
@@ -14,7 +14,10 @@ export declare type Theme = {
14
14
  radii: number[];
15
15
  fontSizes: number[];
16
16
  space: number[];
17
- colors: {
17
+ colors: ColorPalette & {
18
+ /**
19
+ * @deprecated Do not use the .palette prefix anymore!
20
+ */
18
21
  palette: ColorPalette;
19
22
  };
20
23
  zIndexes: number[];
package/styles/theme.js CHANGED
@@ -26,9 +26,7 @@ const theme = {
26
26
  radii,
27
27
  fontSizes,
28
28
  space,
29
- colors: {
30
- palette: palettes.light,
31
- },
29
+ colors: Object.assign(Object.assign({}, palettes.light), { palette: palettes.light }),
32
30
  zIndexes,
33
31
  };
34
32
  export default theme;