@ledgerhq/native-ui 0.2.0 → 0.6.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.
- package/README.md +16 -18
- package/assets/logos/LedgerLiveAltRegular.d.ts +0 -1
- package/assets/logos/LedgerLiveRegular.d.ts +0 -1
- package/components/Carousel/index.d.ts +45 -0
- package/components/Carousel/index.js +76 -0
- package/components/Form/Checkbox/index.d.ts +2 -2
- package/components/Form/Checkbox/index.js +5 -5
- package/components/Form/Input/BaseInput/index.d.ts +104 -7
- package/components/Form/Input/BaseInput/index.js +25 -17
- package/components/Form/Input/LegendInput/index.d.ts +14 -3
- package/components/Form/Input/LegendInput/index.js +4 -3
- package/components/Form/Input/NumberInput/index.d.ts +16 -5
- package/components/Form/Input/NumberInput/index.js +17 -9
- package/components/Form/Input/QrCodeInput/index.d.ts +15 -4
- package/components/Form/Input/QrCodeInput/index.js +5 -4
- package/components/Form/Input/SearchInput/index.d.ts +13 -2
- package/components/Form/Input/SearchInput/index.js +4 -3
- package/components/Form/SelectableList.d.ts +22 -0
- package/components/Form/SelectableList.js +31 -0
- package/components/Form/Slider/components.js +6 -6
- package/components/Form/Slider/index.d.ts +0 -1
- package/components/Form/Slider/index.native.d.ts +0 -1
- package/components/Form/Slider/index.native.js +2 -2
- package/components/Form/Switch/index.d.ts +0 -1
- package/components/Form/Switch/index.js +4 -4
- package/components/Form/Toggle/index.d.ts +0 -1
- package/components/Form/index.d.ts +2 -0
- package/components/Form/index.js +2 -0
- package/components/Icon/IconBox/index.js +2 -2
- package/components/Layout/Box/index.d.ts +11 -0
- package/components/Layout/Box/index.js +3 -0
- package/components/Layout/Flex/index.d.ts +11 -12
- package/components/Layout/Flex/index.js +2 -8
- package/components/Layout/Modals/BaseModal/index.js +4 -4
- package/components/Layout/ScrollContainerHeader/Header.d.ts +0 -1
- package/components/Layout/ScrollContainerHeader/Header.js +1 -1
- package/components/Layout/index.d.ts +3 -0
- package/components/Layout/index.js +3 -0
- package/components/Loader/index.js +2 -2
- package/components/Navigation/FlowStepper/index.d.ts +64 -0
- package/components/Navigation/FlowStepper/index.js +38 -0
- package/components/Navigation/SlideIndicator/index.js +15 -8
- package/components/Navigation/Stepper/index.js +12 -12
- package/components/Navigation/index.d.ts +1 -0
- package/components/Navigation/index.js +1 -0
- package/components/ProgressBar/index.d.ts +15 -0
- package/components/ProgressBar/index.js +33 -0
- package/components/Tabs/Chip/index.d.ts +5 -0
- package/components/Tabs/Chip/index.js +20 -0
- package/components/Tabs/Graph/index.d.ts +5 -0
- package/components/Tabs/Graph/index.js +21 -0
- package/components/Tabs/TemplateTabs/index.d.ts +29 -0
- package/components/Tabs/TemplateTabs/index.js +14 -0
- package/components/Tabs/index.d.ts +2 -0
- package/components/Tabs/index.js +2 -0
- package/components/Text/index.js +2 -2
- package/components/chart/index.d.ts +0 -1
- package/components/chart/index.js +6 -6
- package/components/cta/Button/getButtonStyle.js +12 -12
- package/components/cta/Button/index.d.ts +4 -15
- package/components/cta/Button/index.js +13 -14
- package/components/cta/Link/getLinkStyle.js +8 -8
- package/components/index.d.ts +4 -1
- package/components/index.js +5 -1
- package/components/message/Alert/index.d.ts +0 -1
- package/components/message/Alert/index.js +6 -6
- package/components/{drawer → message}/Notification/index.d.ts +5 -4
- package/components/message/Notification/index.js +35 -0
- package/components/message/index.d.ts +1 -0
- package/components/message/index.js +1 -0
- package/components/styled.d.ts +15 -0
- package/components/styled.js +12 -0
- package/components/tags/Badge/index.js +7 -7
- package/components/transitions/Fade.d.ts +5 -0
- package/components/transitions/Fade.js +32 -0
- package/components/transitions/Slide.d.ts +11 -0
- package/components/transitions/Slide.js +49 -0
- package/components/transitions/Transition.d.ts +49 -0
- package/components/transitions/Transition.js +42 -0
- package/components/transitions/index.d.ts +4 -0
- package/components/transitions/index.js +4 -0
- package/components/transitions/types.d.ts +21 -0
- package/components/transitions/types.js +1 -0
- package/icons/Close.js +1 -1
- package/package.json +8 -10
- package/styles/InvertTheme.d.ts +0 -1
- package/styles/StyleProvider.js +1 -1
- package/styles/theme.d.ts +4 -1
- package/styles/theme.js +3 -3
- package/assets/fonts/.DS_Store +0 -0
- package/assets/fonts/alpha/.DS_Store +0 -0
- package/components/Navigation/ToggleGroup/index.d.ts +0 -15
- package/components/Navigation/ToggleGroup/index.js +0 -25
- package/components/drawer/Notification/index.js +0 -37
- package/components/drawer/index.d.ts +0 -1
- package/components/drawer/index.js +0 -1
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TextInput } from "react-native";
|
|
2
3
|
import { InputProps } from "../BaseInput";
|
|
3
|
-
|
|
4
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<import("../BaseInput").CommonProps, "onChange" | "value"> & {
|
|
5
|
+
value: string;
|
|
6
|
+
renderLeft?: React.ReactNode | ((props: InputProps<string>) => React.ReactNode);
|
|
7
|
+
renderRight?: React.ReactNode | ((props: InputProps<string>) => React.ReactNode);
|
|
8
|
+
onChange?: ((value: string) => void) | undefined;
|
|
9
|
+
onChangeEvent?: ((e: import("react-native").NativeSyntheticEvent<import("react-native").TextInputChangeEventData>) => void) | undefined;
|
|
10
|
+
serialize?: ((value: string) => string) | undefined;
|
|
11
|
+
deserialize?: ((value: string) => string) | undefined;
|
|
12
|
+
containerStyle?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
13
|
+
} & React.RefAttributes<TextInput>>;
|
|
14
|
+
export default _default;
|
|
@@ -3,9 +3,10 @@ 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.
|
|
6
|
+
color: p.theme.colors.neutral.c70,
|
|
7
7
|
})) ``;
|
|
8
|
-
|
|
9
|
-
return (React.createElement(Input, Object.assign({}, props, { renderLeft: React.createElement(InputRenderLeftContainer, null,
|
|
8
|
+
function SearchInput(props, ref) {
|
|
9
|
+
return (React.createElement(Input, Object.assign({ ref: ref }, props, { renderLeft: React.createElement(InputRenderLeftContainer, null,
|
|
10
10
|
React.createElement(Icon, null)) })));
|
|
11
11
|
}
|
|
12
|
+
export default React.forwardRef(SearchInput);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { GestureResponderEvent } from "react-native";
|
|
3
|
+
export declare type ElementProps<V> = React.PropsWithChildren<{
|
|
4
|
+
first?: boolean;
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
value?: V;
|
|
8
|
+
onPress?: ((event: GestureResponderEvent) => void) | undefined;
|
|
9
|
+
Icon?: (props: {
|
|
10
|
+
size?: number;
|
|
11
|
+
color?: string;
|
|
12
|
+
}) => React.ReactElement;
|
|
13
|
+
}>;
|
|
14
|
+
export declare type Props<V> = React.PropsWithChildren<{
|
|
15
|
+
currentValue?: V;
|
|
16
|
+
onChange: (newValue: V) => void;
|
|
17
|
+
}>;
|
|
18
|
+
declare function SelectableList<V>({ currentValue, onChange, children }: Props<V>): JSX.Element;
|
|
19
|
+
declare namespace SelectableList {
|
|
20
|
+
var Element: <V>({ first, value, selected, disabled, onPress, children, Icon, }: ElementProps<V>) => JSX.Element;
|
|
21
|
+
}
|
|
22
|
+
export default SelectableList;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableOpacity } from "react-native";
|
|
3
|
+
import styled from "styled-components/native";
|
|
4
|
+
import Flex from "../Layout/Flex";
|
|
5
|
+
import { Text } from "../index";
|
|
6
|
+
const ElementContainer = styled(Flex).attrs({
|
|
7
|
+
accessible: true,
|
|
8
|
+
accessibilityRole: "radio",
|
|
9
|
+
}) ``;
|
|
10
|
+
function Element({ first, value, selected, disabled, onPress, children, Icon, }) {
|
|
11
|
+
return (React.createElement(TouchableOpacity, { onPress: onPress, disabled: disabled },
|
|
12
|
+
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, flexDirection: "row", alignItems: "center" },
|
|
13
|
+
Icon && (React.createElement(Flex, { mr: 6 },
|
|
14
|
+
React.createElement(Icon, { size: 24, color: disabled ? "neutral.c50" : "neutral.c100" }))),
|
|
15
|
+
React.createElement(Text, { variant: "large", color: disabled ? "neutral.c50" : "neutral.c100" }, children || value))));
|
|
16
|
+
}
|
|
17
|
+
function SelectableList({ currentValue, onChange, children }) {
|
|
18
|
+
return (React.createElement(Flex, { accessible: true, accessibilityRole: "radiogroup" }, React.Children.map(children, (child, index) => {
|
|
19
|
+
if (!React.isValidElement(child))
|
|
20
|
+
return null;
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
const casted = child;
|
|
23
|
+
return React.cloneElement(casted, {
|
|
24
|
+
first: index === 0,
|
|
25
|
+
onPress: () => onChange(casted === null || casted === void 0 ? void 0 : casted.props.value),
|
|
26
|
+
selected: (casted === null || casted === void 0 ? void 0 : casted.props.value) === currentValue,
|
|
27
|
+
});
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
SelectableList.Element = Element;
|
|
31
|
+
export default SelectableList;
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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: "
|
|
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: "
|
|
24
|
-
React.createElement(Text, { variant: "small", fontWeight: "medium", color: "
|
|
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.
|
|
11
|
-
true: colors.
|
|
12
|
-
}, thumbColor: colors.
|
|
13
|
-
label ? (React.createElement(Text, { variant: "body", color: checked ? colors.
|
|
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;
|
|
@@ -2,3 +2,5 @@ export { default as Checkbox } from "./Checkbox";
|
|
|
2
2
|
export * from "./Input";
|
|
3
3
|
export { default as Slider } from "./Slider";
|
|
4
4
|
export { default as Switch } from "./Switch";
|
|
5
|
+
export { default as Toggle } from "./Toggle";
|
|
6
|
+
export { default as SelectableList } from "./SelectableList";
|
package/components/Form/index.js
CHANGED
|
@@ -2,3 +2,5 @@ export { default as Checkbox } from "./Checkbox";
|
|
|
2
2
|
export * from "./Input";
|
|
3
3
|
export { default as Slider } from "./Slider";
|
|
4
4
|
export { default as Switch } from "./Switch";
|
|
5
|
+
export { default as Toggle } from "./Toggle";
|
|
6
|
+
export { default as SelectableList } from "./SelectableList";
|
|
@@ -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.
|
|
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.
|
|
18
|
+
React.createElement(Icon, { size: iconSize, color: color || colors.neutral.c100 })));
|
|
19
19
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseStyledProps } from "../../styled";
|
|
2
|
+
export declare type BoxProps = BaseStyledProps;
|
|
3
|
+
declare const Box: 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>> & {
|
|
4
|
+
columnGap?: string | number | undefined;
|
|
5
|
+
rowGap?: string | number | undefined;
|
|
6
|
+
color?: string | undefined;
|
|
7
|
+
display?: string | undefined;
|
|
8
|
+
position?: string | undefined;
|
|
9
|
+
maxHeight?: number | undefined;
|
|
10
|
+
}, never>;
|
|
11
|
+
export default Box;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
declare const FlexBox: import("styled-components").StyledComponent<typeof import("react-native").View, import("styled-components").DefaultTheme, Props, never>;
|
|
1
|
+
import { BaseStyledProps } from "../../styled";
|
|
2
|
+
export declare type FlexBoxProps = BaseStyledProps;
|
|
3
|
+
export declare type Props = FlexBoxProps;
|
|
4
|
+
declare const FlexBox: 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>> & {
|
|
5
|
+
columnGap?: string | number | undefined;
|
|
6
|
+
rowGap?: string | number | undefined;
|
|
7
|
+
color?: string | undefined;
|
|
8
|
+
display?: string | undefined;
|
|
9
|
+
position?: string | undefined;
|
|
10
|
+
maxHeight?: number | undefined;
|
|
11
|
+
}, never>;
|
|
13
12
|
export default FlexBox;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
const FlexBox = styled.View `
|
|
1
|
+
import baseStyled from "../../styled";
|
|
2
|
+
const FlexBox = baseStyled.View `
|
|
4
3
|
display: flex;
|
|
5
|
-
${flexbox};
|
|
6
|
-
${space};
|
|
7
|
-
${background};
|
|
8
|
-
${color};
|
|
9
|
-
${layout};
|
|
10
4
|
`;
|
|
11
5
|
export default FlexBox;
|
|
@@ -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.
|
|
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: "
|
|
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: "
|
|
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.
|
|
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.
|
|
9
|
+
background-color: ${(p) => p.theme.colors.background.main};
|
|
10
10
|
width: 100%;
|
|
11
11
|
`;
|
|
12
12
|
const SCROLL_BREAKPOINT = 80;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export { default as Accordion } from "./Collapse/Accordion";
|
|
1
2
|
export { default as Flex } from "./Flex";
|
|
3
|
+
export { default as Box } from "./Box";
|
|
2
4
|
export * from "./Modals";
|
|
3
5
|
export { default as ScrollContainer } from "./ScrollContainer";
|
|
6
|
+
export { default as ScrollContainerHeader } from "./ScrollContainerHeader";
|
|
4
7
|
export { default as Row } from "./Table/Row";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export { default as Accordion } from "./Collapse/Accordion";
|
|
1
2
|
export { default as Flex } from "./Flex";
|
|
3
|
+
export { default as Box } from "./Box";
|
|
2
4
|
export * from "./Modals";
|
|
3
5
|
export { default as ScrollContainer } from "./ScrollContainer";
|
|
6
|
+
export { default as ScrollContainerHeader } from "./ScrollContainerHeader";
|
|
4
7
|
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.
|
|
14
|
-
const progressColor = colors.
|
|
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 },
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TransitionProps } from "../../transitions";
|
|
3
|
+
interface InnerProps {
|
|
4
|
+
/**
|
|
5
|
+
* The active index.
|
|
6
|
+
*/
|
|
7
|
+
activeIndex: number;
|
|
8
|
+
/**
|
|
9
|
+
* The total number of steps.
|
|
10
|
+
*/
|
|
11
|
+
stepsLength: number;
|
|
12
|
+
}
|
|
13
|
+
export interface RenderTransitionProps extends InnerProps, TransitionProps {
|
|
14
|
+
/**
|
|
15
|
+
* The index of the child.
|
|
16
|
+
*/
|
|
17
|
+
index: number;
|
|
18
|
+
/**
|
|
19
|
+
* The previously active index.
|
|
20
|
+
*/
|
|
21
|
+
previousActiveIndex: number | null;
|
|
22
|
+
}
|
|
23
|
+
export interface Props<ExtraProps> {
|
|
24
|
+
/**
|
|
25
|
+
* The index of the active step.
|
|
26
|
+
*/
|
|
27
|
+
activeIndex: number;
|
|
28
|
+
/**
|
|
29
|
+
* An optional header displayed above the progress bar.
|
|
30
|
+
*/
|
|
31
|
+
header?: (props: InnerProps & ExtraProps) => React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* An optional footer displayed below the body.
|
|
34
|
+
*/
|
|
35
|
+
footer?: (props: InnerProps & ExtraProps) => React.ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Extra props that are passed to the header and footer render functions.
|
|
38
|
+
*/
|
|
39
|
+
extraProps?: ExtraProps;
|
|
40
|
+
/**
|
|
41
|
+
* **Use this prop in combination with `transitionDuration`.**
|
|
42
|
+
*
|
|
43
|
+
* A render function wrapping every children which allows using transitions.
|
|
44
|
+
* This function is called with various useful arguments, most notably:
|
|
45
|
+
* - the child index
|
|
46
|
+
* - the current active index
|
|
47
|
+
* - the previous active index
|
|
48
|
+
* - the transition status ("entered", "entering", "exiting" or "exited")
|
|
49
|
+
*/
|
|
50
|
+
renderTransition?: (props: RenderTransitionProps) => JSX.Element | null;
|
|
51
|
+
/**
|
|
52
|
+
* **Use this prop in combination with `renderTransition`.**
|
|
53
|
+
*
|
|
54
|
+
* If this prop is true and if `renderTransition` is used
|
|
55
|
+
* then specifies the duration of the transition in milliseconds.
|
|
56
|
+
*/
|
|
57
|
+
transitionDuration?: number;
|
|
58
|
+
/**
|
|
59
|
+
* A list of children representing each step of the flow.
|
|
60
|
+
*/
|
|
61
|
+
children: React.ReactNode;
|
|
62
|
+
}
|
|
63
|
+
declare function FlowStepper<ExtraProps>({ activeIndex, header, footer, extraProps, renderTransition, transitionDuration, children, }: Props<ExtraProps>): JSX.Element;
|
|
64
|
+
export default FlowStepper;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from "react";
|
|
2
|
+
import { SafeAreaView } from "react-native";
|
|
3
|
+
import Flex from "../../Layout/Flex";
|
|
4
|
+
import ProgressBar from "../../ProgressBar";
|
|
5
|
+
import { Transition, } from "../../transitions";
|
|
6
|
+
function FlowStepper({ activeIndex, header, footer, extraProps, renderTransition, transitionDuration = 0, children, }) {
|
|
7
|
+
const previousActiveIndex = useRef(null);
|
|
8
|
+
const stepsLength = React.Children.count(children);
|
|
9
|
+
useEffect(() => () => {
|
|
10
|
+
previousActiveIndex.current = activeIndex;
|
|
11
|
+
}, [activeIndex]);
|
|
12
|
+
return (React.createElement(Flex, { flex: 1 },
|
|
13
|
+
header &&
|
|
14
|
+
header(Object.assign(Object.assign({}, extraProps), { activeIndex, stepsLength })),
|
|
15
|
+
React.createElement(SafeAreaView, { style: { flex: 1 } },
|
|
16
|
+
React.createElement(ProgressBar, { index: activeIndex, length: stepsLength }),
|
|
17
|
+
React.createElement(Flex, { flex: 1 }, React.Children.map(children, (child, index) => {
|
|
18
|
+
if (renderTransition && transitionDuration) {
|
|
19
|
+
return (React.createElement(Transition, { in: index === activeIndex, timeout: transitionDuration, mountOnEnter: true, unmountOnExit: true }, (status) => {
|
|
20
|
+
return renderTransition({
|
|
21
|
+
index,
|
|
22
|
+
activeIndex,
|
|
23
|
+
previousActiveIndex: previousActiveIndex.current,
|
|
24
|
+
stepsLength,
|
|
25
|
+
status,
|
|
26
|
+
duration: transitionDuration,
|
|
27
|
+
children: child,
|
|
28
|
+
});
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return index === activeIndex ? child : null;
|
|
33
|
+
}
|
|
34
|
+
})),
|
|
35
|
+
footer &&
|
|
36
|
+
footer(Object.assign(Object.assign({}, extraProps), { activeIndex, stepsLength })))));
|
|
37
|
+
}
|
|
38
|
+
export default FlowStepper;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
import styled from "styled-components/native";
|
|
3
|
-
import Animated, { useAnimatedStyle, Easing, withTiming, } from "react-native-reanimated";
|
|
3
|
+
import Animated, { useDerivedValue, useAnimatedStyle, Easing, withTiming, } from "react-native-reanimated";
|
|
4
4
|
const Container = styled.View `
|
|
5
5
|
flex-direction: row;
|
|
6
6
|
align-items: center;
|
|
@@ -8,15 +8,19 @@ const Container = styled.View `
|
|
|
8
8
|
height: 6px;
|
|
9
9
|
position: relative;
|
|
10
10
|
`;
|
|
11
|
-
const
|
|
11
|
+
const bulletStyle = `
|
|
12
12
|
width: 6px;
|
|
13
13
|
height: 6px;
|
|
14
14
|
border-radius: 6px;
|
|
15
15
|
margin: 0 6px;
|
|
16
|
-
background-color: ${(p) => p.theme.colors.palette.neutral.c40};
|
|
17
16
|
`;
|
|
18
|
-
const
|
|
19
|
-
|
|
17
|
+
const Bullet = styled.TouchableOpacity `
|
|
18
|
+
${bulletStyle}
|
|
19
|
+
background-color: ${(p) => p.theme.colors.neutral.c40};
|
|
20
|
+
`;
|
|
21
|
+
const ActiveBullet = styled.View.attrs({ pointerEvents: "none" }) `
|
|
22
|
+
${bulletStyle}
|
|
23
|
+
background-color: ${(p) => p.theme.colors.neutral.c100};
|
|
20
24
|
position: absolute;
|
|
21
25
|
top: 0;
|
|
22
26
|
left: 0;
|
|
@@ -28,10 +32,13 @@ const config = {
|
|
|
28
32
|
};
|
|
29
33
|
function SlideIndicator({ slidesLength, activeIndex = 0, onChange, }) {
|
|
30
34
|
const slidesArray = useMemo(() => new Array(slidesLength).fill(0), [slidesLength]);
|
|
31
|
-
const activeSize =
|
|
32
|
-
|
|
35
|
+
const activeSize = useDerivedValue(() => {
|
|
36
|
+
const size = (Math.max(0, Math.min(slidesLength - 1, activeIndex)) + 1) * (6 + 12) -
|
|
37
|
+
12;
|
|
38
|
+
return size;
|
|
39
|
+
}, [activeIndex, slidesLength]);
|
|
33
40
|
const animatedStyles = useAnimatedStyle(() => ({
|
|
34
|
-
width: withTiming(activeSize, config),
|
|
41
|
+
width: withTiming(activeSize.value, config),
|
|
35
42
|
}));
|
|
36
43
|
return (React.createElement(Container, null,
|
|
37
44
|
slidesArray.map((_, index) => (React.createElement(Bullet, { key: index, onPress: () => onChange(index) }))),
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
88
|
+
color: ${(p) => p.theme.colors.neutral.c100};
|
|
89
89
|
`;
|
|
90
90
|
const PendingText = styled(Text) `
|
|
91
|
-
color: ${(p) => p.theme.colors.
|
|
91
|
+
color: ${(p) => p.theme.colors.neutral.c70};
|
|
92
92
|
`;
|
|
93
93
|
const ErroredText = styled(Text) `
|
|
94
|
-
color: ${(p) => p.theme.colors.
|
|
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: "
|
|
113
|
-
React.createElement(StepIcon.Completed, { color: colors.
|
|
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: "
|
|
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: "
|
|
119
|
-
React.createElement(StepIcon.Errored, { color: colors.
|
|
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)));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FlexBoxProps } from "../Layout/Flex";
|
|
3
|
+
export interface Props extends FlexBoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* The index of the active step.
|
|
6
|
+
*/
|
|
7
|
+
index: number;
|
|
8
|
+
/**
|
|
9
|
+
* The total number of steps.
|
|
10
|
+
*/
|
|
11
|
+
length: number;
|
|
12
|
+
}
|
|
13
|
+
declare function ProgressBar({ index, length, ...props }: Props): JSX.Element;
|
|
14
|
+
declare const _default: React.MemoExoticComponent<typeof ProgressBar>;
|
|
15
|
+
export default _default;
|