@ledgerhq/lumen-ui-rnative 0.0.71 → 0.0.72
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 +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/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/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 +1 -1
- 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/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/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.71",
|
|
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",
|
|
@@ -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';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
+
import { Stepper } from './Stepper';
|
|
3
|
+
declare const meta: Meta<typeof Stepper>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Stepper>;
|
|
6
|
+
export declare const Base: Story;
|
|
7
|
+
export declare const DisabledShowcase: Story;
|
|
8
|
+
export declare const WithCustomLabel: Story;
|
|
9
|
+
//# sourceMappingURL=Stepper.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stepper.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Stepper/Stepper.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAW9B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAC;AAEtC,eAAO,MAAM,IAAI,EAAE,KAMlB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAuB9B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAO7B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '../Utility/Box';
|
|
3
|
+
import { Text } from '../Utility/Text';
|
|
4
|
+
import { Stepper } from './Stepper';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Communication/Stepper',
|
|
7
|
+
component: Stepper,
|
|
8
|
+
parameters: {
|
|
9
|
+
actions: { disable: true },
|
|
10
|
+
},
|
|
11
|
+
argTypes: {
|
|
12
|
+
currentStep: { control: 'number' },
|
|
13
|
+
totalSteps: { control: 'number' },
|
|
14
|
+
disabled: { control: 'boolean' },
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
export const Base = {
|
|
19
|
+
args: {
|
|
20
|
+
currentStep: 2,
|
|
21
|
+
totalSteps: 4,
|
|
22
|
+
},
|
|
23
|
+
render: (args) => _jsx(Stepper, { ...args }),
|
|
24
|
+
};
|
|
25
|
+
export const DisabledShowcase = {
|
|
26
|
+
render: () => (_jsxs(Box, { lx: { gap: 's32', alignItems: 'center' }, children: [_jsxs(Box, { lx: { alignItems: 'center', gap: 's8' }, children: [_jsx(Text, { typography: 'body3', lx: { color: 'muted' }, children: "Default (2/4)" }), _jsx(Stepper, { currentStep: 2, totalSteps: 4 })] }), _jsxs(Box, { lx: { alignItems: 'center', gap: 's8' }, children: [_jsx(Text, { typography: 'body3', lx: { color: 'muted' }, children: "Disabled (2/4)" }), _jsx(Stepper, { currentStep: 2, totalSteps: 4, disabled: true })] }), _jsxs(Box, { lx: { alignItems: 'center', gap: 's8' }, children: [_jsx(Text, { typography: 'body3', lx: { color: 'muted' }, children: "Unstarted (0/9)" }), _jsx(Stepper, { currentStep: 0, totalSteps: 9 })] })] })),
|
|
27
|
+
};
|
|
28
|
+
export const WithCustomLabel = {
|
|
29
|
+
args: {
|
|
30
|
+
currentStep: 5,
|
|
31
|
+
totalSteps: 5,
|
|
32
|
+
label: '🎉',
|
|
33
|
+
},
|
|
34
|
+
render: (args) => _jsx(Stepper, { ...args }),
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Stepper/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StyledViewProps } from '../../../styles';
|
|
2
|
+
export type StepperProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Current step number (1-based). Use 0 or negative to show minimal dot (before starting).
|
|
5
|
+
*/
|
|
6
|
+
currentStep: number;
|
|
7
|
+
/**
|
|
8
|
+
* Total number of steps.
|
|
9
|
+
*/
|
|
10
|
+
totalSteps: number;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the stepper is disabled. Changes the progress arc to a muted style.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Optional custom label. Defaults to "{currentStep}/{totalSteps}".
|
|
18
|
+
*/
|
|
19
|
+
label?: string;
|
|
20
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Stepper/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -17,7 +17,10 @@ export * from './NavBar';
|
|
|
17
17
|
export * from './PageIndicator';
|
|
18
18
|
export * from './SearchInput';
|
|
19
19
|
export * from './Select';
|
|
20
|
+
export * from './Skeleton';
|
|
21
|
+
export * from './Spinner';
|
|
20
22
|
export * from './Spot';
|
|
23
|
+
export * from './Stepper';
|
|
21
24
|
export * from './Subheader';
|
|
22
25
|
export * from './Switch';
|
|
23
26
|
export * from './TabBar';
|
|
@@ -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,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,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,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"}
|
|
@@ -17,7 +17,10 @@ export * from './NavBar';
|
|
|
17
17
|
export * from './PageIndicator';
|
|
18
18
|
export * from './SearchInput';
|
|
19
19
|
export * from './Select';
|
|
20
|
+
export * from './Skeleton';
|
|
21
|
+
export * from './Spinner';
|
|
20
22
|
export * from './Spot';
|
|
23
|
+
export * from './Stepper';
|
|
21
24
|
export * from './Subheader';
|
|
22
25
|
export * from './Switch';
|
|
23
26
|
export * from './TabBar';
|
package/package.json
CHANGED
package/src/i18n/locales/de.json
CHANGED
package/src/i18n/locales/en.json
CHANGED
package/src/i18n/locales/es.json
CHANGED
package/src/i18n/locales/fr.json
CHANGED