@ledgerhq/native-ui 0.28.0-nightly.0 → 0.29.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.
Files changed (65) hide show
  1. package/lib/components/Cards/BannerCard/index.js +2 -2
  2. package/lib/components/Cards/InformativeCard/index.js +4 -4
  3. package/lib/components/Cards/NotificationCard/index.js +1 -1
  4. package/lib/components/Cards/SideImageCard/index.js +3 -3
  5. package/lib/components/Carousel/index.js +4 -4
  6. package/lib/components/Form/Input/AnimatedInput/AnimatedNotchedLabel.js +2 -2
  7. package/lib/components/Form/Input/AnimatedInput/index.js +4 -16
  8. package/lib/components/Form/Input/AnimatedInputSelect/index.js +3 -15
  9. package/lib/components/Form/Input/BaseInput/index.js +8 -19
  10. package/lib/components/Form/Input/LegendInput/index.js +3 -15
  11. package/lib/components/Form/Input/NumberInput/index.js +3 -15
  12. package/lib/components/Form/Input/QrCodeInput/index.js +3 -15
  13. package/lib/components/Form/Input/SearchInput/index.js +5 -17
  14. package/lib/components/Form/SelectableList.js +3 -3
  15. package/lib/components/Form/TabSelector/index.d.ts +5 -4
  16. package/lib/components/Form/TabSelector/index.d.ts.map +1 -1
  17. package/lib/components/Form/TabSelector/index.js +10 -4
  18. package/lib/components/Icon/BoxedIcon.js +2 -14
  19. package/lib/components/Icon/IconBadge.js +2 -14
  20. package/lib/components/Icon/IconBox/index.js +1 -1
  21. package/lib/components/Layout/Divider/index.js +2 -2
  22. package/lib/components/Layout/List/IconBoxList/index.js +6 -15
  23. package/lib/components/Layout/List/List/index.js +5 -18
  24. package/lib/components/Layout/List/NumberedList/index.js +6 -18
  25. package/lib/components/Layout/List/TipList/index.js +6 -15
  26. package/lib/components/Layout/List/VerticalStepper/StepperItem.js +8 -12
  27. package/lib/components/Layout/List/VerticalStepper/index.js +4 -16
  28. package/lib/components/Layout/List/VerticalTimeline/TimelineIndicator.js +2 -14
  29. package/lib/components/Layout/List/VerticalTimeline/TimelineItem.js +9 -13
  30. package/lib/components/Layout/List/VerticalTimeline/index.js +4 -16
  31. package/lib/components/Layout/Modals/BaseModal/index.js +2 -14
  32. package/lib/components/Layout/Modals/BottomDrawer/index.js +2 -14
  33. package/lib/components/Layout/Modals/Popin/index.js +2 -14
  34. package/lib/components/Layout/Modals/Tooltip/index.js +3 -15
  35. package/lib/components/Layout/ScrollContainer/index.js +1 -15
  36. package/lib/components/Layout/ScrollContainerHeader/index.js +3 -15
  37. package/lib/components/Layout/ScrollListContainer/index.js +2 -14
  38. package/lib/components/Layout/Table/Row.js +2 -14
  39. package/lib/components/Loader/InfiniteLoader/index.js +5 -15
  40. package/lib/components/Loader/ProgressLoader/index.js +1 -1
  41. package/lib/components/Navigation/FlowStepper/index.js +3 -3
  42. package/lib/components/Navigation/Stepper/index.js +4 -16
  43. package/lib/components/ProgressBar/index.js +3 -15
  44. package/lib/components/Tabs/Chip/index.js +3 -3
  45. package/lib/components/Tabs/Graph/index.js +1 -1
  46. package/lib/components/Tabs/TemplateTabs/index.js +2 -14
  47. package/lib/components/Text/getTextStyle.js +4 -2
  48. package/lib/components/Text/index.js +9 -25
  49. package/lib/components/cta/Button/getButtonStyle.js +10 -2
  50. package/lib/components/cta/Button/index.js +15 -20
  51. package/lib/components/cta/Link/index.js +2 -2
  52. package/lib/components/cta/QuickAction/QuickActionButton/index.d.ts.map +1 -1
  53. package/lib/components/cta/QuickAction/QuickActionButton/index.js +6 -14
  54. package/lib/components/cta/QuickAction/QuickActionList/index.js +3 -15
  55. package/lib/components/message/Alert/index.js +1 -1
  56. package/lib/components/message/Log/index.js +1 -1
  57. package/lib/components/message/Notification/index.js +15 -19
  58. package/lib/components/tags/Badge/index.js +3 -1
  59. package/lib/components/tags/Tag/index.js +2 -14
  60. package/lib/icons/BracketLeft.js +1 -1
  61. package/lib/icons/BracketRight.js +1 -1
  62. package/lib/styles/InvertTheme.js +5 -1
  63. package/lib/styles/StyleProvider.js +9 -1
  64. package/lib/styles/theme.js +4 -1
  65. package/package.json +3 -4
@@ -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 = (_a) => {
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, Object.assign({ columnGap: gap, stretchItems: stretchItems }, props), labels.map((label, index) => (React.createElement(Item, Object.assign({ key: index }, props, { index: index, isActive: index === activeIndex, label: label, size: size, stretchItems: stretchItems, onPress: () => onChange(index) }))))));
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 Object.assign(Object.assign({}, style), getConcatenedFontWeightFontFamily[(_a = style === null || style === void 0 ? void 0 : style.fontFamily) !== null && _a !== void 0 ? _a : "Inter"][fontWeight]);
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
- var _a;
33
- return ({
34
- fontSize: p.fontSize ? p.fontSize : (_a = p.variant) !== null && _a !== void 0 ? _a : "paragraph",
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 = (_a) => {
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, Object.assign({}, props, { color: color, bracket: true }), children),
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 = (_a) => {
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, Object.assign({}, props), children);
62
- return (React.createElement(Base, Object.assign({ textAlign: textAlign }, props, { testID: testID }), children));
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: Object.assign({ backgroundColor: "transparent", borderColor: disabled ? primaryColor : tertiaryColor !== null && tertiaryColor !== void 0 ? tertiaryColor : secondaryColor, borderWidth: 1 }, (pressedOutlineColor && { underlayColor: pressedOutlineColor })),
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: Object.assign({ backgroundColor: secondaryColor }, (pressedColor && { underlayColor: pressedColor })),
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 Object.assign(Object.assign({}, getButtonColorStyle(p.theme.colors, p).button), {
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, sizeVariant: p.size, disabled,
30
- onPress });
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, Object.assign({ testID: buttonTestId, variant: ctaTextType[size], fontWeight: "semiBold", color: textColor }, (!Icon && { textAlign: "center" })), children)) : null,
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, Object.assign({ activeOpacity: 1 }, props, { type: type, iconButton: (!!Icon || !!iconName) && !children, disabled: disabled || pending, testID: testID }),
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, Object.assign({}, props, { type: type, hide: pending && !displayContentWhenPending })),
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) => __awaiter(void 0, void 0, void 0, function* () {
92
+ const onPressHandler = useCallback(async (event) => {
98
93
  if (!onPress)
99
94
  return;
100
95
  setSpinnerOn(true);
101
96
  try {
102
- yield onPress(event);
97
+ await onPress(event);
103
98
  }
104
99
  finally {
105
100
  setSpinnerOn(false);
106
101
  }
107
- }), [onPress]);
108
- return (React.createElement(Base, Object.assign({}, props, { type: type, iconButton: (!!Icon || !!iconName) && !children, disabled: disabled || spinnerOn, onPress: onPressHandler }),
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, Object.assign({}, props, { type: type, hide: spinnerOn })),
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, Object.assign({}, props, { activeOpacity: 0.5 }),
29
- React.createElement(LinkContainer, Object.assign({}, props, { type: type, size: size }))));
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,YAyBjC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
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 = (_a) => {
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}` }),
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 = (_a) => {
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, 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 })));
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, Object.assign({}, otherProps, { data: data, keyExtractor: (_item, index) => `${id}${index}`, horizontal: false, renderItem: renderItem, numColumns: numColumns })));
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 !== null && Icon !== void 0 ? Icon : icons[type];
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, Object.assign({ variant: "h2", lineHeight: "28px", textTransform: "uppercase", textAlign: "center", color: "neutral.c100", px: "15.5px", style: { overflow: "visible" } }, extraTextProps), children),
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
- var _a, _b, _c, _d, _e;
56
- return ({
57
- width: "100%",
58
- flexDirection: "row",
59
- alignItems: "center",
60
- bg: (_b = (_a = variantProps[p.variant]) === null || _a === void 0 ? void 0 : _a.bg) !== null && _b !== void 0 ? _b : variantProps.primary.bg,
61
- p: (_c = variantProps[p.variant]) === null || _c === void 0 ? void 0 : _c.padding,
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 = (_b = (_a = variantProps[variant]) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : variantProps.primary.color;
75
- const linkColor = ((_c = variantProps[variant]) === null || _c === void 0 ? void 0 : _c.linkColor) || textColor;
76
- const iconMarginRight = (_e = (_d = variantProps[variant]) === null || _d === void 0 ? void 0 : _d.iconMarginRight) !== null && _e !== void 0 ? _e : 16;
77
- const closeIconSize = (_g = (_f = variantProps[variant]) === null || _f === void 0 ? void 0 : _f.closeIconSize) !== null && _g !== void 0 ? _g : 14;
78
- const closeIconColor = (_j = (_h = variantProps[variant]) === null || _h === void 0 ? void 0 : _h.closeIconColor) !== null && _j !== void 0 ? _j : textColor;
79
- const textVariant = (_l = (_k = variantProps[variant]) === null || _k === void 0 ? void 0 : _k.textVariant) !== null && _l !== void 0 ? _l : "body";
80
- const textFontWeight = (_o = (_m = variantProps[variant]) === null || _m === void 0 ? void 0 : _m.textFontWeight) !== null && _o !== void 0 ? _o : "medium";
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) => (Object.assign({}, badgesStyle[p.badgeVariant || "main"][p.active ? "active" : "default"]))) `
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(_a) {
22
- var { type = "shade", size = "small", color, textColor, uppercase, Icon, children, numberOfLines, ellipsizeMode } = _a, props = __rest(_a, ["type", "size", "color", "textColor", "uppercase", "Icon", "children", "numberOfLines", "ellipsizeMode"]);
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)));
@@ -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, Object.assign({ viewBox: "0 0 64 128" }, props),
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, Object.assign({ viewBox: "0 0 64 128" }, props),
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(() => (Object.assign(Object.assign({}, defaultTheme), { colors: Object.assign(Object.assign({}, defaultTheme.colors), { palette: palettes[revertTheme] }), theme: revertTheme })), [revertTheme]);
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(() => (Object.assign(Object.assign({}, defaultTheme), { colors: Object.assign(Object.assign(Object.assign({}, defaultTheme.colors), palettes[selectedPalette]), { palette: palettes[selectedPalette] }), theme: selectedPalette })), [selectedPalette]);
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
  };
@@ -51,7 +51,10 @@ const theme = {
51
51
  radii,
52
52
  fontSizes,
53
53
  space,
54
- colors: Object.assign(Object.assign({}, palettes.light), { palette: palettes.light }),
54
+ colors: {
55
+ ...palettes.light,
56
+ palette: palettes.light,
57
+ },
55
58
  zIndexes,
56
59
  };
57
60
  export default theme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/native-ui",
3
- "version": "0.28.0-nightly.0",
3
+ "version": "0.29.0-nightly.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": [
@@ -40,7 +39,7 @@
40
39
  "react-native-modal": "^13.0.0",
41
40
  "rn-range-slider": "2.1.1",
42
41
  "styled-system": "^5.1.5",
43
- "@ledgerhq/crypto-icons-ui": "^1.7.0",
42
+ "@ledgerhq/crypto-icons-ui": "^1.8.0",
44
43
  "@ledgerhq/icons-ui": "^0.8.1",
45
44
  "@ledgerhq/ui-shared": "^0.3.0"
46
45
  },
@@ -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": "^20.8.10",
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",