@ledgerhq/native-ui 0.7.4-monorepo.3 → 0.7.5
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.
- package/README.md +10 -10
- package/{lib/assets → assets}/fonts/alpha/HMAlphaMono-Medium.otf +0 -0
- package/{lib/assets → assets}/fonts/inter/Inter-Bold.otf +0 -0
- package/{lib/assets → assets}/fonts/inter/Inter-Medium.otf +0 -0
- package/{lib/assets → assets}/fonts/inter/Inter-SemiBold.otf +0 -0
- package/{lib/assets → assets}/icons.d.ts +0 -0
- package/{lib/assets → assets}/icons.js +0 -0
- package/{lib/assets → assets}/index.d.ts +0 -0
- package/{lib/assets → assets}/index.js +0 -0
- package/{lib/assets → assets}/logos/LedgerLiveAltRegular.d.ts +0 -1
- package/{lib/assets → assets}/logos/LedgerLiveAltRegular.js +0 -0
- package/{lib/assets → assets}/logos/LedgerLiveRegular.d.ts +0 -1
- package/{lib/assets → assets}/logos/LedgerLiveRegular.js +0 -0
- package/{lib/assets → assets}/logos/index.d.ts +0 -0
- package/{lib/assets → assets}/logos/index.js +0 -0
- package/{lib/components → components}/Carousel/index.d.ts +0 -0
- package/{lib/components → components}/Carousel/index.js +0 -0
- package/components/ChartCard/index.d.ts +19 -0
- package/components/ChartCard/index.js +38 -0
- package/{lib/components → components}/Form/Checkbox/index.d.ts +0 -1
- package/{lib/components → components}/Form/Checkbox/index.js +0 -0
- package/{lib/components → components}/Form/Input/BaseInput/index.d.ts +4 -4
- package/{lib/components → components}/Form/Input/BaseInput/index.js +0 -0
- package/{lib/components → components}/Form/Input/LegendInput/index.d.ts +0 -0
- package/{lib/components → components}/Form/Input/LegendInput/index.js +0 -0
- package/{lib/components → components}/Form/Input/NumberInput/index.d.ts +0 -0
- package/{lib/components → components}/Form/Input/NumberInput/index.js +0 -0
- package/{lib/components → components}/Form/Input/QrCodeInput/index.d.ts +0 -0
- package/{lib/components → components}/Form/Input/QrCodeInput/index.js +0 -0
- package/{lib/components → components}/Form/Input/SearchInput/index.d.ts +0 -0
- package/{lib/components → components}/Form/Input/SearchInput/index.js +0 -0
- package/{lib/components → components}/Form/Input/index.d.ts +0 -0
- package/{lib/components → components}/Form/Input/index.js +0 -0
- package/{lib/components → components}/Form/SelectableList.d.ts +0 -0
- package/{lib/components → components}/Form/SelectableList.js +0 -0
- package/{lib/components → components}/Form/Slider/components.d.ts +0 -0
- package/{lib/components → components}/Form/Slider/components.js +0 -0
- package/{lib/components → components}/Form/Slider/index.d.ts +0 -1
- package/{lib/components → components}/Form/Slider/index.js +0 -0
- package/{lib/components → components}/Form/Slider/index.native.d.ts +0 -1
- package/{lib/components → components}/Form/Slider/index.native.js +0 -0
- package/{lib/components → components}/Form/Switch/index.d.ts +0 -1
- package/{lib/components → components}/Form/Switch/index.js +0 -0
- package/{lib/components → components}/Form/Toggle/index.d.ts +0 -1
- package/{lib/components → components}/Form/Toggle/index.js +0 -0
- package/{lib/components → components}/Form/index.d.ts +0 -0
- package/{lib/components → components}/Form/index.js +0 -0
- package/{lib/components → components}/Icon/BoxedIcon.d.ts +0 -1
- package/{lib/components → components}/Icon/BoxedIcon.js +0 -0
- package/{lib/components → components}/Icon/Icon.d.ts +0 -1
- package/{lib/components → components}/Icon/Icon.js +0 -0
- package/{lib/components → components}/Icon/IconBox/index.d.ts +0 -0
- package/{lib/components → components}/Icon/IconBox/index.js +0 -0
- package/{lib/components → components}/Icon/index.d.ts +0 -0
- package/{lib/components → components}/Icon/index.js +0 -0
- package/{lib/components → components}/Icon/type.d.ts +0 -0
- package/{lib/components → components}/Icon/type.js +0 -0
- package/{lib/components → components}/Layout/Box/index.d.ts +1 -1
- package/{lib/components → components}/Layout/Box/index.js +0 -0
- package/{lib/components → components}/Layout/Collapse/Accordion/index.d.ts +0 -0
- package/{lib/components → components}/Layout/Collapse/Accordion/index.js +0 -1
- package/{lib/components → components}/Layout/Flex/index.d.ts +1 -1
- package/{lib/components → components}/Layout/Flex/index.js +0 -0
- package/{lib/components → components}/Layout/List/IconBoxList/index.d.ts +0 -0
- package/{lib/components → components}/Layout/List/IconBoxList/index.js +0 -0
- package/{lib/components → components}/Layout/List/List/index.d.ts +0 -0
- package/{lib/components → components}/Layout/List/List/index.js +0 -0
- package/{lib/components → components}/Layout/List/NumberedList/index.d.ts +0 -0
- package/{lib/components → components}/Layout/List/NumberedList/index.js +0 -0
- package/{lib/components → components}/Layout/List/TipList/index.d.ts +0 -0
- package/{lib/components → components}/Layout/List/TipList/index.js +0 -0
- package/{lib/components → components}/Layout/List/index.d.ts +0 -0
- package/{lib/components → components}/Layout/List/index.js +0 -0
- package/{lib/components → components}/Layout/Modals/BaseModal/index.d.ts +0 -0
- package/{lib/components → components}/Layout/Modals/BaseModal/index.js +0 -0
- package/{lib/components → components}/Layout/Modals/BottomDrawer/index.d.ts +0 -0
- package/{lib/components → components}/Layout/Modals/BottomDrawer/index.js +0 -0
- package/{lib/components → components}/Layout/Modals/Popin/index.d.ts +0 -0
- package/{lib/components → components}/Layout/Modals/Popin/index.js +0 -0
- package/{lib/components → components}/Layout/Modals/Tooltip/index.d.ts +0 -0
- package/{lib/components → components}/Layout/Modals/Tooltip/index.js +0 -0
- package/{lib/components → components}/Layout/Modals/index.d.ts +0 -0
- package/{lib/components → components}/Layout/Modals/index.js +0 -0
- package/{lib/components → components}/Layout/ScrollContainer/index.d.ts +0 -0
- package/{lib/components → components}/Layout/ScrollContainer/index.js +0 -0
- package/{lib/components → components}/Layout/ScrollContainerHeader/Header.d.ts +0 -1
- package/{lib/components → components}/Layout/ScrollContainerHeader/Header.js +0 -0
- package/{lib/components → components}/Layout/ScrollContainerHeader/index.d.ts +0 -0
- package/{lib/components → components}/Layout/ScrollContainerHeader/index.js +0 -0
- package/{lib/components → components}/Layout/ScrollListContainer/index.d.ts +0 -0
- package/{lib/components → components}/Layout/ScrollListContainer/index.js +0 -0
- package/{lib/components → components}/Layout/Table/Row.d.ts +0 -0
- package/{lib/components → components}/Layout/Table/Row.js +0 -0
- package/{lib/components → components}/Layout/index.d.ts +0 -0
- package/{lib/components → components}/Layout/index.js +0 -0
- package/{lib/components → components}/Layout/types.d.ts +0 -0
- package/{lib/components → components}/Layout/types.js +0 -0
- package/{lib/components → components}/Loader/InfiniteLoader/index.d.ts +1 -1
- package/{lib/components → components}/Loader/InfiniteLoader/index.js +0 -0
- package/{lib/components → components}/Loader/ProgressLoader/index.d.ts +0 -0
- package/{lib/components → components}/Loader/ProgressLoader/index.js +0 -0
- package/{lib/components → components}/Loader/index.d.ts +0 -0
- package/{lib/components → components}/Loader/index.js +0 -0
- package/{lib/components → components}/Navigation/FlowStepper/index.d.ts +0 -0
- package/{lib/components → components}/Navigation/FlowStepper/index.js +0 -0
- package/{lib/components → components}/Navigation/SlideIndicator/index.d.ts +0 -0
- package/{lib/components → components}/Navigation/SlideIndicator/index.js +0 -1
- package/{lib/components → components}/Navigation/Stepper/index.d.ts +0 -0
- package/{lib/components → components}/Navigation/Stepper/index.js +0 -0
- package/{lib/components → components}/Navigation/index.d.ts +0 -0
- package/{lib/components → components}/Navigation/index.js +0 -0
- package/{lib/components → components}/ProgressBar/index.d.ts +0 -0
- package/{lib/components → components}/ProgressBar/index.js +0 -0
- package/{lib/components → components}/Tabs/Chip/index.d.ts +0 -0
- package/{lib/components → components}/Tabs/Chip/index.js +0 -0
- package/{lib/components → components}/Tabs/Graph/index.d.ts +0 -0
- package/{lib/components → components}/Tabs/Graph/index.js +0 -0
- package/{lib/components → components}/Tabs/TemplateTabs/index.d.ts +1 -1
- package/{lib/components → components}/Tabs/TemplateTabs/index.js +0 -0
- package/{lib/components → components}/Tabs/index.d.ts +0 -0
- package/{lib/components → components}/Tabs/index.js +0 -0
- package/{lib/components → components}/Text/getTextStyle.d.ts +0 -0
- package/{lib/components → components}/Text/getTextStyle.js +0 -0
- package/{lib/components → components}/Text/index.d.ts +0 -0
- package/{lib/components → components}/Text/index.js +0 -0
- package/components/chart/index.d.ts +15 -0
- package/components/chart/index.js +68 -0
- package/components/chart/types.d.ts +6 -0
- package/{lib/components → components}/chart/types.js +0 -0
- package/{lib/components → components}/cta/Button/getButtonStyle.d.ts +0 -0
- package/{lib/components → components}/cta/Button/getButtonStyle.js +0 -0
- package/{lib/components → components}/cta/Button/index.d.ts +0 -0
- package/{lib/components → components}/cta/Button/index.js +0 -0
- package/{lib/components → components}/cta/Link/getLinkStyle.d.ts +0 -0
- package/{lib/components → components}/cta/Link/getLinkStyle.js +0 -0
- package/{lib/components → components}/cta/Link/index.d.ts +0 -0
- package/{lib/components → components}/cta/Link/index.js +0 -0
- package/{lib/components → components}/cta/getCtaStyle.d.ts +0 -0
- package/{lib/components → components}/cta/getCtaStyle.js +0 -0
- package/{lib/components → components}/cta/index.d.ts +0 -0
- package/{lib/components → components}/cta/index.js +0 -0
- package/{lib/components → components}/index.d.ts +2 -0
- package/{lib/components → components}/index.js +2 -0
- package/{lib/components → components}/message/Alert/index.d.ts +0 -0
- package/{lib/components → components}/message/Alert/index.js +0 -0
- package/{lib/components → components}/message/Log/Brackets.d.ts +0 -0
- package/{lib/components → components}/message/Log/Brackets.js +0 -0
- package/{lib/components → components}/message/Log/index.d.ts +0 -0
- package/{lib/components → components}/message/Log/index.js +0 -0
- package/{lib/components → components}/message/Notification/index.d.ts +0 -0
- package/{lib/components → components}/message/Notification/index.js +0 -0
- package/{lib/components → components}/message/index.d.ts +0 -0
- package/{lib/components → components}/message/index.js +0 -0
- package/{lib/components → components}/styled.d.ts +0 -0
- package/{lib/components → components}/styled.js +1 -4
- package/{lib/components → components}/tags/Badge/index.d.ts +0 -0
- package/{lib/components → components}/tags/Badge/index.js +0 -0
- package/{lib/components → components}/tags/Tag/index.d.ts +0 -0
- package/{lib/components → components}/tags/Tag/index.js +0 -0
- package/{lib/components → components}/tags/index.d.ts +0 -0
- package/{lib/components → components}/tags/index.js +0 -0
- package/{lib/components → components}/transitions/Fade.d.ts +0 -1
- package/{lib/components → components}/transitions/Fade.js +0 -0
- package/{lib/components → components}/transitions/Slide.d.ts +0 -1
- package/{lib/components → components}/transitions/Slide.js +0 -0
- package/{lib/components → components}/transitions/Transition.d.ts +0 -1
- package/{lib/components → components}/transitions/Transition.js +0 -0
- package/{lib/components → components}/transitions/index.d.ts +0 -0
- package/{lib/components → components}/transitions/index.js +0 -0
- package/{lib/components → components}/transitions/types.d.ts +0 -0
- package/{lib/components → components}/transitions/types.js +0 -0
- package/{lib/helpers → helpers}/getDeviceSize.d.ts +0 -0
- package/{lib/helpers → helpers}/getDeviceSize.js +0 -0
- package/{lib/icons → icons}/BracketLeft.d.ts +0 -0
- package/{lib/icons → icons}/BracketLeft.js +0 -0
- package/{lib/icons → icons}/BracketRight.d.ts +0 -0
- package/{lib/icons → icons}/BracketRight.js +0 -0
- package/{lib/icons → icons}/Close.d.ts +0 -0
- package/{lib/icons → icons}/Close.js +0 -0
- package/{lib/icons → icons}/Info.d.ts +0 -0
- package/{lib/icons → icons}/Info.js +0 -0
- package/{lib/index.d.ts → index.d.ts} +0 -0
- package/{lib/index.js → index.js} +0 -0
- package/package.json +16 -121
- package/{lib/styles → styles}/InvertTheme.d.ts +0 -0
- package/{lib/styles → styles}/InvertTheme.js +0 -0
- package/{lib/styles → styles}/StyleProvider.d.ts +0 -0
- package/{lib/styles → styles}/StyleProvider.js +0 -0
- package/{lib/styles → styles}/helpers.d.ts +0 -0
- package/{lib/styles → styles}/helpers.js +0 -0
- package/{lib/styles → styles}/index.d.ts +0 -0
- package/{lib/styles → styles}/index.js +0 -0
- package/{lib/styles → styles}/theme.d.ts +0 -0
- package/{lib/styles → styles}/theme.js +0 -0
- package/lib/components/chart/index.d.ts +0 -11
- package/lib/components/chart/index.js +0 -59
- package/lib/components/chart/types.d.ts +0 -6
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useMemo, useCallback } from "react";
|
|
2
|
+
import { useTheme } from "styled-components/native";
|
|
3
|
+
import { Defs, LinearGradient, Stop } from "react-native-svg";
|
|
4
|
+
import { VictoryLine, VictoryChart, VictoryAxis, VictoryArea, VictoryTooltip, VictoryVoronoiContainer, } from "victory-native";
|
|
5
|
+
import { Flex } from "../index";
|
|
6
|
+
import { hex } from "../../styles/helpers";
|
|
7
|
+
const sortByDate = (a, b) => {
|
|
8
|
+
if (a.date.getTime() < b.date.getTime())
|
|
9
|
+
return -1;
|
|
10
|
+
if (a.date.getTime() > b.date.getTime())
|
|
11
|
+
return 1;
|
|
12
|
+
return 0;
|
|
13
|
+
};
|
|
14
|
+
const Chart = ({ data, backgroundColor, color, timeFormat = { month: "short" }, valueKey = "value", height = 200, yAxisFormatter, valueFormatter, disableTooltips = false, locale, }) => {
|
|
15
|
+
const theme = useTheme();
|
|
16
|
+
const sortData = useMemo(() => data.sort(sortByDate), [data]);
|
|
17
|
+
const labelFormatted = useCallback(({ datum }) => {
|
|
18
|
+
const valueFormatted = valueFormatter(datum[valueKey]);
|
|
19
|
+
return valueFormatted === "-" ? "0" : valueFormatted;
|
|
20
|
+
}, [valueKey, valueFormatter]);
|
|
21
|
+
const domainValues = useMemo(() => {
|
|
22
|
+
const counterValues = data.map((d) => d[valueKey]);
|
|
23
|
+
return {
|
|
24
|
+
min: Math.min(...counterValues) * 0.8,
|
|
25
|
+
max: Math.max(...counterValues) * 1.2, // 1.2 So the maximum value of the yAxis is a bit bigger than the max value displayed
|
|
26
|
+
};
|
|
27
|
+
}, [data, valueKey]);
|
|
28
|
+
const yAxisStyle = useMemo(() => ({
|
|
29
|
+
grid: {
|
|
30
|
+
stroke: theme.colors.neutral.c40,
|
|
31
|
+
strokeDasharray: "4 4",
|
|
32
|
+
},
|
|
33
|
+
axisLabel: { display: "none" },
|
|
34
|
+
axis: { display: "none" },
|
|
35
|
+
ticks: { display: "none" },
|
|
36
|
+
tickLabels: {
|
|
37
|
+
fill: theme.colors.neutral.c80,
|
|
38
|
+
fontSize: 12,
|
|
39
|
+
},
|
|
40
|
+
}), [theme]);
|
|
41
|
+
const xAxisStyle = useMemo(() => ({
|
|
42
|
+
axis: {
|
|
43
|
+
stroke: theme.colors.neutral.c40,
|
|
44
|
+
strokeDasharray: "4 4",
|
|
45
|
+
},
|
|
46
|
+
tickLabels: {
|
|
47
|
+
fill: theme.colors.neutral.c80,
|
|
48
|
+
fontSize: 12,
|
|
49
|
+
},
|
|
50
|
+
grid: { display: "none" },
|
|
51
|
+
}), [theme]);
|
|
52
|
+
return (React.createElement(Flex, { justifyContent: "center", alignItems: "center" },
|
|
53
|
+
React.createElement(VictoryChart, { scale: { x: "time" }, height: height, domainPadding: { y: 5 }, padding: { top: 30, left: 60, right: 35, bottom: 35 }, maxDomain: { y: domainValues.max }, minDomain: { y: domainValues.min }, containerComponent: React.createElement(VictoryVoronoiContainer, { disable: disableTooltips, voronoiBlacklist: ["victory-area"], labels: labelFormatted, labelComponent: React.createElement(VictoryTooltip, { centerOffset: { y: -10 }, renderInPortal: false, constrainToVisibleArea: true, style: {
|
|
54
|
+
fill: color,
|
|
55
|
+
}, flyoutPadding: 7, flyoutStyle: {
|
|
56
|
+
fill: backgroundColor,
|
|
57
|
+
stroke: color,
|
|
58
|
+
} }) }) },
|
|
59
|
+
React.createElement(VictoryAxis, { dependentAxis: true, crossAxis: true, tickFormat: yAxisFormatter, style: yAxisStyle }),
|
|
60
|
+
React.createElement(VictoryAxis, { crossAxis: false, tickFormat: (timestamp) => new Intl.DateTimeFormat(locale, timeFormat).format(timestamp), style: xAxisStyle }),
|
|
61
|
+
React.createElement(Defs, null,
|
|
62
|
+
React.createElement(LinearGradient, { id: "chartGradient", x1: "0.5", x2: "0.5", y1: "0", y2: "1" },
|
|
63
|
+
React.createElement(Stop, { stopColor: hex(color), stopOpacity: "0.15" }),
|
|
64
|
+
React.createElement(Stop, { offset: "1", stopColor: hex(theme.colors.neutral.c00), stopOpacity: "0" }))),
|
|
65
|
+
React.createElement(VictoryArea, { name: "victory-area", data: sortData, interpolation: "monotoneX", sortKey: "date", x: "date", y: valueKey, style: { data: { fill: `url(#chartGradient)` } }, standalone: false }),
|
|
66
|
+
React.createElement(VictoryLine, { data: sortData, interpolation: "monotoneX", x: "date", y: valueKey, style: { data: { stroke: color } } }))));
|
|
67
|
+
};
|
|
68
|
+
export default Chart;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -12,3 +12,5 @@ export * from "./Loader";
|
|
|
12
12
|
export { default as ProgressBar } from "./ProgressBar";
|
|
13
13
|
import * as Transitions_1 from "./transitions";
|
|
14
14
|
export { Transitions_1 as Transitions };
|
|
15
|
+
export { default as Chart } from "./chart";
|
|
16
|
+
export { default as ChartCard } from "./ChartCard";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -6,10 +6,7 @@ const proxyStyled = new Proxy(styled, {
|
|
|
6
6
|
return styled(target.apply(thisArg, argumentsList)(baseStyles));
|
|
7
7
|
},
|
|
8
8
|
get(target, property) {
|
|
9
|
-
|
|
10
|
-
return styled(target[property].apply(styled, [baseStyles]));
|
|
11
|
-
}
|
|
12
|
-
return target[property];
|
|
9
|
+
return styled(target[property].apply(styled, [baseStyles]));
|
|
13
10
|
},
|
|
14
11
|
});
|
|
15
12
|
export default proxyStyled;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "Ledger Live -
|
|
3
|
+
"version": "0.7.5",
|
|
4
|
+
"description": "Ledger Live - Desktop UI",
|
|
5
5
|
"repository": "https://github.com/LedgerHQ/ui",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Ledger Live Team <team-live@ledger.fr>",
|
|
8
|
-
"main": "lib/index.js",
|
|
9
|
-
"types": "index.d.ts",
|
|
10
|
-
"typesVersions": {
|
|
11
|
-
"*": {
|
|
12
|
-
"*": [
|
|
13
|
-
"lib/*",
|
|
14
|
-
"lib/*/index.d.ts"
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"exports": {
|
|
19
|
-
".": "./lib/index.js",
|
|
20
|
-
"./": "./lib/",
|
|
21
|
-
"./package.json": "./package.json"
|
|
22
|
-
},
|
|
23
8
|
"files": [
|
|
24
|
-
"
|
|
9
|
+
"components",
|
|
10
|
+
"assets",
|
|
11
|
+
"styles",
|
|
12
|
+
"helpers",
|
|
13
|
+
"icons",
|
|
14
|
+
"index.d.ts",
|
|
15
|
+
"index.js"
|
|
25
16
|
],
|
|
26
17
|
"dependencies": {
|
|
27
|
-
"@ledgerhq/icons-ui": "^0.2.
|
|
28
|
-
"@ledgerhq/ui-shared": "^0.1.
|
|
29
|
-
"@types/color": "^3.0.
|
|
30
|
-
"@types/react": "^17.0.
|
|
18
|
+
"@ledgerhq/icons-ui": "^0.2.3",
|
|
19
|
+
"@ledgerhq/ui-shared": "^0.1.5",
|
|
20
|
+
"@types/color": "^3.0.2",
|
|
21
|
+
"@types/react": "^17.0.37",
|
|
31
22
|
"@types/react-native": "^0.65.9",
|
|
32
23
|
"@types/styled-components-react-native": "^5.1.3",
|
|
33
24
|
"@types/styled-system": "^5.1.13",
|
|
@@ -40,105 +31,9 @@
|
|
|
40
31
|
},
|
|
41
32
|
"peerDependencies": {
|
|
42
33
|
"react": "^17.0.2",
|
|
43
|
-
"react-native": "
|
|
44
|
-
"react-native-reanimated": "^2.4
|
|
34
|
+
"react-native": "^0.65.0",
|
|
35
|
+
"react-native-reanimated": "^2.2.4",
|
|
45
36
|
"react-native-svg": "^12.1.1",
|
|
46
37
|
"styled-components": "^5.3.3"
|
|
47
|
-
}
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@babel/core": "^7.17.4",
|
|
50
|
-
"@babel/generator": "^7.17.2",
|
|
51
|
-
"@babel/plugin-proposal-export-namespace-from": "^7.16.0",
|
|
52
|
-
"@babel/preset-env": "^7.15.8",
|
|
53
|
-
"@babel/runtime": "^7.17.2",
|
|
54
|
-
"@emotion/core": "^11.0.0",
|
|
55
|
-
"@expo/webpack-config": "^0.16.18",
|
|
56
|
-
"@react-native-community/eslint-config": "^3.0.1",
|
|
57
|
-
"@storybook/addon-actions": "^6.4.19",
|
|
58
|
-
"@storybook/addon-backgrounds": "^6.4.19",
|
|
59
|
-
"@storybook/addon-controls": "^6.4.19",
|
|
60
|
-
"@storybook/addon-docs": "^6.4.19",
|
|
61
|
-
"@storybook/addon-essentials": "^6.4.19",
|
|
62
|
-
"@storybook/addon-knobs": "^6.4.0",
|
|
63
|
-
"@storybook/addon-links": "^6.4.19",
|
|
64
|
-
"@storybook/addon-measure": "^6.4.19",
|
|
65
|
-
"@storybook/addon-ondevice-actions": "^5.3.23",
|
|
66
|
-
"@storybook/addon-ondevice-knobs": "^5.3.25",
|
|
67
|
-
"@storybook/addon-outline": "^6.4.19",
|
|
68
|
-
"@storybook/addon-toolbars": "^6.4.19",
|
|
69
|
-
"@storybook/addon-viewport": "^6.4.19",
|
|
70
|
-
"@storybook/addons": "^6.4.19",
|
|
71
|
-
"@storybook/api": "^6.4.19",
|
|
72
|
-
"@storybook/components": "^6.4.19",
|
|
73
|
-
"@storybook/core-events": "^6.4.19",
|
|
74
|
-
"@storybook/react": "^6.4.19",
|
|
75
|
-
"@storybook/react-native": "^5.3.25",
|
|
76
|
-
"@storybook/theming": "^6.4.19",
|
|
77
|
-
"@svgr/core": "^5.5.0",
|
|
78
|
-
"@svgr/plugin-jsx": "^5.5.0",
|
|
79
|
-
"@svgr/plugin-svgo": "^5.5.0",
|
|
80
|
-
"@typescript-eslint/eslint-plugin": "^5.12.1",
|
|
81
|
-
"@typescript-eslint/parser": "^5.12.1",
|
|
82
|
-
"babel-loader": "^8.2.2",
|
|
83
|
-
"babel-plugin-module-resolver": "^4.1.0",
|
|
84
|
-
"babel-preset-expo": "^9.0.2",
|
|
85
|
-
"camelcase": "^6.2.1",
|
|
86
|
-
"eslint": "^8.10.0",
|
|
87
|
-
"eslint-config-prettier": "^8.3.0",
|
|
88
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
89
|
-
"eslint-plugin-react": "^7.29.2",
|
|
90
|
-
"eslint-plugin-react-hooks": "^4.3.0",
|
|
91
|
-
"expo": "~44.0.0",
|
|
92
|
-
"expo-asset": "~8.4.6",
|
|
93
|
-
"expo-cli": "^5",
|
|
94
|
-
"expo-constants": "~13.0.2",
|
|
95
|
-
"expo-file-system": "~13.1.3",
|
|
96
|
-
"expo-font": "^10.0.5",
|
|
97
|
-
"expo-modules-core": "0.6.5",
|
|
98
|
-
"expo-status-bar": "~1.2.0",
|
|
99
|
-
"fs-extra": "^10.0.1",
|
|
100
|
-
"glob": "^7.2.0",
|
|
101
|
-
"metro": "^0.67.0",
|
|
102
|
-
"metro-config": "^0.67.0",
|
|
103
|
-
"metro-extra-config": "1.0.1-monorepo.3",
|
|
104
|
-
"metro-minify-uglify": "^0.67.0",
|
|
105
|
-
"metro-react-native-babel-preset": "^0.67.0",
|
|
106
|
-
"metro-runtime": "^0.67.0",
|
|
107
|
-
"metro-transform-worker": "^0.67.0",
|
|
108
|
-
"prettier": "^2.4.1",
|
|
109
|
-
"react": "^17.0.2",
|
|
110
|
-
"react-dom": "^17.0.2",
|
|
111
|
-
"react-is": "^17.0.2",
|
|
112
|
-
"react-native": "0.64.3",
|
|
113
|
-
"react-native-gesture-handler": "^1.10.3",
|
|
114
|
-
"react-native-reanimated": "^2.4.1",
|
|
115
|
-
"react-native-svg": "^12.1.1",
|
|
116
|
-
"react-native-web": "~0.17.5",
|
|
117
|
-
"regenerator-runtime": "^0.13.9",
|
|
118
|
-
"rimraf": "^3.0.2",
|
|
119
|
-
"styled-components": "^5.3.3",
|
|
120
|
-
"typescript": "^4.4.4",
|
|
121
|
-
"victory": "^35.5.5",
|
|
122
|
-
"webpack": "^4.46.0"
|
|
123
|
-
},
|
|
124
|
-
"scripts": {
|
|
125
|
-
"android": "expo start --android",
|
|
126
|
-
"build": "tsc -p tsconfig.prod.json && node scripts/postBuild",
|
|
127
|
-
"build:storybook": "build-storybook -o web-build",
|
|
128
|
-
"build:icons": "node -e \"process.env['VERCEL_BUILD'] ? process.exit(1) : process.exit(0)\" || (cd ../icons && npm run build)",
|
|
129
|
-
"build:web": "npm run build:icons && npm run build:storybook",
|
|
130
|
-
"watch": "tsc --watch",
|
|
131
|
-
"clean": "rimraf lib",
|
|
132
|
-
"eject": "expo eject",
|
|
133
|
-
"ios": "expo start --ios",
|
|
134
|
-
"lint": "eslint src storybook --ext .ts,.tsx,.js,.jsx --cache",
|
|
135
|
-
"lint:fix": "eslint src storybook --ext .ts,.tsx,.js,.jsx --fix --cache",
|
|
136
|
-
"release": "yarn publish ./lib --access public",
|
|
137
|
-
"expo": "expo start",
|
|
138
|
-
"storybook": "start-storybook -p 6006",
|
|
139
|
-
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
140
|
-
"test": "exit 0",
|
|
141
|
-
"web": "expo start --web"
|
|
142
|
-
},
|
|
143
|
-
"readme": "# `@ledgerhq/native-ui`\n\n[](https://github.com/LedgerHQ/ui/actions/workflows/native.yml)\n[](https://www.npmjs.com/package/@ledgerhq/native-ui)\n[](https://ledger-live-ui-native.vercel.app)\n\n### Design and interface resources for React Native\n\n#### This package contains [React Native](https://reactnative.dev/) components and styles built on top of our design system and used internally at [Ledger](https://www.ledger.com/).\n\n## Reference\n\n**[🔗 Storybook](https://ledger-live-ui-native.vercel.app/)**\n\n## Installation\n\n### Package\n\n```sh\nnpm i @ledgerhq/native-ui\n```\n\n### Peer dependencies\n\n_This library uses the following packages under the hood and relies on them being installed separately to avoid package duplication._\n\n```sh\nnpm i styled-components react-native-reanimated react-native-svg\n```\n\n### Additional setup\n\n**Skip this step if your project is managed by Expo.**\n\nFollow the installation instructions for:\n\n- [react-native-reanimated](https://docs.swmansion.com/react-native-reanimated/docs/2.2.0/installation)\n- [react-native-svg](https://github.com/react-native-svg/react-native-svg#installation)\n\n## Usage\n\n### Provider\n\nBefore using the library components, the style provider must be imported and rendered once to provide the components with the right context.\n\n```tsx\nimport { StyleProvider } from \"@ledgerhq/native-ui\";\n\nfunction Root({ children }) {\n // Selected theme palette can be either \"dark\" or \"light\".\n return <StyleProvider selectedPalette=\"light\">{children}</StyleProvider>;\n}\n```\n\n### Components\n\nImport the components from `@ledgerhq/native-ui`.\n\n```tsx\nimport { Flex, Text } from \"@ledgerhq/native-ui\";\n\nfunction Hello() {\n return (\n <Flex flexDirection=\"column\" alignItems=\"center\">\n <Text variant=\"h1\" color=\"neutral.c100\">\n Hello, world!\n </Text>\n </Flex>\n );\n}\n```\n\n### Fonts\n\n#### Using [Expo](https://expo.dev/)\n\n```sh\nexpo install expo-font\n```\n\n```js\nimport { useFonts } from \"expo-font\";\n\n/*\n A higher-order component that will load and provide Ledger fonts to your app.\n*/\nfunction FontProvider({ children }) {\n const [fontsLoaded] = useFonts({\n \"HMAlphaMono-Medium\": require(\"@ledgerhq/native-ui/lib/assets/fonts/alpha/HMAlphaMono-Medium.otf\"),\n \"Inter-Medium\": require(\"@ledgerhq/native-ui/lib/assets/fonts/inter/Inter-Medium.otf\"),\n \"Inter-SemiBold\": require(\"@ledgerhq/native-ui/lib/assets/fonts/inter/Inter-SemiBold.otf\"),\n \"Inter-Bold\": require(\"@ledgerhq/native-ui/lib/assets/fonts/inter/Inter-Bold.otf\"),\n });\n\n if (!fontsLoaded) {\n return null;\n }\n\n return children;\n}\n```\n\n#### React Native - Bare\n\nAdd the paths in the `react-native.config.js` file:\n\n```js\nmodule.exports = {\n assets: [\n \"node_modules/@ledgerhq/native-ui/lib/assets/fonts/alpha\",\n \"node_modules/@ledgerhq/native-ui/lib/assets/fonts/inter\",\n ],\n};\n```\n\nThen run the following command to add the required native code:\n\n```\nnpx react-native link\n```\n\n## Minimal Working Example\n\n[🌍 Hosted here.](https://snack.expo.dev/PG3RFRIAP)\n\n### Expo\n\n```js\nimport React from \"react\";\nimport { StyleProvider, Flex, Switch, Text, Logos } from \"@ledgerhq/native-ui\";\nimport { useTheme } from \"styled-components/native\";\nimport { useFonts } from \"expo-font\";\n\nfunction Logo() {\n const theme = useTheme();\n return <Logos.LedgerLiveRegular color={theme.colors.neutral.c100} />;\n}\n\nfunction FontProvider({ children }) {\n const [fontsLoaded] = useFonts({\n \"HMAlphaMono-Medium\": require(\"@ledgerhq/native-ui/lib/assets/fonts/alpha/HMAlphaMono-Medium.otf\"),\n \"Inter-Medium\": require(\"@ledgerhq/native-ui/lib/assets/fonts/inter/Inter-Medium.otf\"),\n \"Inter-SemiBold\": require(\"@ledgerhq/native-ui/lib/assets/fonts/inter/Inter-SemiBold.otf\"),\n \"Inter-Bold\": require(\"@ledgerhq/native-ui/lib/assets/fonts/inter/Inter-Bold.otf\"),\n });\n\n if (!fontsLoaded) {\n return null;\n }\n\n return children;\n}\n\nexport default function App() {\n const [palette, setPalette] = React.useState(\"light\");\n const isLight = palette === \"light\";\n\n return (\n <FontProvider>\n <StyleProvider selectedPalette={palette}>\n <Flex\n flex={1}\n justifyContent=\"center\"\n alignItems=\"center\"\n flexDirection=\"column\"\n backgroundColor=\"neutral.c00\"\n >\n <Logo />\n <Text variant=\"h2\" color=\"neutral.c100\" my={10}>\n Hello, world!\n </Text>\n <Switch\n checked={isLight}\n onChange={() => setPalette(() => (isLight ? \"dark\" : \"light\"))}\n />\n </Flex>\n </StyleProvider>\n </FontProvider>\n );\n}\n```\n\n### React Native - Bare\n\n```js\nimport React from \"react\";\nimport { StyleProvider } from \"@ledgerhq/native-ui/styles\";\nimport { Flex, Text, Logos, Switch } from \"@ledgerhq/native-ui\";\nimport { useTheme } from \"styled-components/native\";\n\nfunction Logo() {\n const theme = useTheme();\n return <Logos.LedgerLiveRegular color={theme.colors.neutral.c100} />;\n}\n\nexport default function App() {\n const [palette, setPalette] = React.useState(\"light\");\n const isLight = palette === \"light\";\n\n return (\n <StyleProvider selectedPalette={palette}>\n <Flex\n flex={1}\n p={12}\n justifyContent=\"center\"\n alignItems=\"center\"\n flexDirection=\"column\"\n backgroundColor=\"neutral.c00\"\n >\n <Logo />\n <Text variant=\"h2\" color=\"neutral.c100\" my={10}>\n Hello, world!\n </Text>\n <Switch checked={isLight} onChange={() => setPalette(() => (isLight ? \"dark\" : \"light\"))} />\n </Flex>\n </StyleProvider>\n );\n}\n```\n"
|
|
38
|
+
}
|
|
144
39
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { Item } from "./types";
|
|
3
|
-
export declare type ChartProps = {
|
|
4
|
-
data: Array<Item>;
|
|
5
|
-
color: string;
|
|
6
|
-
tickFormat?: string;
|
|
7
|
-
valueKey?: string;
|
|
8
|
-
height?: number;
|
|
9
|
-
};
|
|
10
|
-
declare const Chart: ({ data, color, tickFormat, valueKey, height, }: ChartProps) => JSX.Element;
|
|
11
|
-
export default Chart;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from "react";
|
|
2
|
-
import styled, { useTheme } from "styled-components/native";
|
|
3
|
-
import moment from "moment";
|
|
4
|
-
import { Defs, LinearGradient, Stop } from "react-native-svg";
|
|
5
|
-
import { VictoryLine, VictoryChart, VictoryAxis, VictoryArea, VictoryScatter, } from "victory-native";
|
|
6
|
-
import { hex } from "../../styles/helpers";
|
|
7
|
-
import Flex from "../Layout/Flex";
|
|
8
|
-
const Container = styled(Flex) `
|
|
9
|
-
background-color: ${(p) => p.theme.colors.background.main};
|
|
10
|
-
`;
|
|
11
|
-
const sortByDate = (a, b) => {
|
|
12
|
-
if (a.date.getTime() < b.date.getTime())
|
|
13
|
-
return -1;
|
|
14
|
-
if (a.date.getTime() > b.date.getTime())
|
|
15
|
-
return 1;
|
|
16
|
-
return 0;
|
|
17
|
-
};
|
|
18
|
-
const Chart = ({ data, color, tickFormat = "MMM", valueKey = "value", height = 191, }) => {
|
|
19
|
-
const theme = useTheme();
|
|
20
|
-
const sortData = useMemo(() => data.sort(sortByDate), [data]);
|
|
21
|
-
return (React.createElement(Container, null,
|
|
22
|
-
React.createElement(VictoryChart, { scale: { x: "time" }, height: height, domainPadding: { x: [0, 5], y: [30, 10] } },
|
|
23
|
-
React.createElement(VictoryAxis, { dependentAxis: true, crossAxis: true, style: {
|
|
24
|
-
grid: {
|
|
25
|
-
stroke: theme.colors.neutral.c40,
|
|
26
|
-
strokeDasharray: "4 4",
|
|
27
|
-
},
|
|
28
|
-
axisLabel: { display: "none" },
|
|
29
|
-
axis: { display: "none" },
|
|
30
|
-
ticks: { display: "none" },
|
|
31
|
-
tickLabels: { display: "none" },
|
|
32
|
-
} }),
|
|
33
|
-
React.createElement(VictoryAxis, { crossAxis: false, tickFormat: (timestamp) => moment(timestamp).format(tickFormat), style: {
|
|
34
|
-
axis: {
|
|
35
|
-
stroke: theme.colors.neutral.c40,
|
|
36
|
-
strokeDasharray: "4 4",
|
|
37
|
-
},
|
|
38
|
-
tickLabels: {
|
|
39
|
-
fill: theme.colors.neutral.c80,
|
|
40
|
-
fontSize: 12,
|
|
41
|
-
lineHeight: "14.52px",
|
|
42
|
-
},
|
|
43
|
-
grid: { display: "none" },
|
|
44
|
-
} }),
|
|
45
|
-
React.createElement(Defs, null,
|
|
46
|
-
React.createElement(LinearGradient, { id: "chartGradient", x1: "0.5", x2: "0.5", y1: "0", y2: "1" },
|
|
47
|
-
React.createElement(Stop, { stopColor: hex(color), stopOpacity: "0.11" }),
|
|
48
|
-
React.createElement(Stop, { offset: "1", stopColor: hex(theme.colors.neutral.c00), stopOpacity: "0" }))),
|
|
49
|
-
React.createElement(VictoryArea, { data: sortData, interpolation: "monotoneX", sortKey: "date", x: "date", y: valueKey, style: { data: { fill: `url(#chartGradient)` } }, standalone: false }),
|
|
50
|
-
React.createElement(VictoryLine, { data: sortData, interpolation: "monotoneX", x: "date", y: valueKey, style: { data: { stroke: color } } }),
|
|
51
|
-
React.createElement(VictoryScatter, { style: {
|
|
52
|
-
data: {
|
|
53
|
-
stroke: color,
|
|
54
|
-
strokeWidth: 3,
|
|
55
|
-
fill: theme.colors.background.main,
|
|
56
|
-
},
|
|
57
|
-
}, size: 5, data: [sortData[sortData.length - 1]], x: "date", y: valueKey }))));
|
|
58
|
-
};
|
|
59
|
-
export default Chart;
|