@ledgerhq/native-ui 0.41.0-nightly.0 → 0.41.0-nightly.1

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.
@@ -35,7 +35,7 @@ export const AssetItem = ({ name, ticker, id, onClick, leftElement, rightElement
35
35
  "colors-surface-transparent-default",
36
36
  ]);
37
37
  return (React.createElement(Wrapper, { onPress: () => onClick({ name, ticker, id }), style: ({ pressed }) => ({
38
- padding: Number(tokens["spacing-xxs"]),
38
+ paddingVertical: Number(tokens["spacing-xxs"]),
39
39
  borderRadius: Number(tokens["radius-s"]),
40
40
  backgroundColor: String(tokens["colors-surface-transparent-default"]),
41
41
  opacity: pressed ? 0.7 : 1,
@@ -1,9 +1,11 @@
1
1
  import React from "react";
2
2
  import { AssetType } from "../AssetItem/AssetItem";
3
- export declare const AssetList: ({ assets, onClick, onVisibleItemsScrollEnd, scrollToTop, hasNextPage, }: {
3
+ export declare const AssetList: ({ assets, onClick, onVisibleItemsScrollEnd, onScrollDown, onScrollUp, scrollToTop, hasNextPage, }: {
4
4
  assets: AssetType[];
5
5
  onClick: (asset: AssetType) => void;
6
6
  onVisibleItemsScrollEnd?: (() => void) | undefined;
7
+ onScrollDown?: (() => void) | undefined;
8
+ onScrollUp?: (() => void) | undefined;
7
9
  scrollToTop?: boolean | undefined;
8
10
  hasNextPage?: boolean | undefined;
9
11
  }) => React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"AssetList.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/AssetTypeList/AssetList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAa,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAK9D,eAAO,MAAM,SAAS;YAOZ,SAAS,EAAE;qBACF,SAAS,KAAK,IAAI;qCACH,IAAI;;;uBA0CrC,CAAC"}
1
+ {"version":3,"file":"AssetList.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/AssetTypeList/AssetList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAa,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAK9D,eAAO,MAAM,SAAS;YASZ,SAAS,EAAE;qBACF,SAAS,KAAK,IAAI;qCACH,IAAI;0BACf,IAAI;wBACN,IAAI;;;uBA+DxB,CAAC"}
@@ -3,7 +3,7 @@ import { FlatList } from "react-native";
3
3
  import { AssetItem } from "../AssetItem/AssetItem";
4
4
  const ITEM_PADDING = 8;
5
5
  const ITEM_HEIGHT = 48 + ITEM_PADDING * 2;
6
- export const AssetList = ({ assets, onClick, onVisibleItemsScrollEnd, scrollToTop, hasNextPage, }) => {
6
+ export const AssetList = ({ assets, onClick, onVisibleItemsScrollEnd, onScrollDown, onScrollUp, scrollToTop, hasNextPage, }) => {
7
7
  const flatListRef = useRef(null);
8
8
  const renderAssetItem = useCallback(({ item }) => React.createElement(AssetItem, { ...item, onClick: onClick }), [onClick]);
9
9
  const keyExtractor = useCallback((item, index) => `${item.id}-${index}`, []);
@@ -17,6 +17,18 @@ export const AssetList = ({ assets, onClick, onVisibleItemsScrollEnd, scrollToTo
17
17
  onVisibleItemsScrollEnd();
18
18
  }
19
19
  }, [hasNextPage, onVisibleItemsScrollEnd]);
20
+ const handleViewableItemsChanged = useCallback((info) => {
21
+ if (info.changed.length === 0)
22
+ return;
23
+ const isScrollingDown = info.changed[0].index > info.changed[info.changed.length - 1].index;
24
+ const isScrollingUp = info.changed[0].index < info.changed[info.changed.length - 1].index;
25
+ if (onScrollDown && isScrollingDown) {
26
+ onScrollDown();
27
+ }
28
+ if (onScrollUp && isScrollingUp) {
29
+ onScrollUp();
30
+ }
31
+ }, [onScrollUp, onScrollDown]);
20
32
  const flatListProps = {
21
33
  data: assets,
22
34
  renderItem: renderAssetItem,
@@ -31,6 +43,7 @@ export const AssetList = ({ assets, onClick, onVisibleItemsScrollEnd, scrollToTo
31
43
  onEndReached: handleEndReached,
32
44
  onEndReachedThreshold: 0.1,
33
45
  }),
46
+ onViewableItemsChanged: handleViewableItemsChanged,
34
47
  };
35
48
  return React.createElement(FlatList, { ref: flatListRef, ...flatListProps });
36
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAQ,MAAM,cAAc,CAAC;AAI/C,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAkCF,eAAO,MAAM,KAAK;uBA/BE,SAAS,KAAK,WAAW;mCA2C3C,CAAC"}
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,SAAS,EAAQ,MAAM,cAAc,CAAC;AAI/C,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAyCF,eAAO,MAAM,KAAK;uBAtCE,SAAS,KAAK,WAAW;mCAsE5C,CAAC"}
@@ -1,11 +1,12 @@
1
- import React, { useContext } from "react";
1
+ import React, { useContext, useState } from "react";
2
2
  import { TextInput, View } from "react-native";
3
3
  import styled, { ThemeContext } from "styled-components/native";
4
4
  import { useTokens } from "../../libs";
5
5
  const Wrapper = styled(View) `
6
6
  height: 40px;
7
7
  min-width: 328px;
8
- padding-horizontal: ${({ tokens }) => tokens["spacing-s"]}px;
8
+ padding-left: ${({ isFocused, tokens }) => isFocused ? Number(tokens["spacing-s"]) - 2 : Number(tokens["spacing-s"])}px;
9
+ padding-right: ${({ isFocused, tokens }) => isFocused ? Number(tokens["spacing-s"]) - 2 : Number(tokens["spacing-s"])}px;
9
10
  align-items: center;
10
11
  flex-direction: row;
11
12
  gap: ${({ tokens }) => tokens["spacing-xxs"]}px;
@@ -13,6 +14,8 @@ const Wrapper = styled(View) `
13
14
  background-color: ${({ tokens }) => tokens["colors-surface-transparent-subdued-default"]};
14
15
  overflow: hidden;
15
16
  color: ${({ tokens }) => tokens["colors-content-subdued-default-default"]};
17
+ border-width: ${({ isFocused }) => (isFocused ? "2px" : "0px")};
18
+ border-color: ${({ isFocused, tokens }) => isFocused ? tokens["colors-border-active"] : "transparent"};
16
19
  `;
17
20
  const StyledInput = styled(TextInput) `
18
21
  flex: 1;
@@ -26,13 +29,23 @@ const TOKEN_KEYS = [
26
29
  "radius-s",
27
30
  "colors-surface-transparent-subdued-default",
28
31
  "colors-content-subdued-default-default",
32
+ "colors-border-active",
29
33
  ];
30
- export const Input = React.forwardRef(({ icon: Icon, ...props }, ref) => {
34
+ export const Input = React.forwardRef(({ icon: Icon, onFocus, onBlur, ...props }, ref) => {
35
+ const [isFocused, setIsFocused] = useState(false);
31
36
  const theme = useContext(ThemeContext);
32
37
  const themeType = theme?.colors?.type ?? "light";
33
38
  const tokens = useTokens(themeType, [...TOKEN_KEYS]);
34
- return (React.createElement(Wrapper, { tokens: tokens },
39
+ const handleFocus = (e) => {
40
+ setIsFocused(true);
41
+ onFocus?.(e);
42
+ };
43
+ const handleBlur = (e) => {
44
+ setIsFocused(false);
45
+ onBlur?.(e);
46
+ };
47
+ return (React.createElement(Wrapper, { tokens: tokens, isFocused: isFocused },
35
48
  !!Icon && React.createElement(Icon, { color: String(tokens["colors-content-subdued-default-default"]) }),
36
- React.createElement(StyledInput, { ...props, ref: ref, tokens: tokens })));
49
+ React.createElement(StyledInput, { ...props, ref: ref, tokens: tokens, onFocus: handleFocus, onBlur: handleBlur, placeholderTextColor: String(tokens["colors-content-subdued-default-default"]) })));
37
50
  });
38
51
  Input.displayName = "Input";
@@ -6,7 +6,7 @@ import Text from "../../../components/Text";
6
6
  import { CryptoIcon } from "../CryptoIcon/CryptoIcon";
7
7
  const Wrapper = styled(Pressable) `
8
8
  flex-direction: row;
9
- padding: ${({ tokens }) => tokens["spacing-xxs"]}px;
9
+ padding-vertical: ${({ tokens }) => tokens["spacing-xxs"]}px;
10
10
  border-radius: ${({ tokens }) => tokens["radius-s"]}px;
11
11
  align-items: center;
12
12
  width: 100%;
@@ -3,7 +3,8 @@ import { TextInputProps } from "react-native";
3
3
  type Props = Readonly<TextInputProps & {
4
4
  onDebouncedChange?: (current: string, prev: string) => void;
5
5
  debounceTime?: number;
6
+ onPressIn?: () => void;
6
7
  }>;
7
- export declare function Search({ onDebouncedChange, debounceTime, onChange, ...props }: Props): React.JSX.Element;
8
+ export declare function Search({ onDebouncedChange, debounceTime, onChange, onPressIn, ...props }: Props): React.JSX.Element;
8
9
  export {};
9
10
  //# sourceMappingURL=Search.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Search/Search.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAI/C,OAAO,EAAkD,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9F,KAAK,KAAK,GAAG,QAAQ,CACnB,cAAc,GAAG;IACf,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CACF,CAAC;AAEF,wBAAgB,MAAM,CAAC,EAAE,iBAAiB,EAAE,YAAkB,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,qBAyB1F"}
1
+ {"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Search/Search.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0B,MAAM,OAAO,CAAC;AAI/C,OAAO,EAAkD,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9F,KAAK,KAAK,GAAG,QAAQ,CACnB,cAAc,GAAG;IACf,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CACF,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,iBAAiB,EACjB,YAAkB,EAClB,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,qBAiCP"}
@@ -2,7 +2,7 @@ import React, { useMemo, useRef } from "react";
2
2
  import { Icons } from "../../../assets";
3
3
  import { useDebouncedCallback } from "../../hooks";
4
4
  import { Input } from "..";
5
- export function Search({ onDebouncedChange, debounceTime = 500, onChange, ...props }) {
5
+ export function Search({ onDebouncedChange, debounceTime = 500, onChange, onPressIn, ...props }) {
6
6
  const initialValue = props.value ?? props.defaultValue ?? "";
7
7
  const prevValue = useRef(String(initialValue));
8
8
  const handleDebouncedChange = useDebouncedCallback(useMemo(() => {
@@ -22,5 +22,5 @@ export function Search({ onDebouncedChange, debounceTime = 500, onChange, ...pro
22
22
  handleDebouncedChange?.(current);
23
23
  };
24
24
  }, [handleDebouncedChange, onChange]);
25
- return React.createElement(Input, { ...props, icon: Icons.Search, onChange: handleChange });
25
+ return (React.createElement(Input, { ...props, style: { height: "100%" }, icon: Icons.Search, onChange: handleChange, onPressIn: onPressIn }));
26
26
  }
@@ -18,9 +18,11 @@ declare const overrideColor: {
18
18
  readonly "surface-transparent-pressed": "#0000001A";
19
19
  readonly "border-subdued-default-hover": "#D5D5D5";
20
20
  readonly "border-subdued-default-pressed": "#C1C1C1";
21
+ readonly "border-active": "#D4A0FF";
21
22
  };
22
23
  readonly dark: {
23
24
  readonly "opacity-default-10": "#FFFFFF1A";
25
+ readonly "border-active": "#D4A0FF";
24
26
  };
25
27
  };
26
28
  export type Tokens = Record<string, string | number>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pre-ldls/libs/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAe,UAAU,EAAW,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGjF,QAAA,MAAM,aAAa;;;;;;;;;;;CAWT,CAAC;AAEX,QAAA,MAAM,aAAa;;;;;;;;;;CAUT,CAAC;AAEX,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AACrD,KAAK,UAAU,GACX,UAAU,MAAM,UAAU,EAAE,GAC5B,UAAU,MAAM,OAAO,aAAa,CAAC,KAAK,EAAE,GAC5C,UAAU,MAAM,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;AAEhD,KAAK,UAAU,GAAG,MAAM,CAAC,YAAY,GAAG,OAAO,aAAa,CAAC,CAAC;AAC9D,KAAK,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAY9B,eAAO,MAAM,SAAS,WACZ,KAAK,cAAc,MAAM,UAAU,GAAG,UAAU,CAAC,gDA2B1D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pre-ldls/libs/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAe,UAAU,EAAW,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGjF,QAAA,MAAM,aAAa;;;;;;;;;;;CAWT,CAAC;AAEX,QAAA,MAAM,aAAa;;;;;;;;;;;;CAYT,CAAC;AAEX,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AACrD,KAAK,UAAU,GACX,UAAU,MAAM,UAAU,EAAE,GAC5B,UAAU,MAAM,OAAO,aAAa,CAAC,KAAK,EAAE,GAC5C,UAAU,MAAM,OAAO,aAAa,CAAC,IAAI,EAAE,CAAC;AAEhD,KAAK,UAAU,GAAG,MAAM,CAAC,YAAY,GAAG,OAAO,aAAa,CAAC,CAAC;AAC9D,KAAK,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAY9B,eAAO,MAAM,SAAS,WACZ,KAAK,cAAc,MAAM,UAAU,GAAG,UAAU,CAAC,gDA2B1D,CAAC"}
@@ -19,9 +19,11 @@ const overrideColor = {
19
19
  "surface-transparent-pressed": "#0000001A",
20
20
  "border-subdued-default-hover": "#D5D5D5",
21
21
  "border-subdued-default-pressed": "#C1C1C1",
22
+ "border-active": "#D4A0FF",
22
23
  },
23
24
  dark: {
24
25
  "opacity-default-10": "#FFFFFF1A",
26
+ "border-active": "#D4A0FF",
25
27
  },
26
28
  };
27
29
  function pxToNumber(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/native-ui",
3
- "version": "0.41.0-nightly.0",
3
+ "version": "0.41.0-nightly.1",
4
4
  "description": "Ledger Live - Mobile UI",
5
5
  "repository": {
6
6
  "type": "git",