@ledgerhq/lumen-ui-rnative 0.0.71 → 0.0.73
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/.storybook/preview-head.html +1 -0
- package/dist/package.json +3 -3
- package/dist/src/i18n/locales/de.json +3 -0
- package/dist/src/i18n/locales/en.json +3 -0
- package/dist/src/i18n/locales/es.json +3 -0
- package/dist/src/i18n/locales/fr.json +3 -0
- package/dist/src/i18n/locales/ja.json +3 -0
- package/dist/src/i18n/locales/ko.json +3 -0
- package/dist/src/i18n/locales/pt.json +3 -0
- package/dist/src/i18n/locales/ru.json +3 -0
- package/dist/src/i18n/locales/th.json +3 -0
- package/dist/src/i18n/locales/tr.json +3 -0
- package/dist/src/i18n/locales/zh.json +3 -0
- package/dist/src/lib/Components/BottomSheet/BottomSheet.stories.d.ts +4 -0
- package/dist/src/lib/Components/BottomSheet/BottomSheet.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/BottomSheet/BottomSheet.stories.js +4 -0
- package/dist/src/lib/Components/Icon/Icon.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/Icon.js +1 -0
- package/dist/src/lib/Components/Icon/Icon.stories.js +1 -1
- package/dist/src/lib/Components/Icon/types.d.ts +1 -1
- package/dist/src/lib/Components/Icon/types.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.js +10 -2
- package/dist/src/lib/Components/InteractiveIcon/types.d.ts +17 -0
- package/dist/src/lib/Components/InteractiveIcon/types.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/types.js +24 -1
- package/dist/src/lib/Components/Skeleton/Skeleton.d.ts +21 -0
- package/dist/src/lib/Components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/src/lib/Components/Skeleton/Skeleton.js +81 -0
- package/dist/src/lib/Components/Skeleton/Skeleton.stories.d.ts +11 -0
- package/dist/src/lib/Components/Skeleton/Skeleton.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Skeleton/Skeleton.stories.js +49 -0
- package/dist/src/lib/Components/Skeleton/index.d.ts +3 -0
- package/dist/src/lib/Components/Skeleton/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Skeleton/index.js +2 -0
- package/dist/src/lib/Components/Skeleton/types.d.ts +10 -0
- package/dist/src/lib/Components/Skeleton/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Skeleton/types.js +1 -0
- package/dist/src/lib/Components/Stepper/Stepper.d.ts +16 -0
- package/dist/src/lib/Components/Stepper/Stepper.d.ts.map +1 -0
- package/dist/src/lib/Components/Stepper/Stepper.js +74 -0
- package/dist/src/lib/Components/Stepper/Stepper.stories.d.ts +9 -0
- package/dist/src/lib/Components/Stepper/Stepper.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Stepper/Stepper.stories.js +35 -0
- package/dist/src/lib/Components/Stepper/index.d.ts +3 -0
- package/dist/src/lib/Components/Stepper/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Stepper/index.js +2 -0
- package/dist/src/lib/Components/Stepper/types.d.ts +21 -0
- package/dist/src/lib/Components/Stepper/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Stepper/types.js +1 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.js +0 -2
- package/dist/src/lib/Components/index.d.ts +3 -0
- package/dist/src/lib/Components/index.d.ts.map +1 -1
- package/dist/src/lib/Components/index.js +3 -0
- package/package.json +3 -3
- package/src/i18n/locales/de.json +3 -0
- package/src/i18n/locales/en.json +3 -0
- package/src/i18n/locales/es.json +3 -0
- package/src/i18n/locales/fr.json +3 -0
- package/src/i18n/locales/ja.json +3 -0
- package/src/i18n/locales/ko.json +3 -0
- package/src/i18n/locales/pt.json +3 -0
- package/src/i18n/locales/ru.json +3 -0
- package/src/i18n/locales/th.json +3 -0
- package/src/i18n/locales/tr.json +3 -0
- package/src/i18n/locales/zh.json +3 -0
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +4 -0
- package/src/lib/Components/Icon/Icon.stories.tsx +1 -1
- package/src/lib/Components/Icon/Icon.test.tsx +1 -1
- package/src/lib/Components/Icon/Icon.tsx +1 -0
- package/src/lib/Components/Icon/types.ts +1 -1
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.tsx +15 -2
- package/src/lib/Components/InteractiveIcon/types.ts +47 -0
- package/src/lib/Components/Skeleton/Skeleton.mdx +200 -0
- package/src/lib/Components/Skeleton/Skeleton.stories.tsx +89 -0
- package/src/lib/Components/Skeleton/Skeleton.test.tsx +54 -0
- package/src/lib/Components/Skeleton/Skeleton.tsx +137 -0
- package/src/lib/Components/Skeleton/index.ts +2 -0
- package/src/lib/Components/Skeleton/types.ts +10 -0
- package/src/lib/Components/Stepper/Stepper.mdx +217 -0
- package/src/lib/Components/Stepper/Stepper.stories.tsx +62 -0
- package/src/lib/Components/Stepper/Stepper.test.tsx +132 -0
- package/src/lib/Components/Stepper/Stepper.tsx +159 -0
- package/src/lib/Components/Stepper/index.ts +2 -0
- package/src/lib/Components/Stepper/types.ts +21 -0
- package/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.tsx +0 -2
- package/src/lib/Components/index.ts +3 -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.72",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"./styles": "./src/styles/index.ts"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ledgerhq/lumen-utils-shared": "0.0.
|
|
30
|
+
"@ledgerhq/lumen-utils-shared": "0.0.19",
|
|
31
31
|
"i18next": "^23.7.0",
|
|
32
32
|
"react-i18next": "^14.0.0"
|
|
33
33
|
},
|
|
@@ -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.52",
|
|
41
41
|
"react": "^19.0.0",
|
|
42
42
|
"react-native": "~0.79.7",
|
|
43
43
|
"react-native-reanimated": "^3.0.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/BottomSheet/BottomSheet.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAU5C,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"BottomSheet.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/BottomSheet/BottomSheet.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAU5C,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8E0B,CAAC;AAErC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C,eAAO,MAAM,IAAI,EAAE,KAmDlB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAiD3B,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,KAwC5C,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,KAwCzC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KA4C1B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KA2CxB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAoEzB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAkF7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Icon/Icon.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAY,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Icon/Icon.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAY,MAAM,SAAS,CAAC;AAsC9C,eAAO,MAAM,IAAI;4DAQd,SAAS;;CAkBX,CAAC"}
|
|
@@ -8,7 +8,7 @@ const meta = {
|
|
|
8
8
|
title: 'Symbols/Interface Icons',
|
|
9
9
|
};
|
|
10
10
|
export default meta;
|
|
11
|
-
const sizes = [12, 16, 20, 24, 40, 48, 56];
|
|
11
|
+
const sizes = [12, 16, 20, 24, 32, 40, 48, 56];
|
|
12
12
|
const iconNames = Object.keys(Icons);
|
|
13
13
|
const IconCard = ({ name, size = 24, color }) => {
|
|
14
14
|
const { theme } = useTheme();
|
|
@@ -2,7 +2,7 @@ import { Ref } from 'react';
|
|
|
2
2
|
import { Svg, SvgProps } from 'react-native-svg';
|
|
3
3
|
import { LumenTextStyle } from '../../../styles';
|
|
4
4
|
import { TextProps } from '../Utility';
|
|
5
|
-
export type IconSize = 12 | 16 | 20 | 24 | 40 | 48 | 56;
|
|
5
|
+
export type IconSize = 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56;
|
|
6
6
|
export type IconProps = {
|
|
7
7
|
/**
|
|
8
8
|
* The size of the icon.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Icon/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Icon/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE7D,MAAM,MAAM,SAAS,GAAG;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;CAChB,GAAG,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,GACxB,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -29,7 +29,7 @@ import { InteractiveIconProps } from './types';
|
|
|
29
29
|
* </InteractiveIcon>
|
|
30
30
|
*/
|
|
31
31
|
export declare const InteractiveIcon: {
|
|
32
|
-
({ iconType, children, disabled, style, lx, ...props }: InteractiveIconProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
({ iconType, children, disabled, hitSlop: hitSlopProp, hitSlopType, style, lx, ...props }: InteractiveIconProps): import("react/jsx-runtime").JSX.Element;
|
|
33
33
|
displayName: string;
|
|
34
34
|
};
|
|
35
35
|
//# sourceMappingURL=InteractiveIcon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractiveIcon.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/InteractiveIcon/InteractiveIcon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InteractiveIcon.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/InteractiveIcon/InteractiveIcon.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAgB,oBAAoB,EAAE,MAAM,SAAS,CAAC;AA0C7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,eAAe;+FASzB,oBAAoB;;CA+BtB,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Children, isValidElement } from 'react';
|
|
2
3
|
import { StyleSheet, View } from 'react-native';
|
|
3
4
|
import { useStyleSheet } from '../../../styles';
|
|
4
5
|
import { InjectStylesIntoChildren } from '../../utils/components/InjectStylesIntoChildren';
|
|
5
6
|
import { Pressable } from '../Utility';
|
|
7
|
+
import { HIT_SLOP_MAP } from './types';
|
|
6
8
|
const useStyles = ({ iconType, pressed, disabled, }) => {
|
|
7
9
|
return useStyleSheet((t) => {
|
|
8
10
|
const backgroundStyle = {
|
|
@@ -57,8 +59,14 @@ const useStyles = ({ iconType, pressed, disabled, }) => {
|
|
|
57
59
|
* <Settings size={20} />
|
|
58
60
|
* </InteractiveIcon>
|
|
59
61
|
*/
|
|
60
|
-
export const InteractiveIcon = ({ iconType, children, disabled = false, style, lx, ...props }) => {
|
|
61
|
-
|
|
62
|
+
export const InteractiveIcon = ({ iconType, children, disabled = false, hitSlop: hitSlopProp, hitSlopType = 'comfortable', style, lx, ...props }) => {
|
|
63
|
+
const child = Children.only(children);
|
|
64
|
+
let iconSize = 20;
|
|
65
|
+
if (isValidElement(child) && 'size' in child.props) {
|
|
66
|
+
iconSize = child.props.size ?? 20;
|
|
67
|
+
}
|
|
68
|
+
const resolvedHitSlop = hitSlopProp ?? HIT_SLOP_MAP[hitSlopType]?.[iconSize];
|
|
69
|
+
return (_jsx(Pressable, { lx: lx, style: [style, { alignItems: 'center', justifyContent: 'center' }], accessibilityRole: 'button', accessibilityState: { disabled: !!disabled }, disabled: disabled, hitSlop: resolvedHitSlop, ...props, children: ({ pressed }) => (_jsx(InteractiveIconContent, { iconType: iconType, pressed: pressed, disabled: !!disabled, children: children })) }));
|
|
62
70
|
};
|
|
63
71
|
const InteractiveIconContent = ({ iconType, pressed, disabled, children, }) => {
|
|
64
72
|
const styles = useStyles({ iconType, pressed, disabled });
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { Insets } from 'react-native';
|
|
2
3
|
import { StyledPressableProps } from '../../../styles';
|
|
4
|
+
import { IconSize } from '../Icon';
|
|
5
|
+
export declare const HIT_SLOP_MAP: Partial<Record<HitSlopType, Partial<Record<IconSize, Insets>>>>;
|
|
6
|
+
/**
|
|
7
|
+
* Preset for the touchable area around the icon.
|
|
8
|
+
* - `comfortable`: Increases hit area across both axes in a 1:1 ratio.
|
|
9
|
+
* - `compact-horizontal`: Larger hit area on the horizontal axis.
|
|
10
|
+
* - `compact-vertical`: Larger hit area on the vertical axis.
|
|
11
|
+
*/
|
|
12
|
+
export type HitSlopType = 'comfortable' | 'compact-horizontal' | 'compact-vertical';
|
|
3
13
|
export type InteractiveIconProps = {
|
|
4
14
|
/**
|
|
5
15
|
* The visual style of the icon button.
|
|
6
16
|
* Choose 'filled' for icons with solid backgrounds or 'stroked' for outlined icons.
|
|
7
17
|
*/
|
|
8
18
|
iconType: 'filled' | 'stroked';
|
|
19
|
+
/**
|
|
20
|
+
* Preset for the touchable area. Ignored if `hitSlop` is passed explicitly.
|
|
21
|
+
* Automatically applies insets based on the child's icon size.
|
|
22
|
+
*
|
|
23
|
+
* @default 'comfortable'
|
|
24
|
+
*/
|
|
25
|
+
hitSlopType?: HitSlopType;
|
|
9
26
|
} & PropsWithChildren & Omit<StyledPressableProps, 'children'>;
|
|
10
27
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/InteractiveIcon/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/InteractiveIcon/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,eAAO,MAAM,YAAY,EAAE,OAAO,CAChC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAwBvD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB,aAAa,GACb,oBAAoB,GACpB,kBAAkB,CAAC;AAEvB,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC/B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,GAAG,iBAAiB,GACnB,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export const HIT_SLOP_MAP = {
|
|
2
|
+
comfortable: {
|
|
3
|
+
12: { top: 16, bottom: 16, left: 16, right: 16 },
|
|
4
|
+
16: { top: 14, bottom: 14, left: 14, right: 14 },
|
|
5
|
+
20: { top: 12, bottom: 12, left: 12, right: 12 },
|
|
6
|
+
24: { top: 10, bottom: 10, left: 10, right: 10 },
|
|
7
|
+
32: { top: 6, bottom: 6, left: 6, right: 6 },
|
|
8
|
+
40: { top: 2, bottom: 2, left: 2, right: 2 },
|
|
9
|
+
},
|
|
10
|
+
'compact-vertical': {
|
|
11
|
+
12: { top: 14, bottom: 14, left: 10, right: 10 },
|
|
12
|
+
16: { top: 12, bottom: 12, left: 8, right: 8 },
|
|
13
|
+
20: { top: 10, bottom: 10, left: 6, right: 6 },
|
|
14
|
+
24: { top: 8, bottom: 8, left: 4, right: 4 },
|
|
15
|
+
32: { top: 4, bottom: 4, left: 0, right: 0 },
|
|
16
|
+
},
|
|
17
|
+
'compact-horizontal': {
|
|
18
|
+
12: { top: 10, bottom: 10, left: 14, right: 14 },
|
|
19
|
+
16: { top: 8, bottom: 8, left: 12, right: 12 },
|
|
20
|
+
20: { top: 6, bottom: 6, left: 10, right: 10 },
|
|
21
|
+
24: { top: 4, bottom: 4, left: 8, right: 8 },
|
|
22
|
+
32: { top: 0, bottom: 0, left: 4, right: 4 },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SkeletonProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A skeleton component that displays a pulsing placeholder for loading content.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <Skeleton lx={{ height: 's16', width: 's256' }} />
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // List item variant
|
|
10
|
+
* <Skeleton component='list-item' lx={{ width: 's320' }} />
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Tile variant
|
|
14
|
+
* <Skeleton component='tile' />
|
|
15
|
+
*/
|
|
16
|
+
declare const Skeleton: {
|
|
17
|
+
({ lx, component, ...props }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
20
|
+
export { Skeleton };
|
|
21
|
+
//# sourceMappingURL=Skeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Skeleton/Skeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAmG7C;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,QAAQ;kCAAiC,aAAa;;CAkB3D,CAAC;AAGF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Pulse } from '../../Animations/Pulse';
|
|
3
|
+
import { Box } from '../Utility';
|
|
4
|
+
/** Internal base skeleton element */
|
|
5
|
+
const BaseSkeleton = ({ lx, ...props }) => {
|
|
6
|
+
return (_jsx(Box, { lx: {
|
|
7
|
+
borderRadius: 'md',
|
|
8
|
+
backgroundColor: 'mutedTransparent',
|
|
9
|
+
...lx,
|
|
10
|
+
}, ...props }));
|
|
11
|
+
};
|
|
12
|
+
BaseSkeleton.displayName = 'BaseSkeleton';
|
|
13
|
+
const ListItemSkeleton = ({ lx, ...props }) => {
|
|
14
|
+
return (_jsxs(Box, { lx: {
|
|
15
|
+
flexDirection: 'row',
|
|
16
|
+
width: 'full',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
gap: 's16',
|
|
19
|
+
paddingVertical: 's8',
|
|
20
|
+
...lx,
|
|
21
|
+
}, ...props, children: [_jsx(BaseSkeleton, { lx: {
|
|
22
|
+
width: 's48',
|
|
23
|
+
height: 's48',
|
|
24
|
+
borderRadius: 'full',
|
|
25
|
+
flexShrink: 0,
|
|
26
|
+
} }), _jsxs(Box, { lx: { flex: 1, flexDirection: 'column', gap: 's10' }, children: [_jsx(BaseSkeleton, { lx: { height: 's12', width: 's176', borderRadius: 'full' } }), _jsx(BaseSkeleton, { lx: { height: 's12', width: 's112', borderRadius: 'full' } })] })] }));
|
|
27
|
+
};
|
|
28
|
+
ListItemSkeleton.displayName = 'ListItemSkeleton';
|
|
29
|
+
const TileSkeleton = ({ lx, ...props }) => {
|
|
30
|
+
return (_jsxs(Box, { lx: {
|
|
31
|
+
flexDirection: 'column',
|
|
32
|
+
width: 's112',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
gap: 's12',
|
|
35
|
+
borderRadius: 'md',
|
|
36
|
+
paddingHorizontal: 's8',
|
|
37
|
+
paddingVertical: 's16',
|
|
38
|
+
...lx,
|
|
39
|
+
}, ...props, children: [_jsx(BaseSkeleton, { lx: {
|
|
40
|
+
width: 's48',
|
|
41
|
+
height: 's48',
|
|
42
|
+
borderRadius: 'full',
|
|
43
|
+
flexShrink: 0,
|
|
44
|
+
} }), _jsxs(Box, { lx: {
|
|
45
|
+
width: 'full',
|
|
46
|
+
flexDirection: 'column',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
gap: 's8',
|
|
49
|
+
}, children: [_jsx(BaseSkeleton, { lx: { height: 's12', width: 's48', borderRadius: 'full' } }), _jsx(BaseSkeleton, { lx: { height: 's12', width: 's64', borderRadius: 'full' } })] })] }));
|
|
50
|
+
};
|
|
51
|
+
TileSkeleton.displayName = 'TileSkeleton';
|
|
52
|
+
const componentsMap = {
|
|
53
|
+
'list-item': ListItemSkeleton,
|
|
54
|
+
tile: TileSkeleton,
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* A skeleton component that displays a pulsing placeholder for loading content.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* <Skeleton lx={{ height: 's16', width: 's256' }} />
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // List item variant
|
|
64
|
+
* <Skeleton component='list-item' lx={{ width: 's320' }} />
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Tile variant
|
|
68
|
+
* <Skeleton component='tile' />
|
|
69
|
+
*/
|
|
70
|
+
const Skeleton = ({ lx, component, ...props }) => {
|
|
71
|
+
/**
|
|
72
|
+
* Check if the component is a valid pre-built variant and return the corresponding component.
|
|
73
|
+
*/
|
|
74
|
+
if (component && componentsMap[component]) {
|
|
75
|
+
const Component = componentsMap[component];
|
|
76
|
+
return (_jsx(Pulse, { animate: true, children: _jsx(Component, { ...props, lx: lx }) }));
|
|
77
|
+
}
|
|
78
|
+
return (_jsx(Pulse, { animate: true, children: _jsx(BaseSkeleton, { testID: 'skeleton', lx: lx, ...props }) }));
|
|
79
|
+
};
|
|
80
|
+
Skeleton.displayName = 'Skeleton';
|
|
81
|
+
export { Skeleton };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
+
import { Skeleton } from './Skeleton';
|
|
3
|
+
declare const meta: Meta<typeof Skeleton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Skeleton>;
|
|
6
|
+
export declare const Base: Story;
|
|
7
|
+
export declare const WithListItem: Story;
|
|
8
|
+
export declare const WithTile: Story;
|
|
9
|
+
export declare const SizeShowcase: Story;
|
|
10
|
+
export declare const ShapeShowcase: Story;
|
|
11
|
+
//# sourceMappingURL=Skeleton.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Skeleton/Skeleton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAa/B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEvC,eAAO,MAAM,IAAI,EAAE,KAelB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAM1B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAMtB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAe1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAgB3B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '../Utility/Box';
|
|
3
|
+
import { Skeleton } from './Skeleton';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Communication/Skeleton',
|
|
6
|
+
component: Skeleton,
|
|
7
|
+
parameters: {
|
|
8
|
+
actions: { disable: true },
|
|
9
|
+
},
|
|
10
|
+
argTypes: {
|
|
11
|
+
component: {
|
|
12
|
+
control: 'select',
|
|
13
|
+
options: [undefined, 'list-item', 'tile'],
|
|
14
|
+
description: 'Pre-built skeleton component variant',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
export const Base = {
|
|
20
|
+
args: {
|
|
21
|
+
lx: {
|
|
22
|
+
height: 's16',
|
|
23
|
+
width: 's256',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
render: (args) => (_jsx(Box, { lx: { padding: 's16', backgroundColor: 'canvas', borderRadius: 'md' }, children: _jsx(Skeleton, { component: args.component, lx: args.component ? undefined : args.lx }) })),
|
|
27
|
+
};
|
|
28
|
+
export const WithListItem = {
|
|
29
|
+
render: () => (_jsx(Box, { lx: { padding: 's16', backgroundColor: 'canvas', borderRadius: 'md' }, children: _jsx(Skeleton, { component: 'list-item' }) })),
|
|
30
|
+
};
|
|
31
|
+
export const WithTile = {
|
|
32
|
+
render: () => (_jsx(Box, { lx: { padding: 's16', backgroundColor: 'canvas', borderRadius: 'md' }, children: _jsx(Skeleton, { component: 'tile' }) })),
|
|
33
|
+
};
|
|
34
|
+
export const SizeShowcase = {
|
|
35
|
+
render: () => (_jsxs(Box, { lx: {
|
|
36
|
+
padding: 's16',
|
|
37
|
+
backgroundColor: 'canvas',
|
|
38
|
+
borderRadius: 'md',
|
|
39
|
+
gap: 's4',
|
|
40
|
+
}, children: [_jsx(Skeleton, { lx: { height: 's40', width: 's56' } }), _jsx(Skeleton, { lx: { height: 's12', width: 's112' } }), _jsx(Skeleton, { lx: { height: 's128', width: 's256' } })] })),
|
|
41
|
+
};
|
|
42
|
+
export const ShapeShowcase = {
|
|
43
|
+
render: () => (_jsxs(Box, { lx: {
|
|
44
|
+
padding: 's16',
|
|
45
|
+
backgroundColor: 'canvas',
|
|
46
|
+
borderRadius: 'md',
|
|
47
|
+
gap: 's4',
|
|
48
|
+
}, children: [_jsx(Skeleton, { lx: { height: 's40', width: 's256', borderRadius: 'none' } }), _jsx(Skeleton, { lx: { height: 's40', width: 's256', borderRadius: 'lg' } }), _jsx(Skeleton, { lx: { width: 's48', height: 's48', borderRadius: 'full' } }), _jsx(Skeleton, { lx: { width: 's48', height: 's48', borderRadius: 'md' } })] })),
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Skeleton/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StyledViewProps } from '../../../styles';
|
|
2
|
+
export type SkeletonProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Pre-built skeleton component variant
|
|
5
|
+
* - `list-item`: Horizontal layout with circle and two text lines
|
|
6
|
+
* - `tile`: Vertical centered layout with circle and two text lines in a rounded container
|
|
7
|
+
*/
|
|
8
|
+
component?: 'list-item' | 'tile';
|
|
9
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Skeleton/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;CAClC,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StepperProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A circular stepper component showing progress as current step out of total steps.
|
|
4
|
+
* Renders a track arc with a progress arc and a center label.
|
|
5
|
+
*
|
|
6
|
+
* @see [Figma – Stepper](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=11977-94&m=dev)
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <Stepper currentStep={1} totalSteps={4} />
|
|
10
|
+
* <Stepper currentStep={0} totalSteps={9} disabled /> // Shows minimal dot, disabled style
|
|
11
|
+
*/
|
|
12
|
+
export declare const Stepper: {
|
|
13
|
+
({ lx, currentStep, totalSteps, disabled, label, ref, ...props }: StepperProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=Stepper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Stepper/Stepper.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO;sEAQjB,YAAY;;CA2Hd,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { getStepperCalculations } from '@ledgerhq/lumen-utils-shared';
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
import { Animated, Easing } from 'react-native';
|
|
5
|
+
import Svg, { Circle } from 'react-native-svg';
|
|
6
|
+
import { useCommonTranslation } from '../../../i18n';
|
|
7
|
+
import { useTheme } from '../../../styles';
|
|
8
|
+
import { Box } from '../Utility/Box';
|
|
9
|
+
import { Text } from '../Utility/Text';
|
|
10
|
+
const SIZE = 48;
|
|
11
|
+
const STROKE_WIDTH = 4;
|
|
12
|
+
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
13
|
+
/**
|
|
14
|
+
* A circular stepper component showing progress as current step out of total steps.
|
|
15
|
+
* Renders a track arc with a progress arc and a center label.
|
|
16
|
+
*
|
|
17
|
+
* @see [Figma – Stepper](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=11977-94&m=dev)
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Stepper currentStep={1} totalSteps={4} />
|
|
21
|
+
* <Stepper currentStep={0} totalSteps={9} disabled /> // Shows minimal dot, disabled style
|
|
22
|
+
*/
|
|
23
|
+
export const Stepper = ({ lx = {}, currentStep, totalSteps, disabled = false, label, ref, ...props }) => {
|
|
24
|
+
const { t } = useCommonTranslation();
|
|
25
|
+
const { theme } = useTheme();
|
|
26
|
+
const { displayLabel, r, cx, cy, trackDashArray, progressDashArray, progressDashOffset, } = getStepperCalculations({
|
|
27
|
+
currentStep,
|
|
28
|
+
totalSteps,
|
|
29
|
+
size: SIZE,
|
|
30
|
+
label,
|
|
31
|
+
strokeWidth: STROKE_WIDTH,
|
|
32
|
+
});
|
|
33
|
+
const animatedOffset = useRef(new Animated.Value(progressDashOffset)).current;
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const animation = Animated.timing(animatedOffset, {
|
|
36
|
+
toValue: progressDashOffset,
|
|
37
|
+
duration: 300,
|
|
38
|
+
easing: Easing.inOut(Easing.ease),
|
|
39
|
+
useNativeDriver: false,
|
|
40
|
+
});
|
|
41
|
+
animation.start();
|
|
42
|
+
return () => animation.stop();
|
|
43
|
+
}, [progressDashOffset, animatedOffset]);
|
|
44
|
+
return (_jsxs(Box, { ref: ref, accessibilityRole: 'progressbar', accessibilityValue: {
|
|
45
|
+
now: currentStep,
|
|
46
|
+
min: 1,
|
|
47
|
+
max: totalSteps,
|
|
48
|
+
text: displayLabel,
|
|
49
|
+
}, accessibilityLabel: label ??
|
|
50
|
+
t('components.stepper.progressAriaLabel', {
|
|
51
|
+
currentStep: Math.min(Math.max(currentStep, 0), totalSteps),
|
|
52
|
+
totalSteps,
|
|
53
|
+
}), lx: {
|
|
54
|
+
width: 's48',
|
|
55
|
+
height: 's48',
|
|
56
|
+
flexShrink: 0,
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
borderRadius: 'full',
|
|
60
|
+
...lx,
|
|
61
|
+
}, ...props, children: [_jsxs(Svg, { width: SIZE, height: SIZE, viewBox: `0 0 ${SIZE} ${SIZE}`, style: { transform: [{ rotate: '135deg' }] }, children: [_jsx(Circle, { cx: cx, cy: cy, r: r, fill: 'none', stroke: theme.colors.border.mutedSubtle, strokeLinecap: 'round', strokeWidth: STROKE_WIDTH, strokeDasharray: trackDashArray, strokeDashoffset: 0 }), _jsx(AnimatedCircle, { cx: cx, cy: cy, r: r, fill: 'none', stroke: disabled
|
|
62
|
+
? theme.colors.border.mutedSubtleHover
|
|
63
|
+
: theme.colors.border.active, strokeLinecap: 'round', strokeWidth: STROKE_WIDTH, strokeDasharray: progressDashArray, strokeDashoffset: animatedOffset })] }), _jsx(Box, { lx: {
|
|
64
|
+
position: 'absolute',
|
|
65
|
+
alignItems: 'center',
|
|
66
|
+
justifyContent: 'center',
|
|
67
|
+
flexDirection: 'row',
|
|
68
|
+
top: 's0',
|
|
69
|
+
left: 's0',
|
|
70
|
+
right: 's0',
|
|
71
|
+
bottom: 's0',
|
|
72
|
+
}, children: label ? (_jsx(Text, { typography: 'body2SemiBold', lx: { color: 'base' }, children: label })) : (_jsxs(_Fragment, { children: [_jsx(Text, { typography: 'body1SemiBold', lx: { color: 'base' }, children: Math.min(Math.max(currentStep, 0), totalSteps) }), _jsxs(Text, { typography: 'body2SemiBold', lx: { color: 'muted' }, children: ["/", totalSteps] })] })) })] }));
|
|
73
|
+
};
|
|
74
|
+
Stepper.displayName = 'Stepper';
|