@ledgerhq/native-ui 0.34.1 → 0.35.0-next.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/TabSelector/index.d.ts.map +1 -1
- package/lib/components/Form/TabSelector/index.js +9 -7
- package/lib/components/cta/QuickAction/QuickActionButton/index.js +1 -1
- package/lib/components/cta/QuickAction/QuickActionList/index.d.ts.map +1 -1
- package/lib/components/cta/QuickAction/QuickActionList/index.js +9 -2
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/TabSelector/index.tsx"],"names":[],"mappings":";AA8BA,KAAK,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;IACxC,MAAM,EAAE;QAAE,EAAE,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,EACpD,MAAM,EACN,UAAU,EACV,QAAQ,EACR,aAAqB,GACtB,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Form/TabSelector/index.tsx"],"names":[],"mappings":";AA8BA,KAAK,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;IACxC,MAAM,EAAE;QAAE,EAAE,EAAE,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnC,UAAU,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,EACpD,MAAM,EACN,UAAU,EACV,QAAQ,EACR,aAAqB,GACtB,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,CAyEnC"}
|
|
@@ -14,13 +14,13 @@ const Container = styled(Flex) `
|
|
|
14
14
|
const AnimatedBackground = styled(Animated.View) `
|
|
15
15
|
position: absolute;
|
|
16
16
|
height: 100%;
|
|
17
|
-
border-radius:
|
|
17
|
+
border-radius: ${({ $radius }) => $radius}px;
|
|
18
18
|
background-color: ${({ theme }) => theme.colors.opacityDefault.c05};
|
|
19
19
|
`;
|
|
20
20
|
const Tab = styled(Flex) `
|
|
21
21
|
flex: 1;
|
|
22
22
|
padding: 4px;
|
|
23
|
-
border-radius:
|
|
23
|
+
border-radius: ${({ $radius }) => $radius}px;
|
|
24
24
|
align-items: center;
|
|
25
25
|
justify-content: center;
|
|
26
26
|
`;
|
|
@@ -59,12 +59,14 @@ export default function TabSelector({ labels, initialTab, onToggle, filledVarian
|
|
|
59
59
|
border: 1,
|
|
60
60
|
borderColor: "opacityDefault.c10",
|
|
61
61
|
};
|
|
62
|
+
const tabRadius = filledVariant ? 12 : 8;
|
|
62
63
|
return (React.createElement(Box, { height: "100%", width: "100%", borderRadius: 12, bg: boxStyles.bg, p: boxStyles.p, border: boxStyles.border, borderColor: boxStyles.borderColor },
|
|
63
64
|
React.createElement(Container, { onLayout: handleLayout },
|
|
64
|
-
React.createElement(AnimatedBackground, { style: animatedStyle }),
|
|
65
|
-
labels.map((label, index) => (React.createElement(Pressable, { hitSlop: 6, key: label.id, onPress: () => handlePress(label.id, index), style: ({ pressed }) =>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
React.createElement(AnimatedBackground, { style: animatedStyle, "$radius": tabRadius }),
|
|
66
|
+
labels.map((label, index) => (React.createElement(Pressable, { hitSlop: 6, key: label.id, onPress: () => handlePress(label.id, index), style: ({ pressed }) => ({
|
|
67
|
+
opacity: pressed && selectedIndex !== index ? 0.5 : 1,
|
|
68
|
+
flex: 1,
|
|
69
|
+
}) },
|
|
70
|
+
React.createElement(Tab, { "$radius": tabRadius },
|
|
69
71
|
React.createElement(Text, { fontSize: 14, fontWeight: "semiBold", flexShrink: 1, numberOfLines: 1 }, label.value))))))));
|
|
70
72
|
}
|
|
@@ -31,7 +31,7 @@ const QuickActionButton = ({ Icon, children, disabled, onPress, onPressWhenDisab
|
|
|
31
31
|
React.isValidElement(children) && children.props?.i18nKey
|
|
32
32
|
? children.props.i18nKey.split(".").pop() // Extract the last part of the key
|
|
33
33
|
: children?.toString().toLowerCase();
|
|
34
|
-
return (React.createElement(Base, { disabled: onPressWhenDisabled ? false : disabled, onPress: disabled ? onPressWhenDisabled : onPress, visuallyDisabled: disabled, variant: variant, isActive:
|
|
34
|
+
return (React.createElement(Base, { disabled: onPressWhenDisabled ? false : disabled, onPress: disabled ? onPressWhenDisabled : onPress, visuallyDisabled: disabled, variant: variant, isActive: isActive, ...otherProps, testID: `${testID}-${text}` },
|
|
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
|
};
|
|
@@ -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,
|
|
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,EAAQ,MAAM,cAAc,CAAC;AAE7D,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;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,QAAA,MAAM,eAAe,8DAOlB,oBAAoB,KAAG,MAAM,YA6B/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
|
-
import { FlatList } from "react-native";
|
|
2
|
+
import { FlatList, View } from "react-native";
|
|
3
3
|
import QuickActionButton from "../QuickActionButton";
|
|
4
4
|
const QuickActionList = ({ numColumns = 3, data, id, testID, isActive = false, ...otherProps }) => {
|
|
5
5
|
const renderItem = useCallback(({ item, index }) => {
|
|
6
|
-
|
|
6
|
+
const isNotLastColumn = (index + 1) % numColumns > 0;
|
|
7
|
+
const isNotLastItem = data && index !== data.length - 1;
|
|
8
|
+
const hasButtonToItsRight = isNotLastColumn && isNotLastItem;
|
|
9
|
+
const hasRowBelow = data?.length && index + numColumns < data.length;
|
|
10
|
+
const mr = hasButtonToItsRight ? 4 : 0;
|
|
11
|
+
const mb = hasRowBelow ? 4 : 0;
|
|
12
|
+
return (React.createElement(View, { style: { flex: 1, minHeight: 30 } },
|
|
13
|
+
React.createElement(QuickActionButton, { ...item, isActive: isActive, mr: mr, mb: mb, testID: testID })));
|
|
7
14
|
}, []);
|
|
8
15
|
return (React.createElement(FlatList, { ...otherProps, data: data, keyExtractor: (_item, index) => `${id}${index}`, horizontal: false, renderItem: renderItem, numColumns: numColumns }));
|
|
9
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0-next.0",
|
|
4
4
|
"description": "Ledger Live - Mobile UI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"rn-range-slider": "2.1.1",
|
|
41
41
|
"styled-system": "^5.1.5",
|
|
42
42
|
"@ledgerhq/crypto-icons-ui": "^1.14.0",
|
|
43
|
-
"@ledgerhq/ui
|
|
44
|
-
"@ledgerhq/
|
|
43
|
+
"@ledgerhq/icons-ui": "^0.10.0",
|
|
44
|
+
"@ledgerhq/ui-shared": "^0.3.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": ">=17",
|