@ledgerhq/native-ui 0.6.4 → 0.6.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/components/Form/Slider/index.native.d.ts +3 -1
- package/components/Form/Slider/index.native.js +2 -2
- package/components/Layout/Modals/BaseModal/index.d.ts +3 -5
- package/components/Layout/Modals/BaseModal/index.js +5 -10
- package/components/Layout/Modals/Popin/index.d.ts +1 -5
- package/components/Layout/Modals/Popin/index.js +2 -3
- package/components/Layout/ScrollListContainer/index.d.ts +10 -0
- package/components/Layout/ScrollListContainer/index.js +26 -0
- package/components/Layout/index.d.ts +1 -0
- package/components/Layout/index.js +1 -0
- package/components/message/Alert/index.d.ts +4 -2
- package/components/message/Alert/index.js +3 -2
- package/components/tags/Tag/index.d.ts +7 -0
- package/components/tags/Tag/index.js +19 -0
- package/components/tags/index.d.ts +1 -0
- package/components/tags/index.js +1 -0
- package/package.json +2 -2
|
@@ -4,7 +4,9 @@ export declare type SliderProps = {
|
|
|
4
4
|
max: number;
|
|
5
5
|
value: number;
|
|
6
6
|
onChange: (low: number, high: number) => void;
|
|
7
|
+
onTouchStart?: (low: number, high: number) => void;
|
|
8
|
+
onTouchEnd?: (low: number, high: number) => void;
|
|
7
9
|
disabled?: boolean;
|
|
8
10
|
};
|
|
9
|
-
declare const Slider: ({ value, min, max, step, onChange, disabled }: SliderProps) => JSX.Element;
|
|
11
|
+
declare const Slider: ({ value, min, max, step, onChange, onTouchEnd, onTouchStart, disabled, }: SliderProps) => JSX.Element;
|
|
10
12
|
export default Slider;
|
|
@@ -10,7 +10,7 @@ const SliderContainer = styled.View `
|
|
|
10
10
|
align-items: center;
|
|
11
11
|
width: 100%;
|
|
12
12
|
`;
|
|
13
|
-
const Slider = ({ value, min, max, step, onChange, disabled }) => {
|
|
13
|
+
const Slider = ({ value, min, max, step, onChange, onTouchEnd, onTouchStart, disabled, }) => {
|
|
14
14
|
const renderRail = useCallback(() => React.createElement(Rail, null), []);
|
|
15
15
|
const renderRailSelected = useCallback(() => React.createElement(RailSelected, null), []);
|
|
16
16
|
const renderLabel = useCallback((value) => React.createElement(Label, null, value), []);
|
|
@@ -18,7 +18,7 @@ const Slider = ({ value, min, max, step, onChange, disabled }) => {
|
|
|
18
18
|
return (React.createElement(SliderContainer, null,
|
|
19
19
|
React.createElement(RnRangeSlider, { style: {
|
|
20
20
|
width: "100%",
|
|
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 }),
|
|
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, onTouchStart: onTouchStart, onTouchEnd: onTouchEnd }),
|
|
22
22
|
React.createElement(MinMaxTextContainer, null,
|
|
23
23
|
React.createElement(Text, { variant: "small", fontWeight: "medium", color: "neutral.c70" }, min),
|
|
24
24
|
React.createElement(Text, { variant: "small", fontWeight: "medium", color: "neutral.c70" }, max))));
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ModalProps } from "react-native-modal";
|
|
3
3
|
import { StyleProp, ViewStyle } from "react-native";
|
|
4
|
+
import { IconOrElementType } from "../../../Icon/type";
|
|
4
5
|
export declare type BaseModalProps = {
|
|
5
6
|
isOpen?: boolean;
|
|
6
7
|
onClose?: () => void;
|
|
7
8
|
modalStyle?: StyleProp<ViewStyle>;
|
|
8
9
|
containerStyle?: StyleProp<ViewStyle>;
|
|
9
10
|
preventBackdropClick?: boolean;
|
|
10
|
-
Icon?:
|
|
11
|
-
size?: number;
|
|
12
|
-
color?: string;
|
|
13
|
-
}) => React.ReactNode) | React.ReactNode;
|
|
11
|
+
Icon?: IconOrElementType;
|
|
14
12
|
iconColor?: string;
|
|
15
13
|
title?: string;
|
|
16
14
|
description?: string;
|
|
17
15
|
subtitle?: string;
|
|
18
|
-
children
|
|
16
|
+
children?: React.ReactNode;
|
|
19
17
|
} & Partial<ModalProps>;
|
|
20
18
|
export default function BaseModal({ isOpen, onClose, containerStyle, modalStyle, preventBackdropClick, Icon, iconColor, title, description, subtitle, children, ...rest }: BaseModalProps): React.ReactElement;
|
|
@@ -11,12 +11,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from "react";
|
|
13
13
|
import ReactNativeModal from "react-native-modal";
|
|
14
|
-
import styled
|
|
14
|
+
import styled from "styled-components/native";
|
|
15
15
|
import sizes from "../../../../helpers/getDeviceSize";
|
|
16
16
|
import Link from "../../../cta/Link";
|
|
17
17
|
import CloseMedium from "@ledgerhq/icons-ui/native/CloseMedium";
|
|
18
|
-
import FlexBox from "../../../Layout/Flex";
|
|
19
18
|
import Text from "../../../Text";
|
|
19
|
+
import { BoxedIcon } from "../../../Icon";
|
|
20
|
+
import { Flex } from "../../index";
|
|
20
21
|
const { width, height } = sizes;
|
|
21
22
|
const Container = styled.View `
|
|
22
23
|
background-color: ${(p) => p.theme.colors.background.main};
|
|
@@ -45,7 +46,6 @@ const StyledDescription = styled(Text).attrs({
|
|
|
45
46
|
variant: "body",
|
|
46
47
|
color: "neutral.c80",
|
|
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({
|
|
@@ -53,6 +53,7 @@ const StyledSubtitle = styled(Text).attrs({
|
|
|
53
53
|
color: "neutral.c80",
|
|
54
54
|
}) `
|
|
55
55
|
text-transform: uppercase;
|
|
56
|
+
text-align: center;
|
|
56
57
|
margin-bottom: ${(p) => p.theme.space[2]}px;
|
|
57
58
|
`;
|
|
58
59
|
const defaultModalStyle = {
|
|
@@ -61,7 +62,6 @@ const defaultModalStyle = {
|
|
|
61
62
|
};
|
|
62
63
|
export default function BaseModal(_a) {
|
|
63
64
|
var { isOpen, onClose = () => { }, containerStyle = {}, modalStyle = {}, preventBackdropClick, Icon, iconColor, title, description, subtitle, children } = _a, rest = __rest(_a, ["isOpen", "onClose", "containerStyle", "modalStyle", "preventBackdropClick", "Icon", "iconColor", "title", "description", "subtitle", "children"]);
|
|
64
|
-
const { colors } = useTheme();
|
|
65
65
|
const backDropProps = preventBackdropClick
|
|
66
66
|
? {}
|
|
67
67
|
: {
|
|
@@ -74,12 +74,7 @@ export default function BaseModal(_a) {
|
|
|
74
74
|
React.createElement(CloseContainer, null,
|
|
75
75
|
React.createElement(Link, { Icon: CloseMedium, onPress: onClose })),
|
|
76
76
|
React.createElement(HeaderContainer, null,
|
|
77
|
-
Icon && (React.createElement(
|
|
78
|
-
? Icon({
|
|
79
|
-
size: 48,
|
|
80
|
-
color: iconColor || colors.neutral.c100,
|
|
81
|
-
})
|
|
82
|
-
: Icon)),
|
|
77
|
+
Icon && (React.createElement(Flex, { mb: 7 }, React.isValidElement(Icon) ? (Icon) : (React.createElement(BoxedIcon, { size: 64, Icon: Icon, iconSize: 24, iconColor: iconColor })))),
|
|
83
78
|
subtitle && React.createElement(StyledSubtitle, null, subtitle),
|
|
84
79
|
title && React.createElement(StyledTitle, null, title),
|
|
85
80
|
description && React.createElement(StyledDescription, null, description)),
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BaseModalProps } from "../BaseModal";
|
|
3
3
|
import { ButtonProps } from "../../../cta/Button";
|
|
4
|
-
export default function Popin({ children,
|
|
5
|
-
Icon: (props: {
|
|
6
|
-
size?: number;
|
|
7
|
-
color?: string;
|
|
8
|
-
}) => React.ReactElement;
|
|
4
|
+
export default function Popin({ children, leftButtonText, rightButtonText, onLeftButtonPress, onRightButtonPress, ...restProps }: BaseModalProps & {
|
|
9
5
|
leftButtonText?: string;
|
|
10
6
|
rightButtonText?: string;
|
|
11
7
|
onLeftButtonPress?: ButtonProps["onPress"];
|
|
@@ -14,7 +14,6 @@ import { StyleSheet } from "react-native";
|
|
|
14
14
|
import styled from "styled-components/native";
|
|
15
15
|
import BaseModal from "../BaseModal";
|
|
16
16
|
import Text from "../../../Text";
|
|
17
|
-
import IconBox from "../../../Icon/IconBox";
|
|
18
17
|
import Button from "../../../cta/Button";
|
|
19
18
|
const FooterButtonsContainer = styled.View `
|
|
20
19
|
display: flex;
|
|
@@ -29,8 +28,8 @@ const modalStyleOverrides = StyleSheet.create({
|
|
|
29
28
|
},
|
|
30
29
|
});
|
|
31
30
|
export default function Popin(_a) {
|
|
32
|
-
var { children,
|
|
33
|
-
return (React.createElement(BaseModal, Object.assign({}, restProps, { containerStyle: modalStyleOverrides.container
|
|
31
|
+
var { children, leftButtonText = "Cancel", rightButtonText = "Delete", onLeftButtonPress, onRightButtonPress } = _a, restProps = __rest(_a, ["children", "leftButtonText", "rightButtonText", "onLeftButtonPress", "onRightButtonPress"]);
|
|
32
|
+
return (React.createElement(BaseModal, Object.assign({}, restProps, { containerStyle: modalStyleOverrides.container }),
|
|
34
33
|
children,
|
|
35
34
|
React.createElement(FooterButtonsContainer, null,
|
|
36
35
|
React.createElement(Button, { onPress: onLeftButtonPress, outline: true, type: "shade", style: { flex: 1, marginRight: 8 } },
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FlatListProps, NativeSyntheticEvent, NativeScrollEvent } from "react-native";
|
|
3
|
+
import { BaseStyledProps } from "../../styled";
|
|
4
|
+
declare type ScrollListContainerProps = BaseStyledProps & Omit<FlatListProps<any>, "onScroll" | "data" | "renderItem"> & {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
7
|
+
horizontal?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const ScrollListContainer: ({ children, onScroll, horizontal, ...props }: ScrollListContainerProps) => JSX.Element;
|
|
10
|
+
export default ScrollListContainer;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { View } from "react-native";
|
|
14
|
+
import Animated from "react-native-reanimated";
|
|
15
|
+
import baseStyled from "../../styled";
|
|
16
|
+
const StyledFlatList = baseStyled.FlatList ``;
|
|
17
|
+
const AnimatedFlatList = Animated.createAnimatedComponent(StyledFlatList);
|
|
18
|
+
/*
|
|
19
|
+
** This Layout is a wrapper for FlatList that accepts
|
|
20
|
+
** complex onScroll callback for react-native-reanimated.
|
|
21
|
+
*/
|
|
22
|
+
const ScrollListContainer = (_a) => {
|
|
23
|
+
var { children, onScroll, horizontal = false } = _a, props = __rest(_a, ["children", "onScroll", "horizontal"]);
|
|
24
|
+
return (React.createElement(AnimatedFlatList, Object.assign({ data: [...React.Children.toArray(children)], renderItem: ({ item }) => React.createElement(View, null, item), onScroll: onScroll, horizontal: horizontal }, props)));
|
|
25
|
+
};
|
|
26
|
+
export default ScrollListContainer;
|
|
@@ -4,5 +4,6 @@ export { default as Box } from "./Box";
|
|
|
4
4
|
export * from "./Modals";
|
|
5
5
|
export { default as ScrollContainer } from "./ScrollContainer";
|
|
6
6
|
export { default as ScrollContainerHeader } from "./ScrollContainerHeader";
|
|
7
|
+
export { default as ScrollListContainer } from "./ScrollListContainer";
|
|
7
8
|
export { default as Row } from "./Table/Row";
|
|
8
9
|
export * from "./List";
|
|
@@ -4,5 +4,6 @@ export { default as Box } from "./Box";
|
|
|
4
4
|
export * from "./Modals";
|
|
5
5
|
export { default as ScrollContainer } from "./ScrollContainer";
|
|
6
6
|
export { default as ScrollContainerHeader } from "./ScrollContainerHeader";
|
|
7
|
+
export { default as ScrollListContainer } from "./ScrollListContainer";
|
|
7
8
|
export { default as Row } from "./Table/Row";
|
|
8
9
|
export * from "./List";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
declare type AlertType = "info" | "warning" | "error";
|
|
2
3
|
export interface AlertProps {
|
|
3
4
|
type?: AlertType;
|
|
4
|
-
title
|
|
5
|
+
title?: string;
|
|
5
6
|
showIcon?: boolean;
|
|
7
|
+
children?: React.ReactNode;
|
|
6
8
|
}
|
|
7
|
-
export default function Alert({ type, title, showIcon }: AlertProps): JSX.Element;
|
|
9
|
+
export default function Alert({ type, title, showIcon, children, }: AlertProps): JSX.Element;
|
|
8
10
|
export {};
|
|
@@ -39,10 +39,11 @@ const StyledAlertContainer = styled(FlexBox).attrs((p) => ({
|
|
|
39
39
|
flex-direction: row;
|
|
40
40
|
align-items: center;
|
|
41
41
|
`;
|
|
42
|
-
export default function Alert({ type = "info", title, showIcon = true }) {
|
|
42
|
+
export default function Alert({ type = "info", title, showIcon = true, children, }) {
|
|
43
43
|
const theme = useTheme();
|
|
44
44
|
const textColor = getColor(theme, alertColors[type || "info"].color);
|
|
45
45
|
return (React.createElement(StyledAlertContainer, { type: type },
|
|
46
46
|
showIcon && !!icons[type] && (React.createElement(StyledIconContainer, null, icons[type || "info"]({ size: 20, color: textColor }))),
|
|
47
|
-
React.createElement(Text, { color: textColor, flexShrink: 1 }, title))
|
|
47
|
+
title && (React.createElement(Text, { color: textColor, flexShrink: 1 }, title)),
|
|
48
|
+
children));
|
|
48
49
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FlexBoxProps } from "../../Layout/Flex";
|
|
3
|
+
export interface TagProps extends FlexBoxProps {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export default function Tag({ active, children, ...props }: TagProps): JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import Flex from "../../Layout/Flex";
|
|
14
|
+
import Text from "../../Text";
|
|
15
|
+
export default function Tag(_a) {
|
|
16
|
+
var { active, children } = _a, props = __rest(_a, ["active", "children"]);
|
|
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)));
|
|
19
|
+
}
|
package/components/tags/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Ledger Live - Desktop UI",
|
|
5
5
|
"repository": "https://github.com/LedgerHQ/ui",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"index.js"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@ledgerhq/icons-ui": "^0.2.
|
|
18
|
+
"@ledgerhq/icons-ui": "^0.2.3",
|
|
19
19
|
"@ledgerhq/ui-shared": "^0.1.5",
|
|
20
20
|
"@types/color": "^3.0.2",
|
|
21
21
|
"@types/react": "^17.0.37",
|