@ledgerhq/native-ui 0.6.3 → 0.6.4
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/components/Icon/IconBox/index.d.ts +7 -1
- package/components/Icon/IconBox/index.js +11 -10
- package/components/Layout/ScrollContainerHeader/index.d.ts +3 -2
- package/components/Layout/ScrollContainerHeader/index.js +5 -5
- package/components/Tabs/Graph/index.d.ts +1 -1
- package/components/Tabs/Graph/index.js +9 -3
- package/components/Tabs/TemplateTabs/index.d.ts +6 -0
- package/components/Tabs/TemplateTabs/index.js +2 -2
- package/components/Text/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IconOrElementType } from "../type";
|
|
3
|
+
import { FlexBoxProps } from "../../Layout/Flex";
|
|
3
4
|
declare type Props = {
|
|
4
5
|
Icon: IconOrElementType;
|
|
5
6
|
color?: string;
|
|
6
7
|
boxSize?: number;
|
|
7
8
|
iconSize?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Additional props to pass to the container component.
|
|
11
|
+
* This component is a Flex element.
|
|
12
|
+
*/
|
|
13
|
+
iconContainerProps?: FlexBoxProps;
|
|
8
14
|
};
|
|
9
|
-
export default function IconBox({ Icon, color, boxSize, iconSize, }: Props): React.ReactElement;
|
|
15
|
+
export default function IconBox({ Icon, color, boxSize, iconSize, iconContainerProps, }: Props): React.ReactElement;
|
|
10
16
|
export {};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled, { useTheme } from "styled-components/native";
|
|
3
|
+
import Flex from "../../Layout/Flex";
|
|
3
4
|
const DEFAULT_BOX_SIZE = 56;
|
|
4
5
|
const DEFAULT_ICON_SIZE = 24;
|
|
5
|
-
const IconContainer = styled.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const IconContainer = styled(Flex).attrs(({ size = DEFAULT_BOX_SIZE }) => ({
|
|
7
|
+
justifyContent: "center",
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
borderWidth: "1px",
|
|
10
|
+
borderColor: "neutral.c40",
|
|
11
|
+
width: `${size}px`,
|
|
12
|
+
height: `${size}px`,
|
|
13
|
+
})) `
|
|
13
14
|
border-radius: ${(p) => `${p.theme.radii[1]}px`};
|
|
14
15
|
`;
|
|
15
|
-
export default function IconBox({ Icon, color, boxSize = DEFAULT_BOX_SIZE, iconSize = DEFAULT_ICON_SIZE, }) {
|
|
16
|
+
export default function IconBox({ Icon, color, boxSize = DEFAULT_BOX_SIZE, iconSize = DEFAULT_ICON_SIZE, iconContainerProps, }) {
|
|
16
17
|
const { colors } = useTheme();
|
|
17
|
-
return (React.createElement(IconContainer, { size: boxSize }, React.isValidElement(Icon) ? (Icon) : (React.createElement(Icon, { size: iconSize, color: color || colors.neutral.c100 }))));
|
|
18
|
+
return (React.createElement(IconContainer, Object.assign({ size: boxSize }, iconContainerProps), React.isValidElement(Icon) ? (Icon) : (React.createElement(Icon, { size: iconSize, color: color || colors.neutral.c100 }))));
|
|
18
19
|
}
|
|
@@ -2,9 +2,10 @@ import React from "react";
|
|
|
2
2
|
import { FlatListProps } from "react-native";
|
|
3
3
|
import type { HeaderProps } from "./Header";
|
|
4
4
|
import { BaseStyledProps } from "../../styled";
|
|
5
|
-
declare type ScrollContainerHeaderProps = BaseStyledProps & Omit<HeaderProps, "currentPositionY"> & Omit<FlatListProps<any>, "onScroll" | "data" | "renderItem"
|
|
5
|
+
declare type ScrollContainerHeaderProps = BaseStyledProps & Omit<HeaderProps, "currentPositionY"> & Omit<FlatListProps<any>, "onScroll" | "data" | "renderItem"> & {
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
onScroll?: (y: number) => void;
|
|
8
|
+
containerProps?: BaseStyledProps;
|
|
8
9
|
};
|
|
9
|
-
declare const ScrollContainerHeader: ({ TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, children, onScroll, ...props }: ScrollContainerHeaderProps) => JSX.Element;
|
|
10
|
+
declare const ScrollContainerHeader: ({ TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, children, onScroll, containerProps, ...props }: ScrollContainerHeaderProps) => JSX.Element;
|
|
10
11
|
export default ScrollContainerHeader;
|
|
@@ -12,21 +12,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from "react";
|
|
13
13
|
import { View } from "react-native";
|
|
14
14
|
import Animated, { useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated";
|
|
15
|
+
import Flex from "../Flex";
|
|
15
16
|
import Header from "./Header";
|
|
16
17
|
import baseStyled from "../../styled";
|
|
17
18
|
const StyledFlatList = baseStyled.FlatList ``;
|
|
18
19
|
const AnimatedFlatList = Animated.createAnimatedComponent(StyledFlatList);
|
|
19
20
|
const ScrollContainerHeader = (_a) => {
|
|
20
|
-
var { TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, children, onScroll } = _a, props = __rest(_a, ["TopLeftSection", "TopRightSection", "TopMiddleSection", "MiddleSection", "BottomSection", "children", "onScroll"]);
|
|
21
|
+
var { TopLeftSection, TopRightSection, TopMiddleSection, MiddleSection, BottomSection, children, onScroll, containerProps } = _a, props = __rest(_a, ["TopLeftSection", "TopRightSection", "TopMiddleSection", "MiddleSection", "BottomSection", "children", "onScroll", "containerProps"]);
|
|
21
22
|
const currentPositionY = useSharedValue(0);
|
|
22
23
|
const handleScroll = useAnimatedScrollHandler((event) => {
|
|
23
24
|
currentPositionY.value = event.contentOffset.y;
|
|
24
25
|
if (onScroll)
|
|
25
26
|
onScroll(event.contentOffset.y);
|
|
26
27
|
});
|
|
27
|
-
return (React.createElement(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
], renderItem: ({ item, index }) => (React.createElement(View, { key: index }, item)) })));
|
|
28
|
+
return (React.createElement(Flex, Object.assign({ flex: 1 }, containerProps),
|
|
29
|
+
React.createElement(Header, { TopLeftSection: TopLeftSection, TopRightSection: TopRightSection, TopMiddleSection: TopMiddleSection, MiddleSection: MiddleSection, BottomSection: BottomSection, currentPositionY: currentPositionY }),
|
|
30
|
+
React.createElement(AnimatedFlatList, Object.assign({}, props, { onScroll: handleScroll, scrollEventThrottle: 16, data: [...React.Children.toArray(children)], renderItem: ({ item }) => React.createElement(View, null, item), keyExtractor: (_, index) => index }))));
|
|
31
31
|
};
|
|
32
32
|
export default ScrollContainerHeader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BaseTabsProps, TabItemProps } from "../TemplateTabs";
|
|
3
|
-
export declare const GraphTab: ({ onPress, isActive, label }: TabItemProps) => React.ReactElement;
|
|
3
|
+
export declare const GraphTab: ({ onPress, isActive, label, activeColor, activeBg, }: TabItemProps) => React.ReactElement;
|
|
4
4
|
declare const GraphTabs: (props: BaseTabsProps) => React.ReactElement;
|
|
5
5
|
export default GraphTabs;
|
|
@@ -2,20 +2,26 @@ import React from "react";
|
|
|
2
2
|
import styled from "styled-components/native";
|
|
3
3
|
import Text from "../../Text";
|
|
4
4
|
import { TouchableOpacity } from "react-native";
|
|
5
|
-
import Button from "../../cta/Button";
|
|
6
5
|
import TemplateTabs from "../TemplateTabs";
|
|
7
6
|
const TabBbx = styled(TouchableOpacity) `
|
|
8
7
|
text-align: center;
|
|
9
8
|
margin: auto;
|
|
10
9
|
flex: 1;
|
|
11
10
|
`;
|
|
11
|
+
const TabText = styled(Text).attrs({
|
|
12
|
+
lineHeight: "48px",
|
|
13
|
+
textAlign: "center",
|
|
14
|
+
borderRadius: 48,
|
|
15
|
+
px: 24,
|
|
16
|
+
height: 48,
|
|
17
|
+
}) ``;
|
|
12
18
|
const StyledTabs = styled(TemplateTabs) `
|
|
13
19
|
border: ${(p) => `1px solid ${p.theme.colors.palette.neutral.c40}`};
|
|
14
20
|
border-radius: 35px;
|
|
15
21
|
padding: 4px;
|
|
16
22
|
`;
|
|
17
|
-
export const GraphTab = ({ onPress, isActive, label }) => {
|
|
18
|
-
return (React.createElement(TabBbx, { onPress: onPress }, isActive ? (React.createElement(
|
|
23
|
+
export const GraphTab = ({ onPress, isActive, label, activeColor = "neutral.c100", activeBg = "primary.c20", }) => {
|
|
24
|
+
return (React.createElement(TabBbx, { onPress: onPress }, isActive ? (React.createElement(TabText, { variant: "body", bg: activeBg, color: activeColor, fontWeight: "semiBold" }, label)) : (React.createElement(TabText, { variant: "body" }, label))));
|
|
19
25
|
};
|
|
20
26
|
const GraphTabs = (props) => (React.createElement(StyledTabs, Object.assign({}, props, { Item: GraphTab })));
|
|
21
27
|
export default GraphTabs;
|
|
@@ -4,15 +4,21 @@ export declare type BaseTabsProps = {
|
|
|
4
4
|
labels: string[];
|
|
5
5
|
activeIndex: number;
|
|
6
6
|
onChange: (newIndex: number) => void;
|
|
7
|
+
activeColor?: string;
|
|
8
|
+
activeBg?: string;
|
|
7
9
|
};
|
|
8
10
|
export declare type TabItemProps = Partial<BaseTabsProps> & {
|
|
9
11
|
label: string;
|
|
10
12
|
isActive: boolean;
|
|
11
13
|
index: number;
|
|
12
14
|
onPress: () => void;
|
|
15
|
+
activeColor?: string;
|
|
16
|
+
activeBg?: string;
|
|
13
17
|
};
|
|
14
18
|
export declare type TabsProps = BaseTabsProps & {
|
|
15
19
|
Item: (props: TabItemProps) => React.ReactElement;
|
|
20
|
+
activeColor?: string;
|
|
21
|
+
activeBg?: string;
|
|
16
22
|
};
|
|
17
23
|
export declare const TabsContainer: import("styled-components").StyledComponent<typeof import("react-native").View, import("styled-components").DefaultTheme, import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").FlexboxProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").PositionProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").OverflowProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").BorderProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Border<import("styled-system").TLengthStyledSystem>> & import("styled-system").BackgroundProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Background<import("styled-system").TLengthStyledSystem>> & {
|
|
18
24
|
columnGap?: string | number | undefined;
|
|
@@ -8,7 +8,7 @@ export const TabsContainer = styled(FlexBox).attrs({
|
|
|
8
8
|
width: 100%;
|
|
9
9
|
`;
|
|
10
10
|
const TemplateTabsGroup = (props) => {
|
|
11
|
-
const { labels, activeIndex, onChange, Item } = props;
|
|
12
|
-
return (React.createElement(TabsContainer, Object.assign({}, props), labels.map((label, index) => (React.createElement(Item, Object.assign({ key: index }, props, { label: label, index: index, isActive: index === activeIndex, onPress: () => onChange(index) }))))));
|
|
11
|
+
const { labels, activeIndex, onChange, Item, activeColor, activeBg } = props;
|
|
12
|
+
return (React.createElement(TabsContainer, Object.assign({}, props), labels.map((label, index) => (React.createElement(Item, Object.assign({ key: index }, props, { label: label, index: index, isActive: index === activeIndex, onPress: () => onChange(index), activeColor: activeColor, activeBg: activeBg }))))));
|
|
13
13
|
};
|
|
14
14
|
export default TemplateTabsGroup;
|
|
@@ -10,7 +10,7 @@ export interface BaseTextProps extends TextProps, BaseStyledProps, FontSizeProps
|
|
|
10
10
|
fontFamily?: string;
|
|
11
11
|
fontSize?: number | string | TextVariants;
|
|
12
12
|
color?: string;
|
|
13
|
-
lineHeight?: number;
|
|
13
|
+
lineHeight?: number | string;
|
|
14
14
|
bracket?: boolean;
|
|
15
15
|
textTransform?: TextStyle["textTransform"];
|
|
16
16
|
uppercase?: boolean;
|