@ledgerhq/native-ui 0.55.0-nightly.20260209094427 → 0.55.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.
@@ -8,5 +8,4 @@ export { default as ScrollContainerHeader } from "./ScrollContainerHeader";
8
8
  export { default as ScrollListContainer } from "./ScrollListContainer";
9
9
  export { default as Row } from "./Table/Row";
10
10
  export * from "./List";
11
- export { Slides, useSlidesContext, useSlideContext } from "./Slides";
12
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7C,cAAc,QAAQ,CAAC"}
@@ -8,4 +8,3 @@ export { default as ScrollContainerHeader } from "./ScrollContainerHeader";
8
8
  export { default as ScrollListContainer } from "./ScrollListContainer";
9
9
  export { default as Row } from "./Table/Row";
10
10
  export * from "./List";
11
- export { Slides, useSlidesContext, useSlideContext } from "./Slides";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/native-ui",
3
- "version": "0.55.0-nightly.20260209094427",
3
+ "version": "0.55.0",
4
4
  "description": "Ledger Live - Mobile UI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import Animated from "react-native-reanimated";
3
- export declare function ProgressIndicator(props: React.ComponentProps<typeof Animated.View>): import("react/jsx-runtime").JSX.Element | null;
4
- //# sourceMappingURL=ProgressIndicator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProgressIndicator.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Slides/ProgressIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,QAA2C,MAAM,yBAAyB,CAAC;AAGlF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,IAAI,CAAC,kDAkClF"}
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo } from "react";
3
- import { StyleSheet } from "react-native";
4
- import Animated, { interpolate, useAnimatedStyle } from "react-native-reanimated";
5
- import { useSlidesContext } from "./context";
6
- export function ProgressIndicator(props) {
7
- const { scrollProgressSharedValue, footerHeights, totalSlides } = useSlidesContext();
8
- const { inputRange, outputRange, hasValidHeights } = useMemo(() => {
9
- const input = Array.from(Array(totalSlides), (_, i) => i);
10
- const output = input.map((i) => footerHeights.get(i) || 0);
11
- const hasValid = output.some((height) => height > 0);
12
- return {
13
- inputRange: input,
14
- outputRange: output,
15
- hasValidHeights: hasValid,
16
- };
17
- }, [footerHeights, totalSlides]);
18
- const animatedStyle = useAnimatedStyle(() => {
19
- if (!hasValidHeights || inputRange.length === 0) {
20
- return { bottom: 0, opacity: 0 };
21
- }
22
- const bottom = interpolate(scrollProgressSharedValue.value, inputRange, outputRange, "clamp");
23
- return {
24
- bottom,
25
- opacity: bottom > 0 ? 1 : 0,
26
- };
27
- });
28
- if (!hasValidHeights)
29
- return null;
30
- return (_jsx(Animated.View, { ...props, style: [styles.progressIndicator, animatedStyle, props.style] }));
31
- }
32
- const styles = StyleSheet.create({
33
- progressIndicator: {
34
- position: "absolute",
35
- left: 0,
36
- right: 0,
37
- justifyContent: "center",
38
- alignItems: "center",
39
- gap: 8,
40
- },
41
- });
@@ -1,12 +0,0 @@
1
- import React from "react";
2
- import { View } from "react-native";
3
- declare const SlideComponent: (props: React.ComponentProps<typeof View>) => import("react/jsx-runtime").JSX.Element;
4
- export declare function SlideBody(props: React.ComponentProps<typeof View>): import("react/jsx-runtime").JSX.Element;
5
- export declare function SlideFooter(props: React.ComponentProps<typeof View>): import("react/jsx-runtime").JSX.Element;
6
- export declare function Slide(props: React.ComponentProps<typeof SlideComponent>): import("react/jsx-runtime").JSX.Element;
7
- export declare namespace Slide {
8
- var Body: typeof SlideBody;
9
- var Footer: typeof SlideFooter;
10
- }
11
- export {};
12
- //# sourceMappingURL=Slide.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Slide.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Slides/Slide.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAiC,IAAI,EAAE,MAAM,cAAc,CAAC;AAGnE,QAAA,MAAM,cAAc,UAAW,MAAM,cAAc,CAAC,WAAW,CAAC,4CAE/D,CAAC;AAEF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,2CAEjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,2CAanE;AAcD,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,2CAEvE;yBAFe,KAAK"}
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useCallback } from "react";
3
- import { StyleSheet, View } from "react-native";
4
- import { useSlideContext, useSlidesContext } from "./context";
5
- const SlideComponent = (props) => {
6
- return _jsx(View, { ...props, style: [styles.slide, props.style] });
7
- };
8
- export function SlideBody(props) {
9
- return _jsx(View, { ...props, style: [styles.body, props.style] });
10
- }
11
- export function SlideFooter(props) {
12
- const { setFooterHeight } = useSlidesContext();
13
- const { slideIndex } = useSlideContext();
14
- const handleLayout = useCallback((event) => {
15
- const { height } = event.nativeEvent.layout;
16
- setFooterHeight(slideIndex, height);
17
- }, [setFooterHeight, slideIndex]);
18
- return _jsx(View, { ...props, style: [styles.footer, props.style], onLayout: handleLayout });
19
- }
20
- const styles = StyleSheet.create({
21
- slide: {
22
- flex: 1,
23
- },
24
- body: {
25
- flex: 1,
26
- },
27
- footer: {
28
- paddingBottom: 16,
29
- },
30
- });
31
- export function Slide(props) {
32
- return _jsx(SlideComponent, { ...props });
33
- }
34
- Slide.Body = SlideBody;
35
- Slide.Footer = SlideFooter;
@@ -1,18 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- import { ViewStyle, FlatListProps } from "react-native";
3
- declare const AnimatedFlatList: React.ComponentClass<import("react-native-reanimated").AnimatedProps<FlatListProps<unknown>>, any>;
4
- export type SlidesProps = {
5
- children: ReactNode;
6
- onSlideChange?: (index: number) => void;
7
- initialSlideIndex?: number;
8
- style?: ViewStyle;
9
- /**
10
- * Custom component to use instead of the default AnimatedFlatList.
11
- * For instance, inside gorhom/bottom-sheet, we need to pass FlatList from react-native-gesture-handler.
12
- * Make sure it is wrapped in Animated.createAnimatedComponent
13
- */
14
- as?: typeof AnimatedFlatList;
15
- } & Omit<FlatListProps<React.ReactElement>, "data" | "renderItem" | "keyExtractor" | "horizontal" | "pagingEnabled" | "showsHorizontalScrollIndicator" | "onScroll" | "scrollEventThrottle" | "onMomentumScrollEnd" | "getItemLayout" | "initialScrollIndex" | "ref">;
16
- export declare function Slides({ children, onSlideChange, initialSlideIndex, style, as, ...flatListProps }: SlidesProps): import("react/jsx-runtime").JSX.Element;
17
- export {};
18
- //# sourceMappingURL=Slides.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Slides.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Slides/Slides.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA0C,MAAM,OAAO,CAAC;AACjF,OAAO,EAOL,SAAS,EACT,aAAa,EACd,MAAM,cAAc,CAAC;AAOtB,QAAA,MAAM,gBAAgB,oGAA6C,CAAC;AAEpE,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,EAAE,CAAC,EAAE,OAAO,gBAAgB,CAAC;CAC9B,GAAG,IAAI,CACN,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC,EAC/B,MAAM,GACN,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,eAAe,GACf,gCAAgC,GAChC,UAAU,GACV,qBAAqB,GACrB,qBAAqB,GACrB,eAAe,GACf,oBAAoB,GACpB,KAAK,CACR,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,aAAa,EACb,iBAAqB,EACrB,KAAK,EACL,EAAqB,EACrB,GAAG,aAAa,EACjB,EAAE,WAAW,2CAoJb"}
@@ -1,91 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useCallback, useMemo, useRef, useState } from "react";
3
- import { FlatList, StyleSheet, View, } from "react-native";
4
- import Animated, { useAnimatedScrollHandler, useSharedValue } from "react-native-reanimated";
5
- import { SlideContext, SlidesContext } from "./context";
6
- import { ProgressIndicator } from "./ProgressIndicator";
7
- import { Slide } from "./Slide";
8
- const AnimatedFlatList = Animated.createAnimatedComponent(FlatList);
9
- export function Slides({ children, onSlideChange, initialSlideIndex = 0, style, as = AnimatedFlatList, ...flatListProps }) {
10
- const ListComponent = as;
11
- const flatListRef = useRef(null);
12
- const [width, setWidth] = useState(0);
13
- const [currentIndex, setCurrentIndex] = useState(initialSlideIndex);
14
- const [footerHeights, setFooterHeights] = useState(new Map());
15
- const scrollProgressSharedValue = useSharedValue(initialSlideIndex);
16
- const setFooterHeight = useCallback((slideIndex, footerHeight) => {
17
- setFooterHeights((prev) => {
18
- const newMap = new Map(prev);
19
- newMap.set(slideIndex, footerHeight);
20
- return newMap;
21
- });
22
- }, []);
23
- const handleContainerLayout = useCallback((event) => {
24
- const { width: containerWidth } = event.nativeEvent.layout;
25
- if (containerWidth > 0 && containerWidth !== width) {
26
- setWidth(containerWidth);
27
- }
28
- }, [width]);
29
- const slideChildren = useMemo(() => React.Children.toArray(children).filter((child) => React.isValidElement(child) && child.type === Slide), [children]);
30
- const progressIndicatorChildren = useMemo(() => React.Children.toArray(children).filter((child) => React.isValidElement(child) && child.type === ProgressIndicator), [children]);
31
- const totalSlides = slideChildren.length;
32
- const goToSlide = useCallback((index) => {
33
- if (index >= 0 && index < totalSlides) {
34
- flatListRef.current?.scrollToIndex({ index, animated: true });
35
- }
36
- }, [totalSlides]);
37
- const goToNext = useCallback(() => {
38
- if (currentIndex < totalSlides - 1) {
39
- goToSlide(currentIndex + 1);
40
- }
41
- }, [currentIndex, totalSlides, goToSlide]);
42
- const goToPrevious = useCallback(() => {
43
- if (currentIndex > 0) {
44
- goToSlide(currentIndex - 1);
45
- }
46
- }, [currentIndex, goToSlide]);
47
- const scrollHandler = useAnimatedScrollHandler({
48
- onScroll: (event) => {
49
- if (width > 0) {
50
- scrollProgressSharedValue.value = event.contentOffset.x / width;
51
- }
52
- },
53
- });
54
- const handleMomentumScrollEnd = useCallback((event) => {
55
- if (width <= 0)
56
- return;
57
- const offsetX = event.nativeEvent.contentOffset.x;
58
- const newIndex = Math.round(offsetX / width);
59
- if (newIndex !== currentIndex) {
60
- setCurrentIndex(newIndex);
61
- onSlideChange?.(newIndex);
62
- }
63
- }, [width, currentIndex, onSlideChange]);
64
- const getItemLayout = useCallback((_, index) => ({
65
- length: width,
66
- offset: width * index,
67
- index,
68
- }), [width]);
69
- const renderItem = useCallback((info) => {
70
- return (_jsx(SlideContext.Provider, { value: { slideIndex: info.index }, children: _jsx(View, { style: { width, flex: 1 }, children: info.item }) }));
71
- }, [width]);
72
- const contextValue = useMemo(() => ({
73
- currentIndex,
74
- totalSlides,
75
- goToNext,
76
- goToPrevious,
77
- goToSlide,
78
- flatListRef,
79
- scrollProgressSharedValue,
80
- footerHeights,
81
- setFooterHeight,
82
- }), [currentIndex, totalSlides, goToNext, goToPrevious, goToSlide, footerHeights, setFooterHeight]);
83
- return (_jsx(SlidesContext.Provider, { value: contextValue, children: _jsxs(View, { style: [styles.container, style], onLayout: handleContainerLayout, children: [width > 0 && (_jsx(ListComponent, { ref: flatListRef, data: slideChildren, renderItem: renderItem, keyExtractor: (_, index) => `slide-${index}`, horizontal: true,
84
- // @ts-expect-error - pagingEnabled exists but typescript does not seem to know about it
85
- pagingEnabled: true, showsHorizontalScrollIndicator: false, onScroll: scrollHandler, scrollEventThrottle: 16, onMomentumScrollEnd: handleMomentumScrollEnd, getItemLayout: getItemLayout, initialScrollIndex: initialSlideIndex, ...flatListProps })), progressIndicatorChildren.length > 0 && progressIndicatorChildren] }) }));
86
- }
87
- const styles = StyleSheet.create({
88
- container: {
89
- flex: 1,
90
- },
91
- });
@@ -1,32 +0,0 @@
1
- import React from "react";
2
- import { FlatList } from "react-native";
3
- import { useSharedValue } from "react-native-reanimated";
4
- export declare const SlidesContext: React.Context<{
5
- currentIndex: number;
6
- totalSlides: number;
7
- goToNext: () => void;
8
- goToPrevious: () => void;
9
- goToSlide: (index: number) => void;
10
- flatListRef: React.RefObject<FlatList<React.ReactElement> | null>;
11
- scrollProgressSharedValue: ReturnType<typeof useSharedValue<number>>;
12
- footerHeights: Map<number, number>;
13
- setFooterHeight: (slideIndex: number, footerHeight: number) => void;
14
- } | null>;
15
- export declare const useSlidesContext: () => {
16
- currentIndex: number;
17
- totalSlides: number;
18
- goToNext: () => void;
19
- goToPrevious: () => void;
20
- goToSlide: (index: number) => void;
21
- flatListRef: React.RefObject<FlatList<React.ReactElement> | null>;
22
- scrollProgressSharedValue: ReturnType<typeof useSharedValue<number>>;
23
- footerHeights: Map<number, number>;
24
- setFooterHeight: (slideIndex: number, footerHeight: number) => void;
25
- };
26
- export declare const SlideContext: React.Context<{
27
- slideIndex: number;
28
- } | null>;
29
- export declare const useSlideContext: () => {
30
- slideIndex: number;
31
- };
32
- //# sourceMappingURL=context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Slides/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,eAAO,MAAM,aAAa;kBACV,MAAM;iBACP,MAAM;cACT,MAAM,IAAI;kBACN,MAAM,IAAI;uBACL,MAAM,KAAK,IAAI;iBACrB,MAAM,SAAS,CAAC,SAAS,MAAM,YAAY,CAAC,GAAG,IAAI,CAAC;+BACtC,WAAW,sBAAsB,MAAM,CAAC,CAAC;mBACrD,IAAI,MAAM,EAAE,MAAM,CAAC;kCACJ,MAAM,gBAAgB,MAAM,KAAK,IAAI;SACtD,CAAC;AAEhB,eAAO,MAAM,gBAAgB;kBAXb,MAAM;iBACP,MAAM;cACT,MAAM,IAAI;kBACN,MAAM,IAAI;uBACL,MAAM,KAAK,IAAI;iBACrB,MAAM,SAAS,CAAC,SAAS,MAAM,YAAY,CAAC,GAAG,IAAI,CAAC;+BACtC,WAAW,sBAAsB,MAAM,CAAC,CAAC;mBACrD,IAAI,MAAM,EAAE,MAAM,CAAC;kCACJ,MAAM,gBAAgB,MAAM,KAAK,IAAI;CASpE,CAAC;AAEF,eAAO,MAAM,YAAY;gBACX,MAAM;SACL,CAAC;AAEhB,eAAO,MAAM,eAAe;gBAHd,MAAM;CASnB,CAAC"}
@@ -1,17 +0,0 @@
1
- import { createContext, useContext } from "react";
2
- export const SlidesContext = createContext(null);
3
- export const useSlidesContext = () => {
4
- const context = useContext(SlidesContext);
5
- if (!context) {
6
- throw new Error("useSlidesContext must be used within a Slides component");
7
- }
8
- return context;
9
- };
10
- export const SlideContext = createContext(null);
11
- export const useSlideContext = () => {
12
- const context = useContext(SlideContext);
13
- if (!context) {
14
- throw new Error("useSlideContext must be used within a Slide component");
15
- }
16
- return context;
17
- };
@@ -1,12 +0,0 @@
1
- import { type SlidesProps } from "./Slides";
2
- declare function Slides(props: SlidesProps): import("react/jsx-runtime").JSX.Element;
3
- declare namespace Slides {
4
- var Slide: typeof import("./Slide").Slide;
5
- var ProgressIndicator: typeof import("./ProgressIndicator").ProgressIndicator;
6
- }
7
- export { Slides };
8
- export type { SlidesProps };
9
- export { Slide } from "./Slide";
10
- export { ProgressIndicator } from "./ProgressIndicator";
11
- export { useSlidesContext, useSlideContext } from "./context";
12
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Layout/Slides/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvE,iBAAS,MAAM,CAAC,KAAK,EAAE,WAAW,2CAEjC;kBAFQ,MAAM;;;;AAMf,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,YAAY,EAAE,WAAW,EAAE,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC"}
@@ -1,13 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ProgressIndicator } from "./ProgressIndicator";
3
- import { Slide } from "./Slide";
4
- import { Slides as SlidesComponent } from "./Slides";
5
- function Slides(props) {
6
- return _jsx(SlidesComponent, { ...props });
7
- }
8
- Slides.Slide = Slide;
9
- Slides.ProgressIndicator = ProgressIndicator;
10
- export { Slides };
11
- export { Slide } from "./Slide";
12
- export { ProgressIndicator } from "./ProgressIndicator";
13
- export { useSlidesContext, useSlideContext } from "./context";