@ledgerhq/lumen-ui-rnative 0.0.68 → 0.0.69
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/dist/package.json +2 -2
- package/dist/src/i18n/locales/de.json +4 -0
- package/dist/src/i18n/locales/en.json +4 -0
- package/dist/src/i18n/locales/es.json +4 -0
- package/dist/src/i18n/locales/fr.json +4 -0
- package/dist/src/i18n/locales/ja.json +4 -0
- package/dist/src/i18n/locales/ko.json +4 -0
- package/dist/src/i18n/locales/pt.json +4 -0
- package/dist/src/i18n/locales/ru.json +4 -0
- package/dist/src/i18n/locales/th.json +4 -0
- package/dist/src/i18n/locales/tr.json +4 -0
- package/dist/src/i18n/locales/zh.json +4 -0
- package/dist/src/lib/Components/Avatar/Avatar.d.ts +19 -0
- package/dist/src/lib/Components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/src/lib/Components/Avatar/Avatar.js +81 -0
- package/dist/src/lib/Components/Avatar/Avatar.stories.d.ts +22 -0
- package/dist/src/lib/Components/Avatar/Avatar.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Avatar/Avatar.stories.js +72 -0
- package/dist/src/lib/Components/Avatar/index.d.ts +3 -0
- package/dist/src/lib/Components/Avatar/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Avatar/index.js +2 -0
- package/dist/src/lib/Components/Avatar/types.d.ts +26 -0
- package/dist/src/lib/Components/Avatar/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Avatar/types.js +1 -0
- package/dist/src/lib/Components/PageIndicator/PageIndicator.d.ts.map +1 -1
- package/dist/src/lib/Components/PageIndicator/PageIndicator.js +3 -2
- package/dist/src/lib/Components/PageIndicator/PageIndicator.stories.js +4 -4
- package/dist/src/lib/Components/PageIndicator/types.d.ts +1 -1
- package/dist/src/lib/Components/index.d.ts +1 -0
- package/dist/src/lib/Components/index.d.ts.map +1 -1
- package/dist/src/lib/Components/index.js +1 -0
- package/dist/src/lib/Symbols/Icons/Chart5.d.ts +35 -0
- package/dist/src/lib/Symbols/Icons/Chart5.d.ts.map +1 -0
- package/dist/src/lib/Symbols/Icons/Chart5.js +34 -0
- package/dist/src/lib/Symbols/Icons/Chart5Fill.d.ts +35 -0
- package/dist/src/lib/Symbols/Icons/Chart5Fill.d.ts.map +1 -0
- package/dist/src/lib/Symbols/Icons/Chart5Fill.js +34 -0
- package/dist/src/lib/Symbols/Icons/CurveDown.d.ts +35 -0
- package/dist/src/lib/Symbols/Icons/CurveDown.d.ts.map +1 -0
- package/dist/src/lib/Symbols/Icons/CurveDown.js +34 -0
- package/dist/src/lib/Symbols/Icons/CurveUp.d.ts +35 -0
- package/dist/src/lib/Symbols/Icons/CurveUp.d.ts.map +1 -0
- package/dist/src/lib/Symbols/Icons/CurveUp.js +34 -0
- package/dist/src/lib/Symbols/Icons/Target.d.ts +35 -0
- package/dist/src/lib/Symbols/Icons/Target.d.ts.map +1 -0
- package/dist/src/lib/Symbols/Icons/Target.js +34 -0
- package/dist/src/lib/Symbols/index.d.ts +5 -0
- package/dist/src/lib/Symbols/index.d.ts.map +1 -1
- package/dist/src/lib/Symbols/index.js +5 -0
- package/package.json +2 -2
- package/src/i18n/locales/de.json +4 -0
- package/src/i18n/locales/en.json +4 -0
- package/src/i18n/locales/es.json +4 -0
- package/src/i18n/locales/fr.json +4 -0
- package/src/i18n/locales/ja.json +4 -0
- package/src/i18n/locales/ko.json +4 -0
- package/src/i18n/locales/pt.json +4 -0
- package/src/i18n/locales/ru.json +4 -0
- package/src/i18n/locales/th.json +4 -0
- package/src/i18n/locales/tr.json +4 -0
- package/src/i18n/locales/zh.json +4 -0
- package/src/lib/Components/Avatar/Avatar.mdx +323 -0
- package/src/lib/Components/Avatar/Avatar.stories.tsx +127 -0
- package/src/lib/Components/Avatar/Avatar.test.tsx +215 -0
- package/src/lib/Components/Avatar/Avatar.tsx +132 -0
- package/src/lib/Components/Avatar/index.ts +2 -0
- package/src/lib/Components/Avatar/types.ts +26 -0
- package/src/lib/Components/PageIndicator/PageIndicator.mdx +7 -4
- package/src/lib/Components/PageIndicator/PageIndicator.stories.tsx +5 -5
- package/src/lib/Components/PageIndicator/PageIndicator.test.tsx +14 -14
- package/src/lib/Components/PageIndicator/PageIndicator.tsx +6 -2
- package/src/lib/Components/PageIndicator/types.ts +1 -1
- package/src/lib/Components/index.ts +1 -0
- package/src/lib/Symbols/Icons/Chart5.tsx +53 -0
- package/src/lib/Symbols/Icons/Chart5Fill.tsx +42 -0
- package/src/lib/Symbols/Icons/CurveDown.tsx +69 -0
- package/src/lib/Symbols/Icons/CurveUp.tsx +68 -0
- package/src/lib/Symbols/Icons/Target.tsx +45 -0
- package/src/lib/Symbols/index.ts +5 -0
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-rnative",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.68",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@types/react": "^19.0.0",
|
|
39
39
|
"@gorhom/bottom-sheet": "^5.0.0",
|
|
40
|
-
"@ledgerhq/lumen-design-core": "0.0.
|
|
40
|
+
"@ledgerhq/lumen-design-core": "0.0.49",
|
|
41
41
|
"react": "19.0.0",
|
|
42
42
|
"react-native": "~0.79.7",
|
|
43
43
|
"react-native-reanimated": "^3.0.0",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AvatarProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A circular avatar component that displays a user image or fallback icon.
|
|
4
|
+
*
|
|
5
|
+
* When the image fails to load or no src is provided, displays a User icon fallback.
|
|
6
|
+
* Supports an optional notification indicator.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://lumen-ldls.vercel.app/?path=/docs/react-native_communication-avatar--docs Storybook}
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { Avatar } from '@ledgerhq/lumen-ui-react';
|
|
12
|
+
*
|
|
13
|
+
* <Avatar src="https://example.com/photo.jpg" size="md" />
|
|
14
|
+
*
|
|
15
|
+
* // With notification indicator
|
|
16
|
+
* <Avatar src="https://example.com/photo.jpg" showNotification />
|
|
17
|
+
*/
|
|
18
|
+
export declare const Avatar: ({ lx, style, src, alt, size, showNotification, ref, ...props }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=Avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAuDtC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,mEAShB,WAAW,4CA6Cb,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { StyleSheet, Image, View } from 'react-native';
|
|
4
|
+
import { useCommonTranslation } from '../../../i18n';
|
|
5
|
+
import { useStyleSheet } from '../../../styles';
|
|
6
|
+
import { User } from '../../Symbols';
|
|
7
|
+
import { Box } from '../Utility';
|
|
8
|
+
const fallbackSizes = {
|
|
9
|
+
sm: 16,
|
|
10
|
+
md: 24,
|
|
11
|
+
};
|
|
12
|
+
const useStyles = ({ size }) => {
|
|
13
|
+
return useStyleSheet((t) => {
|
|
14
|
+
const sizeMap = {
|
|
15
|
+
sm: { size: t.sizes.s40, padding: t.spacings.s4 },
|
|
16
|
+
md: { size: t.sizes.s48, padding: t.spacings.s4 },
|
|
17
|
+
};
|
|
18
|
+
const notificationsMap = {
|
|
19
|
+
sm: t.sizes.s10,
|
|
20
|
+
md: t.sizes.s12,
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
root: {
|
|
24
|
+
position: 'relative',
|
|
25
|
+
width: sizeMap[size].size,
|
|
26
|
+
height: sizeMap[size].size,
|
|
27
|
+
borderRadius: 9999,
|
|
28
|
+
backgroundColor: t.colors.bg.muted,
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
padding: sizeMap[size].padding,
|
|
32
|
+
},
|
|
33
|
+
notification: {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
top: 0,
|
|
36
|
+
right: 0,
|
|
37
|
+
width: notificationsMap[size],
|
|
38
|
+
height: notificationsMap[size],
|
|
39
|
+
borderRadius: 9999,
|
|
40
|
+
backgroundColor: t.colors.bg.errorStrong,
|
|
41
|
+
zIndex: 1,
|
|
42
|
+
},
|
|
43
|
+
image: {
|
|
44
|
+
width: '100%',
|
|
45
|
+
height: '100%',
|
|
46
|
+
overflow: 'hidden',
|
|
47
|
+
borderRadius: 9999,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}, [size]);
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* A circular avatar component that displays a user image or fallback icon.
|
|
54
|
+
*
|
|
55
|
+
* When the image fails to load or no src is provided, displays a User icon fallback.
|
|
56
|
+
* Supports an optional notification indicator.
|
|
57
|
+
*
|
|
58
|
+
* @see {@link https://lumen-ldls.vercel.app/?path=/docs/react-native_communication-avatar--docs Storybook}
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* import { Avatar } from '@ledgerhq/lumen-ui-react';
|
|
62
|
+
*
|
|
63
|
+
* <Avatar src="https://example.com/photo.jpg" size="md" />
|
|
64
|
+
*
|
|
65
|
+
* // With notification indicator
|
|
66
|
+
* <Avatar src="https://example.com/photo.jpg" showNotification />
|
|
67
|
+
*/
|
|
68
|
+
export const Avatar = ({ lx, style, src, alt = 'avatar', size = 'md', showNotification = false, ref, ...props }) => {
|
|
69
|
+
const { t } = useCommonTranslation();
|
|
70
|
+
const [error, setError] = useState(false);
|
|
71
|
+
const shouldFallback = !src || error;
|
|
72
|
+
const styles = useStyles({ size });
|
|
73
|
+
const resolvedAlt = alt || t('components.avatar.defaultAlt');
|
|
74
|
+
const accessibilityLabel = showNotification
|
|
75
|
+
? `${resolvedAlt}, ${t('components.avatar.notificationAriaLabel')}`
|
|
76
|
+
: resolvedAlt;
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
setError(false);
|
|
79
|
+
}, [src]);
|
|
80
|
+
return (_jsxs(Box, { ref: ref, lx: lx, style: StyleSheet.flatten([styles.root, style]), accessibilityRole: 'image', accessibilityLabel: accessibilityLabel, ...props, children: [showNotification && (_jsx(View, { style: styles.notification, accessible: false })), shouldFallback ? (_jsx(User, { size: fallbackSizes[size], accessible: false, testID: 'avatar-fallback-icon' })) : (_jsx(Image, { source: { uri: src }, style: styles.image, accessible: false, onError: () => setError(true), testID: 'avatar-image' }))] }));
|
|
81
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
component: ({ lx, style, src, alt, size, showNotification, ref, ...props }: import("./types").AvatarProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
title: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
docs: {
|
|
7
|
+
source: {
|
|
8
|
+
language: string;
|
|
9
|
+
format: boolean;
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
export declare const Base: Story;
|
|
18
|
+
export declare const SizeShowcase: Story;
|
|
19
|
+
export declare const FallbackShowcase: Story;
|
|
20
|
+
export declare const NotificationShowcase: Story;
|
|
21
|
+
export declare const InteractiveShowcase: Story;
|
|
22
|
+
//# sourceMappingURL=Avatar.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Avatar.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Avatar/Avatar.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAMlE,QAAA,MAAM,IAAI;;;;;;;;;;;;CAYqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAKnC,eAAO,MAAM,IAAI,EAAE,KAelB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KA6B1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAe9B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAiBlC,CAAC;AAKF,eAAO,MAAM,mBAAmB,EAAE,KAajC,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View, Text, Pressable, Linking } from 'react-native';
|
|
3
|
+
import { Box } from '../Utility';
|
|
4
|
+
import { Avatar } from './Avatar';
|
|
5
|
+
const meta = {
|
|
6
|
+
component: Avatar,
|
|
7
|
+
title: 'Communication/Avatar',
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
source: {
|
|
11
|
+
language: 'tsx',
|
|
12
|
+
format: true,
|
|
13
|
+
type: 'code',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
const exampleSrc = 'https://plus.unsplash.com/premium_photo-1689551670902-19b441a6afde?q=80&w=774&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D';
|
|
20
|
+
export const Base = {
|
|
21
|
+
args: {
|
|
22
|
+
src: exampleSrc,
|
|
23
|
+
alt: 'avatar',
|
|
24
|
+
size: 'md',
|
|
25
|
+
showNotification: false,
|
|
26
|
+
},
|
|
27
|
+
render: (args) => _jsx(Avatar, { ...args }),
|
|
28
|
+
parameters: {
|
|
29
|
+
docs: {
|
|
30
|
+
source: {
|
|
31
|
+
code: `<Avatar src="https://example.com" size="md" alt="avatar" showNotification={false} />`,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export const SizeShowcase = {
|
|
37
|
+
render: () => (_jsxs(Box, { lx: {
|
|
38
|
+
alignItems: 'stretch',
|
|
39
|
+
flexDirection: 'row',
|
|
40
|
+
gap: 's16',
|
|
41
|
+
}, children: [_jsxs(View, { style: { alignItems: 'center', justifyContent: 'flex-end' }, children: [_jsx(Avatar, { src: exampleSrc, alt: 'avatar', size: 'sm', showNotification: false }), _jsx(Text, { style: { marginTop: 4 }, children: "sm" })] }), _jsxs(View, { style: { alignItems: 'center', justifyContent: 'flex-end' }, children: [_jsx(Avatar, { src: exampleSrc, alt: 'avatar', size: 'md', showNotification: false }), _jsx(Text, { style: { marginTop: 4 }, children: "md" })] })] })),
|
|
42
|
+
};
|
|
43
|
+
export const FallbackShowcase = {
|
|
44
|
+
args: {
|
|
45
|
+
src: 'https://brokenLink.random',
|
|
46
|
+
size: 'md',
|
|
47
|
+
alt: 'Fallback example',
|
|
48
|
+
showNotification: false,
|
|
49
|
+
},
|
|
50
|
+
render: (args) => _jsx(Avatar, { ...args }),
|
|
51
|
+
parameters: {
|
|
52
|
+
docs: {
|
|
53
|
+
source: {
|
|
54
|
+
code: `<Avatar src="https://brokenLink.random" size="md" alt="Fallback example" showNotification={false} />`,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
export const NotificationShowcase = {
|
|
60
|
+
render: () => (_jsxs(Box, { lx: {
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
gap: 's16',
|
|
63
|
+
}, children: [_jsx(Avatar, { src: exampleSrc, alt: 'avatar', size: 'md', showNotification: false }), _jsx(Avatar, { src: exampleSrc, alt: 'avatar', size: 'md', showNotification: true })] })),
|
|
64
|
+
};
|
|
65
|
+
const onPressRedirect = () => Linking.openURL('https://shop.ledger.com/pages/ledger-nano-gen5');
|
|
66
|
+
export const InteractiveShowcase = {
|
|
67
|
+
render: () => (_jsx(Pressable, { onPress: onPressRedirect, style: ({ pressed }) => ({
|
|
68
|
+
borderRadius: 9999,
|
|
69
|
+
opacity: pressed ? 0.7 : 1,
|
|
70
|
+
backgroundColor: pressed ? 'rgba(0, 0, 0, 0.05)' : 'transparent',
|
|
71
|
+
}), children: _jsx(Avatar, { src: exampleSrc, size: 'md', showNotification: true }) })),
|
|
72
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Avatar/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StyledViewProps } from '../../../styles';
|
|
2
|
+
export type AvatarProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Image source URL. When undefined or on load error, displays a fallback icon.
|
|
5
|
+
* @optional
|
|
6
|
+
*/
|
|
7
|
+
src?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Alternative text for the image.
|
|
10
|
+
* @optional
|
|
11
|
+
*/
|
|
12
|
+
alt?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The size variant of the avatar.
|
|
15
|
+
* @optional
|
|
16
|
+
* @default md
|
|
17
|
+
*/
|
|
18
|
+
size?: 'sm' | 'md';
|
|
19
|
+
/**
|
|
20
|
+
* Whether to show the notifications indicator.
|
|
21
|
+
* @optional
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
showNotification?: boolean;
|
|
25
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Avatar/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageIndicator.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/PageIndicator/PageIndicator.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAwK7C;;;;;GAKG;AACH,eAAO,MAAM,aAAa;qDAMvB,kBAAkB;;
|
|
1
|
+
{"version":3,"file":"PageIndicator.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/PageIndicator/PageIndicator.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAwK7C;;;;;GAKG;AACH,eAAO,MAAM,aAAa;qDAMvB,kBAAkB;;CA0CpB,CAAC"}
|
|
@@ -60,7 +60,7 @@ const usePageIndicator = ({ currentPage, totalPages, dotSize, gap, }) => {
|
|
|
60
60
|
}), [translateX]);
|
|
61
61
|
const viewportWidth = Math.max(0, visibleDots * dotSize + (visibleDots - 1) * gap);
|
|
62
62
|
const firstVisibleIndex = offset;
|
|
63
|
-
const lastVisibleIndex = offset +
|
|
63
|
+
const lastVisibleIndex = offset + visibleDots - 1;
|
|
64
64
|
const isActive = useCallback((index) => index === currentPage, [currentPage]);
|
|
65
65
|
const isShrunk = useCallback((index) => {
|
|
66
66
|
if (totalPages <= MAX_VISIBLE_DOTS)
|
|
@@ -103,8 +103,9 @@ const usePageIndicatorStyles = () => useStyleSheet((t) => ({
|
|
|
103
103
|
export const PageIndicator = ({ currentPage, totalPages, lx = {}, ref, ...props }) => {
|
|
104
104
|
const styles = usePageIndicatorStyles();
|
|
105
105
|
const { theme } = useTheme();
|
|
106
|
+
const currentPageIndex = Math.max(0, Math.min(currentPage - 1, totalPages - 1));
|
|
106
107
|
const { viewportWidth, stripAnimatedStyle, isActive, isShrunk } = usePageIndicator({
|
|
107
|
-
currentPage,
|
|
108
|
+
currentPage: currentPageIndex,
|
|
108
109
|
totalPages,
|
|
109
110
|
dotSize: theme.sizes.s6,
|
|
110
111
|
gap: theme.spacings.s4,
|
|
@@ -19,23 +19,23 @@ const meta = {
|
|
|
19
19
|
export default meta;
|
|
20
20
|
export const Base = {
|
|
21
21
|
args: {
|
|
22
|
-
currentPage:
|
|
22
|
+
currentPage: 1,
|
|
23
23
|
totalPages: 5,
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
const InteractiveComponent = ({ totalPages }) => {
|
|
27
|
-
const [page, setPage] = useState(
|
|
27
|
+
const [page, setPage] = useState(1);
|
|
28
28
|
const { theme } = useTheme();
|
|
29
29
|
return (_jsxs(Box, { lx: { gap: 's16', alignItems: 'center', width: 'full' }, children: [_jsxs(Box, { lx: {
|
|
30
30
|
flexDirection: 'row',
|
|
31
31
|
gap: 's16',
|
|
32
32
|
alignItems: 'center',
|
|
33
33
|
justifyContent: 'center',
|
|
34
|
-
}, children: [_jsx(IconButton, { icon: ArrowLeft, size: 'xs', accessibilityLabel: 'Previous page', appearance: 'transparent', onPress: () => setPage((v) => Math.max(
|
|
34
|
+
}, children: [_jsx(IconButton, { icon: ArrowLeft, size: 'xs', accessibilityLabel: 'Previous page', appearance: 'transparent', onPress: () => setPage((v) => Math.max(1, v - 1)) }), _jsx(Text, { lx: { color: 'base', width: 's28', textAlign: 'center' }, style: { ...theme.typographies.heading2SemiBold }, children: page }), _jsx(IconButton, { icon: ArrowRight, size: 'xs', accessibilityLabel: 'Next page', appearance: 'transparent', onPress: () => setPage((v) => Math.min(totalPages, v + 1)) })] }), _jsx(PageIndicator, { currentPage: page, totalPages: totalPages })] }));
|
|
35
35
|
};
|
|
36
36
|
export const Interactive = {
|
|
37
37
|
args: {
|
|
38
|
-
currentPage:
|
|
38
|
+
currentPage: 1,
|
|
39
39
|
totalPages: 9,
|
|
40
40
|
},
|
|
41
41
|
render: (args) => _jsx(InteractiveComponent, { totalPages: args.totalPages }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BoxProps } from '../Utility';
|
|
2
2
|
export type PageIndicatorProps = {
|
|
3
3
|
/**
|
|
4
|
-
* The currently active page
|
|
4
|
+
* The currently active page. 1-based (first page is 1, second is 2, etc.).
|
|
5
5
|
*/
|
|
6
6
|
currentPage: number;
|
|
7
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart5 icon component for React Native.
|
|
3
|
+
*
|
|
4
|
+
* This icon component is automatically generated from SVG files and uses the createIcon utility
|
|
5
|
+
* to create a consistent icon interface. It supports all standard SVG props (from react-native-svg)
|
|
6
|
+
* and additional size variants defined in the Icon component.
|
|
7
|
+
*
|
|
8
|
+
* @component
|
|
9
|
+
* @param {16 | 20 | 24 | 40 | 48 | 56} [size=24] - The size of the icon in pixels.
|
|
10
|
+
* @param {string} [color] - The color of the icon.
|
|
11
|
+
* @param {SVGProps} [...props] - All standard SVG element props (from react-native-svg).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Basic usage with default size (24px)
|
|
15
|
+
* import { Chart5 } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
16
|
+
*
|
|
17
|
+
* <Chart5 />
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // With custom size and style
|
|
21
|
+
* <Chart5 size={40} color="warning" lx={{ marginTop: 's4' }} />
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Used within a Button component
|
|
25
|
+
* import { Button } from '@ledgerhq/lumen-ui-rnative';
|
|
26
|
+
*
|
|
27
|
+
* <Button icon={Chart5} size="md">
|
|
28
|
+
* Click me
|
|
29
|
+
* </Button>
|
|
30
|
+
*/
|
|
31
|
+
export declare const Chart5: {
|
|
32
|
+
(props: Omit<import("../../Components").IconProps, "children">): import("react").FunctionComponentElement<import("../../Components").IconProps>;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=Chart5.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart5.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Symbols/Icons/Chart5.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,MAAM;;;CAmBlB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Svg, { Path, Mask } from 'react-native-svg';
|
|
3
|
+
import createIcon from '../../Components/Icon/createIcon';
|
|
4
|
+
/**
|
|
5
|
+
* Chart5 icon component for React Native.
|
|
6
|
+
*
|
|
7
|
+
* This icon component is automatically generated from SVG files and uses the createIcon utility
|
|
8
|
+
* to create a consistent icon interface. It supports all standard SVG props (from react-native-svg)
|
|
9
|
+
* and additional size variants defined in the Icon component.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {16 | 20 | 24 | 40 | 48 | 56} [size=24] - The size of the icon in pixels.
|
|
13
|
+
* @param {string} [color] - The color of the icon.
|
|
14
|
+
* @param {SVGProps} [...props] - All standard SVG element props (from react-native-svg).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Basic usage with default size (24px)
|
|
18
|
+
* import { Chart5 } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
19
|
+
*
|
|
20
|
+
* <Chart5 />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With custom size and style
|
|
24
|
+
* <Chart5 size={40} color="warning" lx={{ marginTop: 's4' }} />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Used within a Button component
|
|
28
|
+
* import { Button } from '@ledgerhq/lumen-ui-rnative';
|
|
29
|
+
*
|
|
30
|
+
* <Button icon={Chart5} size="md">
|
|
31
|
+
* Click me
|
|
32
|
+
* </Button>
|
|
33
|
+
*/
|
|
34
|
+
export const Chart5 = createIcon('Chart5', _jsxs(Svg, { width: 24, height: 24, fill: 'currentColor', viewBox: '0 0 16 16', children: [_jsx(Path, { stroke: 'currentColor', strokeLinecap: 'round', strokeLinejoin: 'round', strokeWidth: 1.3, d: 'm3.96 10.313 2.562-2.639a.485.485 0 0 1 .712 0l1.082 1.114a.493.493 0 0 0 .713 0l3.012-3.101m-1.345.005h1.344v1.385' }), _jsx(Mask, { id: 'path-2-inside-1_8174_813', fill: '#fff', children: _jsx(Path, { d: 'M.9 3.672a2 2 0 0 1 2-2h10.2a2 2 0 0 1 2 2v8.656a2 2 0 0 1-2 2H2.9a2 2 0 0 1-2-2z' }) }), _jsx(Path, { fill: 'currentColor', d: 'M2.9 1.672v1.3h10.2v-2.6H2.9zm12.2 2h-1.3v8.656h2.6V3.672zm-2 10.656v-1.3H2.9v2.6h10.2zm-12.2-2h1.3V3.672H-.4v8.656zm2 2v-1.3a.7.7 0 0 1-.7-.7H-.4a3.3 3.3 0 0 0 3.3 3.3zm12.2-2h-1.3a.7.7 0 0 1-.7.7v2.6a3.3 3.3 0 0 0 3.3-3.3zm-2-10.656v1.3a.7.7 0 0 1 .7.7h2.6a3.3 3.3 0 0 0-3.3-3.3zm-10.2 0v-1.3a3.3 3.3 0 0 0-3.3 3.3h2.6a.7.7 0 0 1 .7-.7z', mask: 'url(#path-2-inside-1_8174_813)' })] }));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart5Fill icon component for React Native.
|
|
3
|
+
*
|
|
4
|
+
* This icon component is automatically generated from SVG files and uses the createIcon utility
|
|
5
|
+
* to create a consistent icon interface. It supports all standard SVG props (from react-native-svg)
|
|
6
|
+
* and additional size variants defined in the Icon component.
|
|
7
|
+
*
|
|
8
|
+
* @component
|
|
9
|
+
* @param {16 | 20 | 24 | 40 | 48 | 56} [size=24] - The size of the icon in pixels.
|
|
10
|
+
* @param {string} [color] - The color of the icon.
|
|
11
|
+
* @param {SVGProps} [...props] - All standard SVG element props (from react-native-svg).
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Basic usage with default size (24px)
|
|
15
|
+
* import { Chart5Fill } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
16
|
+
*
|
|
17
|
+
* <Chart5Fill />
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // With custom size and style
|
|
21
|
+
* <Chart5Fill size={40} color="warning" lx={{ marginTop: 's4' }} />
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Used within a Button component
|
|
25
|
+
* import { Button } from '@ledgerhq/lumen-ui-rnative';
|
|
26
|
+
*
|
|
27
|
+
* <Button icon={Chart5Fill} size="md">
|
|
28
|
+
* Click me
|
|
29
|
+
* </Button>
|
|
30
|
+
*/
|
|
31
|
+
export declare const Chart5Fill: {
|
|
32
|
+
(props: Omit<import("../../Components").IconProps, "children">): import("react").FunctionComponentElement<import("../../Components").IconProps>;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=Chart5Fill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart5Fill.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Symbols/Icons/Chart5Fill.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,UAAU;;;CAQtB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Svg, { Path } from 'react-native-svg';
|
|
3
|
+
import createIcon from '../../Components/Icon/createIcon';
|
|
4
|
+
/**
|
|
5
|
+
* Chart5Fill icon component for React Native.
|
|
6
|
+
*
|
|
7
|
+
* This icon component is automatically generated from SVG files and uses the createIcon utility
|
|
8
|
+
* to create a consistent icon interface. It supports all standard SVG props (from react-native-svg)
|
|
9
|
+
* and additional size variants defined in the Icon component.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {16 | 20 | 24 | 40 | 48 | 56} [size=24] - The size of the icon in pixels.
|
|
13
|
+
* @param {string} [color] - The color of the icon.
|
|
14
|
+
* @param {SVGProps} [...props] - All standard SVG element props (from react-native-svg).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Basic usage with default size (24px)
|
|
18
|
+
* import { Chart5Fill } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
19
|
+
*
|
|
20
|
+
* <Chart5Fill />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With custom size and style
|
|
24
|
+
* <Chart5Fill size={40} color="warning" lx={{ marginTop: 's4' }} />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Used within a Button component
|
|
28
|
+
* import { Button } from '@ledgerhq/lumen-ui-rnative';
|
|
29
|
+
*
|
|
30
|
+
* <Button icon={Chart5Fill} size="md">
|
|
31
|
+
* Click me
|
|
32
|
+
* </Button>
|
|
33
|
+
*/
|
|
34
|
+
export const Chart5Fill = createIcon('Chart5Fill', _jsx(Svg, { width: 24, height: 24, fill: 'currentColor', viewBox: '0 0 16 16', children: _jsx(Path, { fill: 'currentColor', d: 'M13.1 1.662a2 2 0 0 1 2 2v8.66a2 2 0 0 1-2 2H2.9a2 2 0 0 1-2-2v-8.66a2 2 0 0 1 2-2zm-2.404 3.379a.648.648 0 0 0-.173 1.273L8.672 8.22l-.97-1a1.134 1.134 0 0 0-1.646 0L3.493 9.86a.65.65 0 0 0 .934.905l2.45-2.527.974 1.002.088.082c.456.381 1.132.355 1.556-.082l1.925-1.982a.648.648 0 0 0 1.27-.183V5.691a.647.647 0 0 0-.709-.65z' }) }));
|