@ledgerhq/native-ui 0.28.0 → 0.29.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/Cards/BannerCard/index.js +2 -2
- package/lib/components/Cards/InformativeCard/index.js +4 -4
- package/lib/components/Cards/NotificationCard/index.js +1 -1
- package/lib/components/Cards/SideImageCard/index.js +3 -3
- package/lib/components/Carousel/index.js +4 -4
- package/lib/components/Form/Input/AnimatedInput/AnimatedNotchedLabel.js +2 -2
- package/lib/components/Form/Input/AnimatedInput/index.js +4 -16
- package/lib/components/Form/Input/AnimatedInputSelect/index.js +3 -15
- package/lib/components/Form/Input/BaseInput/index.js +8 -19
- package/lib/components/Form/Input/LegendInput/index.js +3 -15
- package/lib/components/Form/Input/NumberInput/index.js +3 -15
- package/lib/components/Form/Input/QrCodeInput/index.js +3 -15
- package/lib/components/Form/Input/SearchInput/index.js +5 -17
- package/lib/components/Form/SelectableList.js +3 -3
- package/lib/components/Form/TabSelector/index.d.ts +5 -4
- package/lib/components/Form/TabSelector/index.d.ts.map +1 -1
- package/lib/components/Form/TabSelector/index.js +10 -4
- package/lib/components/Icon/BoxedIcon.js +2 -14
- package/lib/components/Icon/IconBadge.js +2 -14
- package/lib/components/Icon/IconBox/index.js +1 -1
- package/lib/components/Layout/Divider/index.js +2 -2
- package/lib/components/Layout/List/IconBoxList/index.js +6 -15
- package/lib/components/Layout/List/List/index.js +5 -18
- package/lib/components/Layout/List/NumberedList/index.js +6 -18
- package/lib/components/Layout/List/TipList/index.js +6 -15
- package/lib/components/Layout/List/VerticalStepper/StepperItem.js +8 -12
- package/lib/components/Layout/List/VerticalStepper/index.js +4 -16
- package/lib/components/Layout/List/VerticalTimeline/TimelineIndicator.js +2 -14
- package/lib/components/Layout/List/VerticalTimeline/TimelineItem.js +9 -13
- package/lib/components/Layout/List/VerticalTimeline/index.js +4 -16
- package/lib/components/Layout/Modals/BaseModal/index.js +2 -14
- package/lib/components/Layout/Modals/BottomDrawer/index.js +2 -14
- package/lib/components/Layout/Modals/Popin/index.js +2 -14
- package/lib/components/Layout/Modals/Tooltip/index.js +3 -15
- package/lib/components/Layout/ScrollContainer/index.js +1 -15
- package/lib/components/Layout/ScrollContainerHeader/index.js +3 -15
- package/lib/components/Layout/ScrollListContainer/index.js +2 -14
- package/lib/components/Layout/Table/Row.js +2 -14
- package/lib/components/Loader/InfiniteLoader/index.js +5 -15
- package/lib/components/Loader/ProgressLoader/index.js +1 -1
- package/lib/components/Navigation/FlowStepper/index.js +3 -3
- package/lib/components/Navigation/Stepper/index.js +4 -16
- package/lib/components/ProgressBar/index.js +3 -15
- package/lib/components/Tabs/Chip/index.js +3 -3
- package/lib/components/Tabs/Graph/index.js +1 -1
- package/lib/components/Tabs/TemplateTabs/index.js +2 -14
- package/lib/components/Text/getTextStyle.js +4 -2
- package/lib/components/Text/index.js +9 -25
- package/lib/components/cta/Button/getButtonStyle.js +10 -2
- package/lib/components/cta/Button/index.js +15 -20
- package/lib/components/cta/Link/index.js +2 -2
- package/lib/components/cta/QuickAction/QuickActionButton/index.d.ts.map +1 -1
- package/lib/components/cta/QuickAction/QuickActionButton/index.js +6 -14
- package/lib/components/cta/QuickAction/QuickActionList/index.js +3 -15
- package/lib/components/message/Alert/index.js +1 -1
- package/lib/components/message/Log/index.js +1 -1
- package/lib/components/message/Notification/index.js +15 -19
- package/lib/components/tags/Badge/index.js +3 -1
- package/lib/components/tags/Tag/index.js +2 -14
- package/lib/icons/BracketLeft.js +1 -1
- package/lib/icons/BracketRight.js +1 -1
- package/lib/styles/InvertTheme.js +5 -1
- package/lib/styles/StyleProvider.js +9 -1
- package/lib/styles/theme.js +4 -1
- package/package.json +2 -3
|
@@ -1,14 +1,3 @@
|
|
|
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
1
|
import React from "react";
|
|
13
2
|
import styled from "styled-components/native";
|
|
14
3
|
import FlexBox from "../../Layout/Flex";
|
|
@@ -20,9 +9,8 @@ export const TabsContainer = styled(FlexBox) `
|
|
|
20
9
|
align-items: stretch;
|
|
21
10
|
${(p) => (p.stretchItems ? "" : "justify-content: center;")}
|
|
22
11
|
`;
|
|
23
|
-
const TemplateTabsGroup = (
|
|
24
|
-
var { gap, size, stretchItems = false } = _a, props = __rest(_a, ["gap", "size", "stretchItems"]);
|
|
12
|
+
const TemplateTabsGroup = ({ gap, size, stretchItems = false, ...props }) => {
|
|
25
13
|
const { labels, activeIndex, onChange, Item } = props;
|
|
26
|
-
return (React.createElement(TabsContainer,
|
|
14
|
+
return (React.createElement(TabsContainer, { columnGap: gap, stretchItems: stretchItems, ...props }, labels.map((label, index) => (React.createElement(Item, { key: index, ...props, index: index, isActive: index === activeIndex, label: label, size: size, stretchItems: stretchItems, onPress: () => onChange(index) })))));
|
|
27
15
|
};
|
|
28
16
|
export default TemplateTabsGroup;
|
|
@@ -118,7 +118,9 @@ const getConcatenedFontWeightFontFamily = {
|
|
|
118
118
|
},
|
|
119
119
|
};
|
|
120
120
|
export function getTextStyle({ variant = "paragraph", bracket = false, fontWeight = "medium", }) {
|
|
121
|
-
var _a;
|
|
122
121
|
const style = getTextTypeStyle({ bracket })[variant];
|
|
123
|
-
return
|
|
122
|
+
return {
|
|
123
|
+
...style,
|
|
124
|
+
...getConcatenedFontWeightFontFamily[style?.fontFamily ?? "Inter"][fontWeight],
|
|
125
|
+
};
|
|
124
126
|
}
|
|
@@ -1,14 +1,3 @@
|
|
|
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
1
|
import React from "react";
|
|
13
2
|
import styled, { useTheme } from "styled-components/native";
|
|
14
3
|
import { compose, fontSize, textAlign, lineHeight, system, } from "styled-system";
|
|
@@ -28,13 +17,10 @@ const textTransform = system({
|
|
|
28
17
|
property: "textTransform",
|
|
29
18
|
},
|
|
30
19
|
});
|
|
31
|
-
const Base = baseStyled.Text.attrs((p) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
color: p.color || "neutral.c100",
|
|
36
|
-
});
|
|
37
|
-
}) `
|
|
20
|
+
const Base = baseStyled.Text.attrs((p) => ({
|
|
21
|
+
fontSize: p.fontSize ? p.fontSize : p.variant ?? "paragraph",
|
|
22
|
+
color: p.color || "neutral.c100",
|
|
23
|
+
})) `
|
|
38
24
|
${(p) => getTextStyle(p)}
|
|
39
25
|
${compose(lineHeight, fontSize, textAlign, uppercase, textTransform)}
|
|
40
26
|
justify-content: center;
|
|
@@ -45,20 +31,18 @@ const T = styled.View `
|
|
|
45
31
|
justify-content: center;
|
|
46
32
|
align-items: center;
|
|
47
33
|
`;
|
|
48
|
-
const BracketText = (
|
|
49
|
-
var { children, color = "neutral.c100" } = _a, props = __rest(_a, ["children", "color"]);
|
|
34
|
+
const BracketText = ({ children, color = "neutral.c100", ...props }) => {
|
|
50
35
|
const size = getBracketSize(props);
|
|
51
36
|
const theme = useTheme();
|
|
52
37
|
const c = theme ? getColor(theme, color) : "transparent";
|
|
53
38
|
return (React.createElement(T, null,
|
|
54
39
|
React.createElement(BracketLeft, { fill: c, width: size, height: size }),
|
|
55
|
-
React.createElement(Base,
|
|
40
|
+
React.createElement(Base, { ...props, color: color, bracket: true }, children),
|
|
56
41
|
React.createElement(BracketRight, { fill: c, width: size, height: size })));
|
|
57
42
|
};
|
|
58
|
-
const Text = (
|
|
59
|
-
var { children, bracket, textAlign = "left", testID } = _a, props = __rest(_a, ["children", "bracket", "textAlign", "testID"]);
|
|
43
|
+
const Text = ({ children, bracket, textAlign = "left", testID, ...props }) => {
|
|
60
44
|
if (bracket)
|
|
61
|
-
return React.createElement(BracketText,
|
|
62
|
-
return (React.createElement(Base,
|
|
45
|
+
return React.createElement(BracketText, { ...props }, children);
|
|
46
|
+
return (React.createElement(Base, { textAlign: textAlign, ...props, testID: testID }, children));
|
|
63
47
|
};
|
|
64
48
|
export default Text;
|
|
@@ -49,13 +49,21 @@ export function getButtonColorStyle(colors, props) {
|
|
|
49
49
|
if (outline) {
|
|
50
50
|
return {
|
|
51
51
|
text: { color: disabled ? primaryColor : secondaryColor },
|
|
52
|
-
button:
|
|
52
|
+
button: {
|
|
53
|
+
backgroundColor: "transparent",
|
|
54
|
+
borderColor: disabled ? primaryColor : tertiaryColor ?? secondaryColor,
|
|
55
|
+
borderWidth: 1,
|
|
56
|
+
...(pressedOutlineColor && { underlayColor: pressedOutlineColor }),
|
|
57
|
+
},
|
|
53
58
|
};
|
|
54
59
|
}
|
|
55
60
|
else {
|
|
56
61
|
return {
|
|
57
62
|
text: { color: primaryColor },
|
|
58
|
-
button:
|
|
63
|
+
button: {
|
|
64
|
+
backgroundColor: secondaryColor,
|
|
65
|
+
...(pressedColor && { underlayColor: pressedColor }),
|
|
66
|
+
},
|
|
59
67
|
};
|
|
60
68
|
}
|
|
61
69
|
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import React, { useCallback, useState, useMemo } from "react";
|
|
11
2
|
import styled, { useTheme } from "styled-components/native";
|
|
12
3
|
import { ActivityIndicator, TouchableOpacity, View, } from "react-native";
|
|
@@ -24,10 +15,14 @@ export const Base = baseStyled(TouchableOpacity).attrs((p) => {
|
|
|
24
15
|
const disabled = !p.onPressWhenDisabled && p.disabled;
|
|
25
16
|
const visuallyDisabled = p.onPressWhenDisabled && p.disabled;
|
|
26
17
|
const onPress = visuallyDisabled ? p.onPressWhenDisabled : p.onPress;
|
|
27
|
-
return
|
|
18
|
+
return {
|
|
19
|
+
...getButtonColorStyle(p.theme.colors, p).button,
|
|
28
20
|
// Avoid conflict with styled-system's size property by nulling size and renaming it
|
|
29
|
-
size: undefined,
|
|
30
|
-
|
|
21
|
+
size: undefined,
|
|
22
|
+
sizeVariant: p.size,
|
|
23
|
+
disabled,
|
|
24
|
+
onPress,
|
|
25
|
+
};
|
|
31
26
|
}) `
|
|
32
27
|
|
|
33
28
|
border-radius: ${(p) => p.theme.space[10]}px;
|
|
@@ -75,7 +70,7 @@ const ButtonContainer = (props) => {
|
|
|
75
70
|
}, [iconName, size, Icon, text.color, isNewIcon]);
|
|
76
71
|
const textColor = useMemo(() => (pending ? theme.colors.neutral.c50 : text.color), [pending, theme.colors.neutral.c50, text.color]);
|
|
77
72
|
return (React.createElement(Container, { hide: hide },
|
|
78
|
-
iconPosition === "right" && children ? (React.createElement(Text,
|
|
73
|
+
iconPosition === "right" && children ? (React.createElement(Text, { testID: buttonTestId, variant: ctaTextType[size], fontWeight: "semiBold", color: textColor, ...(!Icon && { textAlign: "center" }) }, children)) : null,
|
|
79
74
|
pending && displayContentWhenPending ? (React.createElement(IconContainer, { iconPosition: iconPosition },
|
|
80
75
|
React.createElement(SpinnerContainer, { displayContentWhenPending: true },
|
|
81
76
|
React.createElement(ActivityIndicator, { color: theme.colors.neutral.c50, animating: true })))) : IconNode ? (React.createElement(IconContainer, { iconButton: !children, iconPosition: iconPosition }, IconNode)) : null,
|
|
@@ -84,9 +79,9 @@ const ButtonContainer = (props) => {
|
|
|
84
79
|
const Button = (props) => {
|
|
85
80
|
const { Icon, children, type = "default", iconName, disabled = false, pending = false, displayContentWhenPending = false, testID, } = props;
|
|
86
81
|
const theme = useTheme();
|
|
87
|
-
return (React.createElement(Base,
|
|
82
|
+
return (React.createElement(Base, { activeOpacity: 1, ...props, type: type, iconButton: (!!Icon || !!iconName) && !children, disabled: disabled || pending, testID: testID },
|
|
88
83
|
React.createElement(View, null,
|
|
89
|
-
React.createElement(ButtonContainer,
|
|
84
|
+
React.createElement(ButtonContainer, { ...props, type: type, hide: pending && !displayContentWhenPending }),
|
|
90
85
|
pending && !displayContentWhenPending ? (React.createElement(SpinnerContainer, { displayContentWhenPending: displayContentWhenPending },
|
|
91
86
|
React.createElement(ActivityIndicator, { color: theme.colors.neutral.c50, animating: true }))) : null)));
|
|
92
87
|
};
|
|
@@ -94,20 +89,20 @@ export const PromisableButton = (props) => {
|
|
|
94
89
|
const { Icon, children, onPress, type = "main", disabled = false, iconName } = props;
|
|
95
90
|
const [spinnerOn, setSpinnerOn] = useState(false);
|
|
96
91
|
const theme = useTheme();
|
|
97
|
-
const onPressHandler = useCallback((event) =>
|
|
92
|
+
const onPressHandler = useCallback(async (event) => {
|
|
98
93
|
if (!onPress)
|
|
99
94
|
return;
|
|
100
95
|
setSpinnerOn(true);
|
|
101
96
|
try {
|
|
102
|
-
|
|
97
|
+
await onPress(event);
|
|
103
98
|
}
|
|
104
99
|
finally {
|
|
105
100
|
setSpinnerOn(false);
|
|
106
101
|
}
|
|
107
|
-
}
|
|
108
|
-
return (React.createElement(Base,
|
|
102
|
+
}, [onPress]);
|
|
103
|
+
return (React.createElement(Base, { ...props, type: type, iconButton: (!!Icon || !!iconName) && !children, disabled: disabled || spinnerOn, onPress: onPressHandler },
|
|
109
104
|
React.createElement(View, null,
|
|
110
|
-
React.createElement(ButtonContainer,
|
|
105
|
+
React.createElement(ButtonContainer, { ...props, type: type, hide: spinnerOn }),
|
|
111
106
|
React.createElement(SpinnerContainer, null,
|
|
112
107
|
React.createElement(ActivityIndicator, { color: theme.colors.neutral.c50, animating: spinnerOn })))));
|
|
113
108
|
};
|
|
@@ -25,7 +25,7 @@ const LinkContainer = (props) => {
|
|
|
25
25
|
};
|
|
26
26
|
const Link = (props) => {
|
|
27
27
|
const { type = "main", size = "medium" } = props;
|
|
28
|
-
return (React.createElement(Base,
|
|
29
|
-
React.createElement(LinkContainer,
|
|
28
|
+
return (React.createElement(Base, { ...props, activeOpacity: 0.5 },
|
|
29
|
+
React.createElement(LinkContainer, { ...props, type: type, size: size })));
|
|
30
30
|
};
|
|
31
31
|
export default Link;
|
|
@@ -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,EAAoB,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,
|
|
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,EAAoB,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,YA6BjC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,14 +1,3 @@
|
|
|
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
1
|
import React from "react";
|
|
13
2
|
import { TouchableOpacity } from "react-native";
|
|
14
3
|
import Text from "../../../Text";
|
|
@@ -29,9 +18,12 @@ export const Base = baseStyled(TouchableOpacity) `
|
|
|
29
18
|
? `border: 1px solid ${theme.colors.neutral.c30};`
|
|
30
19
|
: `background-color: ${theme.colors.neutral.c20};`}
|
|
31
20
|
`;
|
|
32
|
-
const QuickActionButton = (
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
const QuickActionButton = ({ Icon, children, disabled, onPress, onPressWhenDisabled, textVariant = "body", variant = "large", testID, ...otherProps }) => {
|
|
22
|
+
const text = // Extract the text to use it as a testID
|
|
23
|
+
React.isValidElement(children) && children.props?.i18nKey
|
|
24
|
+
? children.props.i18nKey.split(".").pop() // Extract the last part of the key
|
|
25
|
+
: children?.toString().toLowerCase();
|
|
26
|
+
return (React.createElement(Base, { disabled: onPressWhenDisabled ? false : disabled, onPress: disabled ? onPressWhenDisabled : onPress, visuallyDisabled: disabled, variant: variant, ...otherProps, testID: `${testID}-${text}` },
|
|
35
27
|
React.createElement(Icon, { size: variant === "small" ? 20 : 24, color: disabled ? "neutral.c50" : "neutral.c100" }),
|
|
36
28
|
React.createElement(StyledText, { numberOfLines: 1, variant: textVariant, fontWeight: "semiBold", color: disabled ? "neutral.c50" : "neutral.c100", mt: 2 }, children)));
|
|
37
29
|
};
|
|
@@ -1,22 +1,10 @@
|
|
|
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
1
|
import React, { useCallback } from "react";
|
|
13
2
|
import { FlatList } from "react-native";
|
|
14
3
|
import QuickActionButton from "../QuickActionButton";
|
|
15
|
-
const QuickActionList = (
|
|
16
|
-
var { numColumns = 3, data, id, testID } = _a, otherProps = __rest(_a, ["numColumns", "data", "id", "testID"]);
|
|
4
|
+
const QuickActionList = ({ numColumns = 3, data, id, testID, ...otherProps }) => {
|
|
17
5
|
const renderItem = useCallback(({ item, index }) => {
|
|
18
|
-
return (React.createElement(QuickActionButton,
|
|
6
|
+
return (React.createElement(QuickActionButton, { ...item, flex: 1, mr: (index + 1) % numColumns > 0 && data && index !== data.length - 1 ? 4 : 0, mb: data?.length && index + numColumns < data.length ? 4 : 0, testID: testID }));
|
|
19
7
|
}, []);
|
|
20
|
-
return (React.createElement(FlatList,
|
|
8
|
+
return (React.createElement(FlatList, { ...otherProps, data: data, keyExtractor: (_item, index) => `${id}${index}`, horizontal: false, renderItem: renderItem, numColumns: numColumns }));
|
|
21
9
|
};
|
|
22
10
|
export default QuickActionList;
|
|
@@ -60,7 +60,7 @@ const AlertUnderlinedText = styled(AlertBodyText) `
|
|
|
60
60
|
function Alert({ type = "info", Icon, title, showIcon = true, children }) {
|
|
61
61
|
const theme = useTheme();
|
|
62
62
|
const textColor = "neutral.c100";
|
|
63
|
-
const IconComponent = Icon
|
|
63
|
+
const IconComponent = Icon ?? icons[type];
|
|
64
64
|
return (React.createElement(StyledAlertContainer, { type: type },
|
|
65
65
|
showIcon && !!icons[type] && (React.createElement(StyledIconContainer, null,
|
|
66
66
|
React.createElement(IconComponent, { size: 20, color: getColor(theme, alertColors[type || "info"].iconColor) }))),
|
|
@@ -8,7 +8,7 @@ function Log({ children, extraTextProps }) {
|
|
|
8
8
|
React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between", mb: Platform.OS === "android" ? "-2px" : "-6px" },
|
|
9
9
|
React.createElement(BracketTopLeft, { color: "neutral.c100" }),
|
|
10
10
|
React.createElement(BracketTopRight, { color: "neutral.c100" })),
|
|
11
|
-
React.createElement(Text,
|
|
11
|
+
React.createElement(Text, { variant: "h2", lineHeight: "28px", textTransform: "uppercase", textAlign: "center", color: "neutral.c100", px: "15.5px", style: { overflow: "visible" }, ...extraTextProps }, children),
|
|
12
12
|
React.createElement(Flex, { mt: Platform.OS === "android" ? "-9.5px" : "-5px", flexDirection: "row", justifyContent: "space-between" },
|
|
13
13
|
React.createElement(BracketBottomLeft, { color: "neutral.c100" }),
|
|
14
14
|
React.createElement(BracketBottomRight, { color: "neutral.c100" }))));
|
|
@@ -51,17 +51,14 @@ const variantProps = {
|
|
|
51
51
|
borderRadius: 8,
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
|
-
const NotificationContainer = styled(FlexBox).attrs((p) => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
borderRadius: (_e = (_d = variantProps[p.variant]) === null || _d === void 0 ? void 0 : _d.borderRadius) !== null && _e !== void 0 ? _e : 1,
|
|
63
|
-
});
|
|
64
|
-
}) ``;
|
|
54
|
+
const NotificationContainer = styled(FlexBox).attrs((p) => ({
|
|
55
|
+
width: "100%",
|
|
56
|
+
flexDirection: "row",
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
bg: variantProps[p.variant]?.bg ?? variantProps.primary.bg,
|
|
59
|
+
p: variantProps[p.variant]?.padding,
|
|
60
|
+
borderRadius: variantProps[p.variant]?.borderRadius ?? 1,
|
|
61
|
+
})) ``;
|
|
65
62
|
const ClosePressableExtendedBounds = styled.TouchableOpacity.attrs({
|
|
66
63
|
p: 5,
|
|
67
64
|
m: -5,
|
|
@@ -69,15 +66,14 @@ const ClosePressableExtendedBounds = styled.TouchableOpacity.attrs({
|
|
|
69
66
|
${space};
|
|
70
67
|
`;
|
|
71
68
|
export default function Notification({ Icon, iconColor, variant = "primary", numberOfLines, title, subtitle, onClose, linkText, onLinkPress, }) {
|
|
72
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
73
69
|
const { colors } = useTheme();
|
|
74
|
-
const textColor =
|
|
75
|
-
const linkColor =
|
|
76
|
-
const iconMarginRight =
|
|
77
|
-
const closeIconSize =
|
|
78
|
-
const closeIconColor =
|
|
79
|
-
const textVariant =
|
|
80
|
-
const textFontWeight =
|
|
70
|
+
const textColor = variantProps[variant]?.color ?? variantProps.primary.color;
|
|
71
|
+
const linkColor = variantProps[variant]?.linkColor || textColor;
|
|
72
|
+
const iconMarginRight = variantProps[variant]?.iconMarginRight ?? 16;
|
|
73
|
+
const closeIconSize = variantProps[variant]?.closeIconSize ?? 14;
|
|
74
|
+
const closeIconColor = variantProps[variant]?.closeIconColor ?? textColor;
|
|
75
|
+
const textVariant = variantProps[variant]?.textVariant ?? "body";
|
|
76
|
+
const textFontWeight = variantProps[variant]?.textFontWeight ?? "medium";
|
|
81
77
|
return (React.createElement(NotificationContainer, { variant: variant },
|
|
82
78
|
Icon && (React.createElement(FlexBox, { mr: iconMarginRight },
|
|
83
79
|
React.createElement(Icon, { size: 20, color: iconColor || textColor }))),
|
|
@@ -23,7 +23,9 @@ const badgesStyle = {
|
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
|
-
const StyledBadgeText = styled(Text).attrs((p) => (
|
|
26
|
+
const StyledBadgeText = styled(Text).attrs((p) => ({
|
|
27
|
+
...badgesStyle[p.badgeVariant || "main"][p.active ? "active" : "default"],
|
|
28
|
+
})) `
|
|
27
29
|
border-radius: 32px;
|
|
28
30
|
padding: 8px;
|
|
29
31
|
`;
|
|
@@ -1,14 +1,3 @@
|
|
|
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
1
|
import React from "react";
|
|
13
2
|
import Flex from "../../Layout/Flex";
|
|
14
3
|
import Text from "../../Text";
|
|
@@ -18,9 +7,8 @@ const typeColor = {
|
|
|
18
7
|
shade: "neutral.c30",
|
|
19
8
|
warning: "warning.c50",
|
|
20
9
|
};
|
|
21
|
-
export default function Tag(
|
|
22
|
-
|
|
23
|
-
return (React.createElement(Flex, Object.assign({ px: size === "small" ? "6px" : 3, alignItems: "center", justifyContent: "center", flexDirection: "row", borderRadius: 6, bg: color || typeColor[type], height: size === "small" ? "18px" : "28px" }, props),
|
|
10
|
+
export default function Tag({ type = "shade", size = "small", color, textColor, uppercase, Icon, children, numberOfLines, ellipsizeMode, ...props }) {
|
|
11
|
+
return (React.createElement(Flex, { px: size === "small" ? "6px" : 3, alignItems: "center", justifyContent: "center", flexDirection: "row", borderRadius: 6, bg: color || typeColor[type], height: size === "small" ? "18px" : "28px", ...props },
|
|
24
12
|
Icon && (React.createElement(Box, { pr: 2 },
|
|
25
13
|
React.createElement(Icon, { size: size === "small" ? 16 : 20, color: type === "shade" ? "neutral.c90" : "neutral.c00" }))),
|
|
26
14
|
React.createElement(Text, { variant: size === "small" ? "subtitle" : "small", fontWeight: "bold", uppercase: uppercase !== false, textAlign: "center", color: textColor || (type === "shade" ? "neutral.c90" : "neutral.c00"), numberOfLines: numberOfLines, ellipsizeMode: ellipsizeMode }, children)));
|
package/lib/icons/BracketLeft.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Svg, { Path } from "react-native-svg";
|
|
3
|
-
const BracketLeft = (props) => (React.createElement(Svg,
|
|
3
|
+
const BracketLeft = (props) => (React.createElement(Svg, { viewBox: "0 0 64 128", ...props },
|
|
4
4
|
React.createElement(Path, { d: "m 8.692,119.94 v 8.058 H 64 V 91.6548 H 55.941 V 119.94 Z" }),
|
|
5
5
|
React.createElement(Path, { d: "M 8.692,0 V 8.05844 H 55.941 V 36.3452 H 64 V 0 Z" })));
|
|
6
6
|
export default BracketLeft;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Svg, { Path } from "react-native-svg";
|
|
3
|
-
const BracketRight = (props) => (React.createElement(Svg,
|
|
3
|
+
const BracketRight = (props) => (React.createElement(Svg, { viewBox: "0 0 64 128", ...props },
|
|
4
4
|
React.createElement(Path, { d: "M 0,91.6548 V 128 h 55.3076 v -8.06 H 8.05844 V 91.6548 Z" }),
|
|
5
5
|
React.createElement(Path, { d: "M 0,0 V 36.3452 H 8.05844 V 8.05844 H 55.3076 V 0 Z" })));
|
|
6
6
|
export default BracketRight;
|
|
@@ -5,6 +5,10 @@ import { palettes } from "@ledgerhq/ui-shared";
|
|
|
5
5
|
export const InvertTheme = ({ children }) => {
|
|
6
6
|
const { theme } = useTheme();
|
|
7
7
|
const revertTheme = theme === "light" ? "dark" : "light";
|
|
8
|
-
const newTheme = useMemo(() => (
|
|
8
|
+
const newTheme = useMemo(() => ({
|
|
9
|
+
...defaultTheme,
|
|
10
|
+
colors: { ...defaultTheme.colors, palette: palettes[revertTheme] },
|
|
11
|
+
theme: revertTheme,
|
|
12
|
+
}), [revertTheme]);
|
|
9
13
|
return React.createElement(ThemeProvider, { theme: newTheme }, children);
|
|
10
14
|
};
|
|
@@ -3,6 +3,14 @@ import { ThemeProvider } from "styled-components/native";
|
|
|
3
3
|
import defaultTheme from "./theme";
|
|
4
4
|
import { palettes } from "@ledgerhq/ui-shared";
|
|
5
5
|
export const StyleProvider = ({ children, selectedPalette }) => {
|
|
6
|
-
const theme = useMemo(() => (
|
|
6
|
+
const theme = useMemo(() => ({
|
|
7
|
+
...defaultTheme,
|
|
8
|
+
colors: {
|
|
9
|
+
...defaultTheme.colors,
|
|
10
|
+
...palettes[selectedPalette],
|
|
11
|
+
palette: palettes[selectedPalette],
|
|
12
|
+
},
|
|
13
|
+
theme: selectedPalette,
|
|
14
|
+
}), [selectedPalette]);
|
|
7
15
|
return React.createElement(ThemeProvider, { theme: theme }, children);
|
|
8
16
|
};
|
package/lib/styles/theme.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0-next.0",
|
|
4
4
|
"description": "Ledger Live - Mobile UI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"./lib/*/": "./lib/*/index.js",
|
|
30
30
|
"./*": "./lib/*.js",
|
|
31
31
|
"./*/": "./lib/*/index.js",
|
|
32
|
-
"./": "./lib/",
|
|
33
32
|
"./package.json": "./package.json"
|
|
34
33
|
},
|
|
35
34
|
"files": [
|
|
@@ -91,7 +90,7 @@
|
|
|
91
90
|
"@svgr/plugin-svgo": "^5.5.0",
|
|
92
91
|
"@types/color": "^3.0.3",
|
|
93
92
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
94
|
-
"@types/node": "^
|
|
93
|
+
"@types/node": "^22.10.10",
|
|
95
94
|
"@types/prop-types": "^15.7.5",
|
|
96
95
|
"@types/react": "^18.2.21",
|
|
97
96
|
"@types/styled-components": "^5.1.3",
|