@ledgerhq/native-ui 0.26.1 → 0.27.0-nightly.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/lib/components/Form/DrawerTabSelector/index.d.ts +12 -0
- package/lib/components/Form/DrawerTabSelector/index.d.ts.map +1 -0
- package/lib/components/Form/DrawerTabSelector/index.js +61 -0
- package/lib/components/Form/TabSelector/index.d.ts +5 -9
- package/lib/components/Form/TabSelector/index.d.ts.map +1 -1
- package/lib/components/Form/TabSelector/index.js +44 -50
- package/lib/components/Form/index.d.ts +1 -0
- package/lib/components/Form/index.d.ts.map +1 -1
- package/lib/components/Form/index.js +1 -0
- package/lib/components/cta/QuickAction/QuickActionButton/index.d.ts +1 -1
- package/lib/components/cta/QuickAction/QuickActionButton/index.d.ts.map +1 -1
- package/lib/components/cta/QuickAction/QuickActionButton/index.js +2 -2
- package/lib/components/cta/QuickAction/QuickActionList/index.d.ts +2 -1
- package/lib/components/cta/QuickAction/QuickActionList/index.d.ts.map +1 -1
- package/lib/components/cta/QuickAction/QuickActionList/index.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface TabSelectorProps<T extends string | number> {
|
|
3
|
+
options: T[];
|
|
4
|
+
selectedOption: T;
|
|
5
|
+
handleSelectOption: (option: T) => void;
|
|
6
|
+
labels: {
|
|
7
|
+
[key in T]: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export default function DrawerTabSelector<T extends string | number>({ options, selectedOption, handleSelectOption, labels, }: TabSelectorProps<T>): JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/DrawerTabSelector/index.tsx"],"names":[],"mappings":";AAwDA,UAAU,gBAAgB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IAClD,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,cAAc,EAAE,CAAC,CAAC;IAClB,kBAAkB,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE;SAAG,GAAG,IAAI,CAAC,GAAG,MAAM;KAAE,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EACnE,OAAO,EACP,cAAc,EACd,kBAAkB,EAClB,MAAM,GACP,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CA4DnC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
|
+
import Text from "../../Text";
|
|
3
|
+
import Flex from "../../Layout/Flex";
|
|
4
|
+
import styled, { useTheme } from "styled-components/native";
|
|
5
|
+
import { TouchableOpacity } from "react-native";
|
|
6
|
+
import Animated, { useSharedValue, useAnimatedStyle, withSpring } from "react-native-reanimated";
|
|
7
|
+
const StyledTouchableOpacity = styled(TouchableOpacity) `
|
|
8
|
+
width: ${(p) => p.width}px;
|
|
9
|
+
flex: 1;
|
|
10
|
+
height: 100%;
|
|
11
|
+
`;
|
|
12
|
+
const StyledFlex = styled(Flex) `
|
|
13
|
+
height: 100%;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
align-items: center;
|
|
16
|
+
`;
|
|
17
|
+
const StyledText = styled(Text) `
|
|
18
|
+
line-height: 14.52px;
|
|
19
|
+
overflow: visible;
|
|
20
|
+
text-align: center;
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
color: ${(p) => p.isSelected ? p.theme.colors.constant.black : p.theme.colors.opacityDefault.c50};
|
|
23
|
+
`;
|
|
24
|
+
const OptionButton = ({ option, selectedOption, handleSelectOption, label, width, }) => {
|
|
25
|
+
const isSelected = selectedOption === option;
|
|
26
|
+
return (React.createElement(StyledTouchableOpacity, { width: width, onPress: () => handleSelectOption(option) },
|
|
27
|
+
React.createElement(StyledFlex, { isSelected: isSelected },
|
|
28
|
+
React.createElement(StyledText, { fontWeight: "semiBold", isSelected: isSelected, numberOfLines: 1 }, label))));
|
|
29
|
+
};
|
|
30
|
+
export default function DrawerTabSelector({ options, selectedOption, handleSelectOption, labels, }) {
|
|
31
|
+
const { colors } = useTheme();
|
|
32
|
+
const longuestLabel = labels[options[0]].length > labels[options[1]].length ? options[0] : options[1];
|
|
33
|
+
const widthFactor = 8;
|
|
34
|
+
const margin = 20;
|
|
35
|
+
const width = labels[longuestLabel].length * widthFactor + margin;
|
|
36
|
+
const semiWidth = width / 2;
|
|
37
|
+
const translateX = useSharedValue(-semiWidth);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
translateX.value = withSpring(selectedOption === options[0] ? -semiWidth : semiWidth, {
|
|
40
|
+
damping: 30,
|
|
41
|
+
stiffness: 80,
|
|
42
|
+
});
|
|
43
|
+
}, [selectedOption, translateX, options]);
|
|
44
|
+
const animatedStyle = useAnimatedStyle(() => {
|
|
45
|
+
return {
|
|
46
|
+
transform: [{ translateX: translateX.value }],
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
return (React.createElement(Flex, { flexDirection: "row", justifyContent: "center", alignItems: "center", width: width * 2 + 4, height: "35px", borderRadius: "40px", bg: colors.opacityDefault.c05, position: "relative" },
|
|
50
|
+
React.createElement(Animated.View, { style: [
|
|
51
|
+
{
|
|
52
|
+
position: "absolute",
|
|
53
|
+
width: width - 2,
|
|
54
|
+
height: "90%",
|
|
55
|
+
backgroundColor: colors.primary.c80,
|
|
56
|
+
borderRadius: 40,
|
|
57
|
+
},
|
|
58
|
+
animatedStyle,
|
|
59
|
+
] }),
|
|
60
|
+
options.map((option) => (React.createElement(OptionButton, { width: width, key: option, option: option, selectedOption: selectedOption, handleSelectOption: handleSelectOption, label: labels[option] })))));
|
|
61
|
+
}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[key in T]: string;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
export default function TabSelector<T extends string | number>({ options, selectedOption, handleSelectOption, labels, }: TabSelectorProps<T>): JSX.Element;
|
|
2
|
+
type TabSelectorProps = {
|
|
3
|
+
labels: string[];
|
|
4
|
+
onToggle: (value: string) => void;
|
|
5
|
+
};
|
|
6
|
+
export default function TabSelector({ labels, onToggle }: TabSelectorProps): JSX.Element;
|
|
11
7
|
export {};
|
|
12
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/TabSelector/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/TabSelector/index.tsx"],"names":[],"mappings":";AA8BA,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAqDvF"}
|
|
@@ -1,61 +1,55 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Pressable } from "react-native";
|
|
3
|
+
import Animated, { useSharedValue, useAnimatedStyle, withTiming } from "react-native-reanimated";
|
|
4
|
+
import styled from "styled-components/native";
|
|
3
5
|
import Flex from "../../Layout/Flex";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
const StyledTouchableOpacity = styled(TouchableOpacity) `
|
|
8
|
-
width: ${(p) => p.width}px;
|
|
9
|
-
flex: 1;
|
|
6
|
+
import Text from "../../Text";
|
|
7
|
+
import Box from "../../Layout/Box";
|
|
8
|
+
const Container = styled(Flex) `
|
|
10
9
|
height: 100%;
|
|
10
|
+
justify-content: space-between;
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
position: relative;
|
|
11
13
|
`;
|
|
12
|
-
const
|
|
14
|
+
const AnimatedBackground = styled(Animated.View) `
|
|
15
|
+
position: absolute;
|
|
13
16
|
height: 100%;
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
border-radius: 8px;
|
|
18
|
+
background-color: ${({ theme }) => theme.colors.opacityDefault.c05};
|
|
16
19
|
`;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const Tab = styled(Flex) `
|
|
21
|
+
flex: 1;
|
|
22
|
+
padding: 4px;
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
23
26
|
`;
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
translateX.value = withSpring(selectedOption === options[0] ? -semiWidth : semiWidth, {
|
|
40
|
-
damping: 30,
|
|
41
|
-
stiffness: 80,
|
|
42
|
-
});
|
|
43
|
-
}, [selectedOption, translateX, options]);
|
|
27
|
+
export default function TabSelector({ labels, onToggle }) {
|
|
28
|
+
const translateX = useSharedValue(0);
|
|
29
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
30
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
31
|
+
const handlePress = (value, index) => {
|
|
32
|
+
setSelectedIndex(index);
|
|
33
|
+
translateX.value = (containerWidth / labels.length) * index;
|
|
34
|
+
if (selectedIndex !== index)
|
|
35
|
+
onToggle(value);
|
|
36
|
+
};
|
|
37
|
+
const handleLayout = (event) => {
|
|
38
|
+
const { width } = event.nativeEvent.layout;
|
|
39
|
+
setContainerWidth(width);
|
|
40
|
+
};
|
|
44
41
|
const animatedStyle = useAnimatedStyle(() => {
|
|
45
42
|
return {
|
|
46
|
-
transform: [{ translateX: translateX.value }],
|
|
43
|
+
transform: [{ translateX: withTiming(translateX.value, { duration: 250 }) }],
|
|
44
|
+
width: containerWidth / labels.length,
|
|
47
45
|
};
|
|
48
46
|
});
|
|
49
|
-
return (React.createElement(
|
|
50
|
-
React.createElement(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
animatedStyle,
|
|
59
|
-
] }),
|
|
60
|
-
options.map((option) => (React.createElement(OptionButton, { width: width, key: option, option: option, selectedOption: selectedOption, handleSelectOption: handleSelectOption, label: labels[option] })))));
|
|
47
|
+
return (React.createElement(Box, { height: "100%", width: "100%", borderRadius: 12, border: 1, borderColor: "opacityDefault.c10", p: 2 },
|
|
48
|
+
React.createElement(Container, { onLayout: handleLayout },
|
|
49
|
+
React.createElement(AnimatedBackground, { style: animatedStyle }),
|
|
50
|
+
labels.map((label, index) => (React.createElement(Pressable, { hitSlop: 6, key: label, onPress: () => handlePress(label, index), style: ({ pressed }) => [
|
|
51
|
+
{ opacity: pressed && selectedIndex !== index ? 0.5 : 1, flex: 1 },
|
|
52
|
+
] },
|
|
53
|
+
React.createElement(Tab, null,
|
|
54
|
+
React.createElement(Text, { fontSize: 14, fontWeight: "semiBold", flexShrink: 1, numberOfLines: 1 }, label))))))));
|
|
61
55
|
}
|
|
@@ -4,5 +4,6 @@ export { default as Slider } from "./Slider";
|
|
|
4
4
|
export { default as Switch } from "./Switch";
|
|
5
5
|
export { default as Toggle } from "./Toggle";
|
|
6
6
|
export { default as SelectableList } from "./SelectableList";
|
|
7
|
+
export { default as DrawerTabSelector } from "./DrawerTabSelector";
|
|
7
8
|
export { default as TabSelector } from "./TabSelector";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -4,4 +4,5 @@ export { default as Slider } from "./Slider";
|
|
|
4
4
|
export { default as Switch } from "./Switch";
|
|
5
5
|
export { default as Toggle } from "./Toggle";
|
|
6
6
|
export { default as SelectableList } from "./SelectableList";
|
|
7
|
+
export { default as DrawerTabSelector } from "./DrawerTabSelector";
|
|
7
8
|
export { default as TabSelector } from "./TabSelector";
|
|
@@ -16,6 +16,6 @@ export declare const Base: import("styled-components").StyledComponent<typeof To
|
|
|
16
16
|
visuallyDisabled?: boolean | undefined;
|
|
17
17
|
variant: Variant;
|
|
18
18
|
}, never>;
|
|
19
|
-
declare const QuickActionButton: ({ Icon, children, disabled, onPress, onPressWhenDisabled, textVariant, variant, ...otherProps }: QuickActionButtonProps) => React.ReactElement;
|
|
19
|
+
declare const QuickActionButton: ({ Icon, children, disabled, onPress, onPressWhenDisabled, textVariant, variant, testID, ...otherProps }: QuickActionButtonProps) => React.ReactElement;
|
|
20
20
|
export default QuickActionButton;
|
|
21
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/cta/QuickAction/QuickActionButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,KAAK,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjC,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,GACxD,eAAe,GAAG;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACvD,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEJ,eAAO,MAAM,UAAU,oNAGtB,CAAC;AAEF,eAAO,MAAM,IAAI;;aACgD,OAAO;SAcvE,CAAC;AAEF,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/cta/QuickAction/QuickActionButton/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAmB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,KAAK,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjC,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,GACxD,eAAe,GAAG;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB,CAAC,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACvD,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEJ,eAAO,MAAM,UAAU,oNAGtB,CAAC;AAEF,eAAO,MAAM,IAAI;;aACgD,OAAO;SAcvE,CAAC;AAEF,QAAA,MAAM,iBAAiB,4GAUpB,sBAAsB,KAAG,MAAM,YAyBjC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -30,8 +30,8 @@ export const Base = baseStyled(TouchableOpacity) `
|
|
|
30
30
|
: `background-color: ${theme.colors.neutral.c20};`}
|
|
31
31
|
`;
|
|
32
32
|
const QuickActionButton = (_a) => {
|
|
33
|
-
var { Icon, children, disabled, onPress, onPressWhenDisabled, textVariant = "body", variant = "large" } = _a, otherProps = __rest(_a, ["Icon", "children", "disabled", "onPress", "onPressWhenDisabled", "textVariant", "variant"]);
|
|
34
|
-
return (React.createElement(Base, Object.assign({ disabled: onPressWhenDisabled ? false : disabled, onPress: disabled ? onPressWhenDisabled : onPress, visuallyDisabled: disabled, variant: variant }, otherProps),
|
|
33
|
+
var { Icon, children, disabled, onPress, onPressWhenDisabled, textVariant = "body", variant = "large", testID } = _a, otherProps = __rest(_a, ["Icon", "children", "disabled", "onPress", "onPressWhenDisabled", "textVariant", "variant", "testID"]);
|
|
34
|
+
return (React.createElement(Base, Object.assign({ disabled: onPressWhenDisabled ? false : disabled, onPress: disabled ? onPressWhenDisabled : onPress, visuallyDisabled: disabled, variant: variant }, otherProps, { testID: `${testID}-${children}` }),
|
|
35
35
|
React.createElement(Icon, { size: variant === "small" ? 20 : 24, color: disabled ? "neutral.c50" : "neutral.c100" }),
|
|
36
36
|
React.createElement(StyledText, { numberOfLines: 1, variant: textVariant, fontWeight: "semiBold", color: disabled ? "neutral.c50" : "neutral.c100", mt: 2 }, children)));
|
|
37
37
|
};
|
|
@@ -3,7 +3,8 @@ import { FlatListProps } from "react-native";
|
|
|
3
3
|
import { QuickActionButtonProps } from "../QuickActionButton";
|
|
4
4
|
export type QuickActionListProps = Omit<FlatListProps<QuickActionButtonProps>, "renderItem"> & {
|
|
5
5
|
id: string;
|
|
6
|
+
testID?: string;
|
|
6
7
|
};
|
|
7
|
-
declare const QuickActionList: ({ numColumns, data, id, ...otherProps }: QuickActionListProps) => React.ReactElement;
|
|
8
|
+
declare const QuickActionList: ({ numColumns, data, id, testID, ...otherProps }: QuickActionListProps) => React.ReactElement;
|
|
8
9
|
export default QuickActionList;
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/cta/QuickAction/QuickActionList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAY,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvD,OAA0B,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEjF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC,EAAE,YAAY,CAAC,GAAG;IAC7F,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/cta/QuickAction/QuickActionList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAY,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvD,OAA0B,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAEjF,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC,EAAE,YAAY,CAAC,GAAG;IAC7F,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,QAAA,MAAM,eAAe,oDAMlB,oBAAoB,KAAG,MAAM,YA0B/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -13,9 +13,9 @@ import React, { useCallback } from "react";
|
|
|
13
13
|
import { FlatList } from "react-native";
|
|
14
14
|
import QuickActionButton from "../QuickActionButton";
|
|
15
15
|
const QuickActionList = (_a) => {
|
|
16
|
-
var { numColumns = 3, data, id } = _a, otherProps = __rest(_a, ["numColumns", "data", "id"]);
|
|
16
|
+
var { numColumns = 3, data, id, testID } = _a, otherProps = __rest(_a, ["numColumns", "data", "id", "testID"]);
|
|
17
17
|
const renderItem = useCallback(({ item, index }) => {
|
|
18
|
-
return (React.createElement(QuickActionButton, Object.assign({}, item, { flex: 1, mr: (index + 1) % numColumns > 0 && data && index !== data.length - 1 ? 4 : 0, mb: (data === null || data === void 0 ? void 0 : data.length) && index + numColumns < data.length ? 4 : 0 })));
|
|
18
|
+
return (React.createElement(QuickActionButton, Object.assign({}, item, { flex: 1, mr: (index + 1) % numColumns > 0 && data && index !== data.length - 1 ? 4 : 0, mb: (data === null || data === void 0 ? void 0 : data.length) && index + numColumns < data.length ? 4 : 0, testID: testID })));
|
|
19
19
|
}, []);
|
|
20
20
|
return (React.createElement(FlatList, Object.assign({}, otherProps, { data: data, keyExtractor: (_item, index) => `${id}${index}`, horizontal: false, renderItem: renderItem, numColumns: numColumns })));
|
|
21
21
|
};
|