@ledgerhq/native-ui 0.7.4 → 0.7.7

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.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare type Props = {
2
3
  width?: number | string;
3
4
  height?: number | string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare type Props = {
2
3
  width?: number | string;
3
4
  height?: number | string;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- declare const ChartCard: ({ Header, Footer, range, isLoading, refreshChart, chartData, currencyColor, margin, locale, ranges, yAxisFormatter, valueFormatter, }: {
2
+ declare const ChartCard: ({ Header, Footer, range, isLoading, refreshChart, chartData, currencyColor, margin, xAxisFormatter, ranges, yAxisFormatter, valueFormatter, }: {
3
3
  Header?: React.ReactNode;
4
4
  Footer?: React.ReactNode;
5
5
  range: string;
@@ -8,7 +8,7 @@ declare const ChartCard: ({ Header, Footer, range, isLoading, refreshChart, char
8
8
  chartData: any;
9
9
  currencyColor: string;
10
10
  margin: number;
11
- locale: string;
11
+ xAxisFormatter?: ((value: number) => string) | undefined;
12
12
  ranges: {
13
13
  label: string;
14
14
  value: string;
@@ -1,9 +1,8 @@
1
- import React, { useCallback, useMemo } from "react";
1
+ import React, { useCallback } from "react";
2
2
  import { useTheme } from "styled-components/native";
3
- import { Flex, GraphTabs, InfiniteLoader } from "../index";
4
- import * as Animatable from "react-native-animatable";
3
+ import { Flex, GraphTabs, InfiniteLoader, Transitions } from "../index";
5
4
  import Chart from "../chart";
6
- const ChartCard = ({ Header, Footer, range, isLoading, refreshChart, chartData, currencyColor, margin = 0, locale, ranges, yAxisFormatter, valueFormatter, }) => {
5
+ const ChartCard = ({ Header, Footer, range, isLoading, refreshChart, chartData, currencyColor, margin = 0, xAxisFormatter, ranges, yAxisFormatter, valueFormatter, }) => {
7
6
  const { colors } = useTheme();
8
7
  const rangesLabels = ranges.map(({ label }) => label);
9
8
  const activeRangeIndex = ranges.findIndex((r) => r.value === range);
@@ -15,24 +14,12 @@ const ChartCard = ({ Header, Footer, range, isLoading, refreshChart, chartData,
15
14
  if (range !== newRange)
16
15
  refreshChart({ range: newRange });
17
16
  }, [isLoading, range, ranges, refreshChart]);
18
- const timeFormat = useMemo(() => {
19
- switch (ranges[activeRangeIndex].value) {
20
- case "24h":
21
- return { hour: "numeric", minute: "numeric" };
22
- case "7d":
23
- return { weekday: "short" };
24
- case "30d":
25
- return { month: "short", day: "numeric" };
26
- default:
27
- return { month: "short" };
28
- }
29
- }, [ranges, activeRangeIndex]);
30
17
  return (React.createElement(Flex, { margin: margin, padding: 6, borderRadius: 2, bg: "neutral.c30" },
31
18
  Header,
32
- React.createElement(Flex, { mt: 6, height: 100, alignItems: "center", justifyContent: "center" }, chartData && chartData.length > 0 ? (React.createElement(Animatable.View, { animation: "fadeIn", duration: 400, useNativeDriver: true },
33
- React.createElement(Chart, { locale: locale, data: chartData, backgroundColor: colors.neutral.c30, color: currencyColor, timeFormat: timeFormat, valueKey: "value", yAxisFormatter: yAxisFormatter, valueFormatter: valueFormatter, disableTooltips: false }))) : (React.createElement(InfiniteLoader, { size: 32 }))),
19
+ React.createElement(Flex, { mt: 6, height: 100, alignItems: "center", justifyContent: "center" }, chartData && chartData.length > 0 ? (React.createElement(Transitions.Fade, { status: "entering", duration: 400 },
20
+ React.createElement(Chart, { data: chartData, backgroundColor: colors.neutral.c30, color: currencyColor, valueKey: "value", xAxisFormatter: xAxisFormatter, yAxisFormatter: yAxisFormatter, valueFormatter: valueFormatter, disableTooltips: false }))) : (React.createElement(InfiniteLoader, { size: 32 }))),
34
21
  React.createElement(Flex, { mt: 70 },
35
- React.createElement(GraphTabs, { activeIndex: activeRangeIndex, activeBg: "neutral.c30", onChange: setRange, labels: rangesLabels })),
22
+ React.createElement(GraphTabs, { activeIndex: activeRangeIndex, activeBg: currencyColor, activeColor: "neutral.c30", onChange: setRange, labels: rangesLabels })),
36
23
  Footer));
37
24
  };
38
25
  export default ChartCard;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { BaseTextProps } from "../../Text";
2
3
  declare type CheckboxProps = {
3
4
  checked: boolean;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { SliderProps } from "./index.native";
2
3
  declare const SliderScreen: (_props: SliderProps) => JSX.Element;
3
4
  export default SliderScreen;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare type SliderProps = {
2
3
  step: number;
3
4
  min: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare type SwitchProps = {
2
3
  checked: boolean;
3
4
  onChange?: (value: boolean) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ButtonProps } from "../../cta/Button";
2
3
  declare type ToggleProps = {
3
4
  active?: boolean;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { IconOrElementType, IconType } from "./type";
2
3
  export declare const DEFAULT_BOX_SIZE = 40;
3
4
  export declare const DEFAULT_ICON_SIZE = 16;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare type Props = {
2
3
  name: string;
3
4
  size?: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import Animated from "react-native-reanimated";
2
3
  export declare type HeaderProps = {
3
4
  TopLeftSection?: JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="styled-components-react-native" />
2
2
  import React from "react";
3
3
  import { SizeProps } from "styled-system";
4
- declare const Loader: import("styled-components").StyledComponent<import("react").ComponentClass<import("react-native-svg").SvgProps, any>, import("styled-components").DefaultTheme, SizeProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Height<import("styled-system").TLengthStyledSystem>>, never>;
4
+ declare const Loader: import("styled-components").StyledComponent<React.ComponentClass<import("react-native-svg").SvgProps, any>, import("styled-components").DefaultTheme, SizeProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Height<import("styled-system").TLengthStyledSystem>>, never>;
5
5
  export declare type Props = React.ComponentProps<typeof Loader> & {
6
6
  color?: string;
7
7
  };
@@ -1,15 +1,15 @@
1
+ /// <reference types="react" />
1
2
  import type { Item } from "./types";
2
3
  export declare type ChartProps = {
3
4
  data: Array<Item>;
4
5
  backgroundColor: string;
5
6
  color: string;
6
- timeFormat?: any;
7
7
  valueKey?: string;
8
8
  height?: number;
9
+ xAxisFormatter?: (timestamp: number) => string;
9
10
  yAxisFormatter: (n: number) => string;
10
11
  valueFormatter: (n: number) => string;
11
12
  disableTooltips: boolean;
12
- locale: string;
13
13
  };
14
- declare const Chart: ({ data, backgroundColor, color, timeFormat, valueKey, height, yAxisFormatter, valueFormatter, disableTooltips, locale, }: ChartProps) => JSX.Element;
14
+ declare const Chart: ({ data, backgroundColor, color, yAxisFormatter, valueFormatter, valueKey, height, xAxisFormatter, disableTooltips, }: ChartProps) => JSX.Element;
15
15
  export default Chart;
@@ -11,7 +11,7 @@ const sortByDate = (a, b) => {
11
11
  return 1;
12
12
  return 0;
13
13
  };
14
- const Chart = ({ data, backgroundColor, color, timeFormat = { month: "short" }, valueKey = "value", height = 200, yAxisFormatter, valueFormatter, disableTooltips = false, locale, }) => {
14
+ const Chart = ({ data, backgroundColor, color, yAxisFormatter, valueFormatter, valueKey = "value", height = 200, xAxisFormatter = (timestamp) => `${new Date(timestamp).toLocaleDateString()}`, disableTooltips = false, }) => {
15
15
  const theme = useTheme();
16
16
  const sortData = useMemo(() => data.sort(sortByDate), [data]);
17
17
  const labelFormatted = useCallback(({ datum }) => {
@@ -57,7 +57,7 @@ const Chart = ({ data, backgroundColor, color, timeFormat = { month: "short" },
57
57
  stroke: color,
58
58
  } }) }) },
59
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 }),
60
+ React.createElement(VictoryAxis, { crossAxis: false, tickFormat: xAxisFormatter, style: xAxisStyle }),
61
61
  React.createElement(Defs, null,
62
62
  React.createElement(LinearGradient, { id: "chartGradient", x1: "0.5", x2: "0.5", y1: "0", y2: "1" },
63
63
  React.createElement(Stop, { stopColor: hex(color), stopOpacity: "0.15" }),
@@ -11,5 +11,5 @@ export * from "./Tabs";
11
11
  export * from "./Loader";
12
12
  export { default as ProgressBar } from "./ProgressBar";
13
13
  export * as Transitions from "./transitions";
14
- export * from "./chart";
15
- export * from "./ChartCard";
14
+ export { default as Chart } from "./chart";
15
+ export { default as ChartCard } from "./ChartCard";
@@ -12,5 +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 * from "./chart";
16
- export * from "./ChartCard";
15
+ export { default as Chart } from "./chart";
16
+ export { default as ChartCard } from "./ChartCard";
@@ -16,14 +16,14 @@ export const Bracket = ({ color, style, mb, mt }) => {
16
16
  React.createElement(Path, { d: "M16.8125 0H2.8125H0.8125V2V10H2.8125V2H16.8125V0Z", fill: fill }))));
17
17
  };
18
18
  export const BracketTopLeft = ({ color }) => {
19
- return React.createElement(Bracket, { color: color, mb: "-4px" });
19
+ return React.createElement(Bracket, { color: color });
20
20
  };
21
21
  export const BracketTopRight = ({ color }) => {
22
- return React.createElement(Bracket, { color: color, mb: "-4px", style: { transform: [{ scaleX: -1 }] } });
22
+ return React.createElement(Bracket, { color: color, style: { transform: [{ scaleX: -1 }] } });
23
23
  };
24
24
  export const BracketBottomLeft = ({ color }) => {
25
- return React.createElement(Bracket, { color: color, mt: "-4px", style: { transform: [{ scaleY: -1 }] } });
25
+ return React.createElement(Bracket, { color: color, style: { transform: [{ scaleY: -1 }] } });
26
26
  };
27
27
  export const BracketBottomRight = ({ color }) => {
28
- return React.createElement(Bracket, { color: color, mt: "-4px", style: { transform: [{ scale: -1 }] } });
28
+ return React.createElement(Bracket, { color: color, style: { transform: [{ scale: -1 }] } });
29
29
  };
@@ -2,13 +2,14 @@ import React, { memo } from "react";
2
2
  import Text from "../../Text";
3
3
  import Flex from "../../Layout/Flex";
4
4
  import { BracketTopLeft, BracketTopRight, BracketBottomLeft, BracketBottomRight } from "./Brackets";
5
+ import { Platform } from "react-native";
5
6
  function Log({ children, extraTextProps }) {
6
7
  return (React.createElement(Flex, { flexDirection: "column" },
7
- React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between" },
8
+ React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between", mb: Platform.OS === "android" ? "-2px" : "-6px" },
8
9
  React.createElement(BracketTopLeft, { color: "neutral.c100" }),
9
10
  React.createElement(BracketTopRight, { color: "neutral.c100" })),
10
- React.createElement(Text, Object.assign({ variant: "h2", textTransform: "uppercase", textAlign: "center", color: "neutral.c100", px: "16px" }, extraTextProps), children),
11
- React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between" },
11
+ React.createElement(Text, Object.assign({ variant: "h2", lineHeight: "28px", textTransform: "uppercase", textAlign: "center", color: "neutral.c100", px: "15.5px", style: { overflow: "visible" } }, extraTextProps), children),
12
+ React.createElement(Flex, { mt: Platform.OS === "android" ? "-9.5px" : "-5px", flexDirection: "row", justifyContent: "space-between" },
12
13
  React.createElement(BracketBottomLeft, { color: "neutral.c100" }),
13
14
  React.createElement(BracketBottomRight, { color: "neutral.c100" }))));
14
15
  }
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { FlexBoxProps } from "../../Layout/Flex";
3
3
  export interface TagProps extends FlexBoxProps {
4
4
  active?: boolean;
5
+ uppercase?: boolean;
5
6
  children: React.ReactNode;
6
7
  }
7
- export default function Tag({ active, children, ...props }: TagProps): JSX.Element;
8
+ export default function Tag({ active, uppercase, children, ...props }: TagProps): JSX.Element;
@@ -13,7 +13,7 @@ import React from "react";
13
13
  import Flex from "../../Layout/Flex";
14
14
  import Text from "../../Text";
15
15
  export default function Tag(_a) {
16
- var { active, children } = _a, props = __rest(_a, ["active", "children"]);
16
+ var { active, uppercase, children } = _a, props = __rest(_a, ["active", "uppercase", "children"]);
17
17
  return (React.createElement(Flex, Object.assign({ px: 2, alignItems: "center", justifyContent: "center", borderRadius: 4, borderWidth: 1, borderColor: active ? "primary.c50" : "neutral.c40" }, props),
18
- React.createElement(Text, { variant: "tiny", fontWeight: "semiBold", lineHeight: "16px", textTransform: "uppercase", textAlign: "center", color: active ? "primary.c70" : "neutral.c80" }, children)));
18
+ React.createElement(Text, { variant: "tiny", fontWeight: "semiBold", lineHeight: "16px", uppercase: uppercase !== false, textAlign: "center", color: active ? "primary.c70" : "neutral.c80" }, children)));
19
19
  }
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { TransitionProps } from "./types";
2
3
  /**
3
4
  * A fade-in / fade-out transition changing the opacity of its children based on their status.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { TransitionProps } from "./types";
2
3
  export interface SlideProps extends TransitionProps {
3
4
  /**
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { TransitionStatus } from "./index";
2
3
  export interface Props {
3
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/native-ui",
3
- "version": "0.7.4",
3
+ "version": "0.7.7",
4
4
  "description": "Ledger Live - Desktop UI",
5
5
  "repository": "https://github.com/LedgerHQ/ui",
6
6
  "license": "MIT",