@ledgerhq/lumen-ui-rnative 0.0.51 → 0.0.53
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 +21 -1
- package/dist/src/i18n/locales/en.json +3 -0
- package/dist/src/i18n/locales/es.json +21 -1
- package/dist/src/i18n/locales/fr.json +4 -1
- package/dist/src/i18n/locales/ja.json +21 -1
- package/dist/src/i18n/locales/ko.json +21 -1
- package/dist/src/i18n/locales/pt.json +21 -1
- package/dist/src/i18n/locales/ru.json +21 -1
- package/dist/src/i18n/locales/th.json +21 -1
- package/dist/src/i18n/locales/tr.json +21 -1
- package/dist/src/i18n/locales/zh.json +21 -1
- package/dist/src/lib/Components/BaseInput/BaseInput.d.ts +1 -0
- package/dist/src/lib/Components/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/src/lib/Components/BaseInput/BaseInput.js +6 -2
- package/dist/src/lib/Components/BaseInput/types.d.ts +5 -1
- package/dist/src/lib/Components/BaseInput/types.d.ts.map +1 -1
- package/dist/src/lib/Components/SearchInput/SearchInput.d.ts +3 -1
- package/dist/src/lib/Components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/src/lib/Components/SearchInput/SearchInput.js +12 -2
- package/dist/src/lib/Components/SearchInput/SearchInput.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/SearchInput/SearchInput.stories.js +3 -0
- package/dist/src/lib/Components/SearchInput/types.d.ts +7 -1
- package/dist/src/lib/Components/SearchInput/types.d.ts.map +1 -1
- package/dist/src/lib/Components/Tile/Tile.d.ts.map +1 -1
- package/dist/src/lib/Components/Tile/Tile.js +1 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.d.ts +32 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.js +75 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.d.ts +11 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.js +107 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/index.d.ts +3 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/index.js +2 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/types.d.ts +32 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/types.js +1 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.d.ts +31 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.js +52 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.stories.d.ts +10 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.stories.js +101 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/index.d.ts +3 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/index.js +2 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/types.d.ts +32 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Gradient/RadialGradient/types.js +1 -0
- package/dist/src/lib/Components/Utility/Gradient/gradient.types.d.ts +21 -0
- package/dist/src/lib/Components/Utility/Gradient/gradient.types.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Gradient/gradient.types.js +1 -0
- package/dist/src/lib/Components/Utility/Gradient/utils/resolveGradientColor.d.ts +21 -0
- package/dist/src/lib/Components/Utility/Gradient/utils/resolveGradientColor.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Gradient/utils/resolveGradientColor.js +38 -0
- package/dist/src/lib/Components/Utility/index.d.ts +2 -0
- package/dist/src/lib/Components/Utility/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Utility/index.js +2 -0
- package/package.json +2 -2
- package/src/i18n/locales/de.json +22 -2
- package/src/i18n/locales/en.json +4 -1
- package/src/i18n/locales/es.json +22 -2
- package/src/i18n/locales/fr.json +5 -2
- package/src/i18n/locales/ja.json +22 -2
- package/src/i18n/locales/ko.json +22 -2
- package/src/i18n/locales/pt.json +22 -2
- package/src/i18n/locales/ru.json +22 -2
- package/src/i18n/locales/th.json +22 -2
- package/src/i18n/locales/tr.json +22 -2
- package/src/i18n/locales/zh.json +22 -2
- package/src/lib/Components/BaseInput/BaseInput.tsx +7 -2
- package/src/lib/Components/BaseInput/types.ts +5 -1
- package/src/lib/Components/SearchInput/SearchInput.stories.tsx +3 -0
- package/src/lib/Components/SearchInput/SearchInput.tsx +32 -8
- package/src/lib/Components/SearchInput/types.ts +7 -1
- package/src/lib/Components/Tile/Tile.tsx +1 -0
- package/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.mdx +142 -0
- package/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.tsx +173 -0
- package/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.test.tsx +69 -0
- package/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.tsx +127 -0
- package/src/lib/Components/Utility/Gradient/LinearGradient/index.ts +2 -0
- package/src/lib/Components/Utility/Gradient/LinearGradient/types.ts +42 -0
- package/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.mdx +109 -0
- package/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.stories.tsx +148 -0
- package/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.test.tsx +69 -0
- package/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.tsx +102 -0
- package/src/lib/Components/Utility/Gradient/RadialGradient/index.ts +2 -0
- package/src/lib/Components/Utility/Gradient/RadialGradient/types.ts +32 -0
- package/src/lib/Components/Utility/Gradient/gradient.types.ts +22 -0
- package/src/lib/Components/Utility/Gradient/utils/resolveGradientColor.test.ts +144 -0
- package/src/lib/Components/Utility/Gradient/utils/resolveGradientColor.ts +59 -0
- package/src/lib/Components/Utility/index.ts +2 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from 'src/styles';
|
|
3
|
+
import { Box } from '../../Box';
|
|
4
|
+
import { Text } from '../../Text';
|
|
5
|
+
import { LinearGradient } from './LinearGradient';
|
|
6
|
+
const meta = {
|
|
7
|
+
component: LinearGradient,
|
|
8
|
+
title: 'Utility/LinearGradient',
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
backgrounds: { default: 'light' },
|
|
12
|
+
docs: {
|
|
13
|
+
source: {
|
|
14
|
+
language: 'tsx',
|
|
15
|
+
format: true,
|
|
16
|
+
type: 'code',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
export const Base = {
|
|
23
|
+
args: {
|
|
24
|
+
direction: 'to-bottom',
|
|
25
|
+
stops: [{ color: 'accent' }, { color: 'active', opacity: 0 }],
|
|
26
|
+
lx: {
|
|
27
|
+
width: 's192',
|
|
28
|
+
height: 's56',
|
|
29
|
+
borderRadius: 'lg',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const DirectionShowcase = {
|
|
34
|
+
render: () => {
|
|
35
|
+
const orientations = [
|
|
36
|
+
'to-bottom',
|
|
37
|
+
'to-right',
|
|
38
|
+
'to-top',
|
|
39
|
+
'to-left',
|
|
40
|
+
'to-bottomright',
|
|
41
|
+
'to-bottomleft',
|
|
42
|
+
'to-topright',
|
|
43
|
+
'to-topleft',
|
|
44
|
+
0,
|
|
45
|
+
90,
|
|
46
|
+
180,
|
|
47
|
+
270,
|
|
48
|
+
];
|
|
49
|
+
return (_jsx(Box, { lx: { flexDirection: 'row', flexWrap: 'wrap', gap: 's20' }, children: orientations.map((orientation) => {
|
|
50
|
+
return (_jsxs(Box, { lx: { gap: 's4' }, children: [_jsx(LinearGradient, { direction: orientation, stops: [{ color: 'accent' }, { color: 'active', opacity: 0 }], lx: { height: 's40', width: 's176', borderRadius: 'md' } }), _jsx(Text, { typography: 'body4', lx: { color: 'base' }, children: orientation })] }, orientation));
|
|
51
|
+
}) }));
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
export const WithChildren = {
|
|
55
|
+
args: {
|
|
56
|
+
direction: 'to-bottomright',
|
|
57
|
+
stops: [{ color: 'accent' }, { color: 'active', opacity: 0, offset: 0.75 }],
|
|
58
|
+
lx: {
|
|
59
|
+
padding: 's24',
|
|
60
|
+
borderRadius: 'lg',
|
|
61
|
+
width: 's288',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
render: (args) => (_jsxs(LinearGradient, { ...args, children: [_jsx(Text, { typography: 'heading2SemiBold', lx: { color: 'base' }, children: "With Children" }), _jsx(Text, { typography: 'body2', lx: { color: 'base', marginTop: 's8' }, children: "Adapt height based on content." }), _jsx(Text, { typography: 'body3', lx: { color: 'base', marginTop: 's8' }, children: "Lorem ipsum dolor sit amet consectetur adipisicing elit consectetur adipisicing elit adipisicing elit. Mas adename labin anet." })] })),
|
|
65
|
+
};
|
|
66
|
+
export const WithMultipleStops = {
|
|
67
|
+
args: {
|
|
68
|
+
direction: 'to-right',
|
|
69
|
+
stops: [
|
|
70
|
+
{ color: 'accent', offset: 0, opacity: 1 },
|
|
71
|
+
{ color: 'warning', offset: 0.5, opacity: 1 },
|
|
72
|
+
{ color: 'errorStrong', offset: 1, opacity: 1 },
|
|
73
|
+
],
|
|
74
|
+
lx: {
|
|
75
|
+
borderRadius: 'md',
|
|
76
|
+
height: 's56',
|
|
77
|
+
width: 's288',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
render: (args) => {
|
|
81
|
+
const { theme } = useTheme();
|
|
82
|
+
console.log({ theme });
|
|
83
|
+
return (_jsxs(Box, { lx: { gap: 's12' }, children: [_jsx(LinearGradient, { ...args }), _jsxs(Box, { lx: { flexDirection: 'row', justifyContent: 'space-between' }, children: [_jsx(Text, { children: "accent" }), _jsx(Text, { children: "warning" }), _jsx(Text, { children: "errorStrong" })] })] }));
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
export const CryptoGradients = {
|
|
87
|
+
args: {
|
|
88
|
+
direction: 'to-bottomright',
|
|
89
|
+
lx: {
|
|
90
|
+
borderRadius: 'md',
|
|
91
|
+
height: 's56',
|
|
92
|
+
width: 's288',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
render: (args) => {
|
|
96
|
+
const { theme } = useTheme();
|
|
97
|
+
return (_jsx(Box, { lx: {
|
|
98
|
+
gap: 's20',
|
|
99
|
+
flexDirection: 'row',
|
|
100
|
+
flexWrap: 'wrap',
|
|
101
|
+
}, children: Object.entries(theme.colors.gradients.crypto).map(([key, gradient]) => (_jsxs(Box, { lx: { gap: 's4' }, children: [_jsx(LinearGradient, { ...args, lx: {
|
|
102
|
+
height: 's40',
|
|
103
|
+
width: 's176',
|
|
104
|
+
borderRadius: 'md',
|
|
105
|
+
}, stops: gradient }), _jsx(Text, { typography: 'body4', lx: { color: 'base' }, children: key })] }, key))) }));
|
|
106
|
+
},
|
|
107
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Utility/Gradient/LinearGradient/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyledViewProps } from '../../../../../styles';
|
|
3
|
+
import { GradientStop } from '../gradient.types';
|
|
4
|
+
export type GradientCoordinates = {
|
|
5
|
+
x1: string;
|
|
6
|
+
y1: string;
|
|
7
|
+
x2: string;
|
|
8
|
+
y2: string;
|
|
9
|
+
};
|
|
10
|
+
export type LinearGradientDirection = 'to-bottom' | 'to-top' | 'to-left' | 'to-right' | 'to-bottomright' | 'to-bottomleft' | 'to-topright' | 'to-topleft';
|
|
11
|
+
/**
|
|
12
|
+
* Props for the LinearGradient component.
|
|
13
|
+
*/
|
|
14
|
+
export type LinearGradientProps = {
|
|
15
|
+
/**
|
|
16
|
+
* Gradient color stops
|
|
17
|
+
*/
|
|
18
|
+
stops: GradientStop[];
|
|
19
|
+
/**
|
|
20
|
+
* Optional children to render on top of the gradient
|
|
21
|
+
*/
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Direction preset for the gradient.
|
|
25
|
+
* @default 'to-bottom'
|
|
26
|
+
*
|
|
27
|
+
* Can be a direction preset or a custom angle in degrees.
|
|
28
|
+
* 0° points to the right, 90° points down.
|
|
29
|
+
*/
|
|
30
|
+
direction?: LinearGradientDirection | number;
|
|
31
|
+
} & StyledViewProps;
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Utility/Gradient/LinearGradient/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAC/B,WAAW,GACX,QAAQ,GACR,SAAS,GACT,UAAU,GACV,gBAAgB,GAChB,eAAe,GACf,aAAa,GACb,YAAY,CAAC;AAEjB;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,uBAAuB,GAAG,MAAM,CAAC;CAC9C,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { View } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* RadialGradient - A container component that renders a radial gradient background.
|
|
4
|
+
*
|
|
5
|
+
* Uses react-native-svg to render gradients that work consistently across platforms.
|
|
6
|
+
* Extends Box, so it supports all lx style props for layout and sizing.
|
|
7
|
+
*
|
|
8
|
+
* @see {@link https://ldls.vercel.app/?path=/docs/utility-radialgradient--docs Storybook}
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import { RadialGradient } from '@ledgerhq/lumen-ui-rnative';
|
|
13
|
+
*
|
|
14
|
+
* // Basic usage (center to edge)
|
|
15
|
+
* <RadialGradient
|
|
16
|
+
* lx={{ height: 's200', borderRadius: 'lg' }}
|
|
17
|
+
* stops={[
|
|
18
|
+
* { color: '#845EC2', offset: 0 },
|
|
19
|
+
* { color: '#FF6F91', offset: 1 },
|
|
20
|
+
* ]}
|
|
21
|
+
* />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare const RadialGradient: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<{
|
|
25
|
+
stops: import("../gradient.types").GradientStop[];
|
|
26
|
+
children?: import("react").ReactNode;
|
|
27
|
+
center?: import("./types").RadialGradientCenter;
|
|
28
|
+
} & {
|
|
29
|
+
lx?: import("../../../../../styles").LumenViewStyle;
|
|
30
|
+
} & import("react-native").ViewProps & import("react").RefAttributes<View>>>;
|
|
31
|
+
//# sourceMappingURL=RadialGradient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadialGradient.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAsBzC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc;;;;;;4EAqD1B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, memo, useId, useMemo } from 'react';
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import Svg, { Defs, RadialGradient as SvgRadialGradient, Rect, Stop, } from 'react-native-svg';
|
|
5
|
+
import { useTheme } from '../../../../../styles';
|
|
6
|
+
import { Box } from '../../Box';
|
|
7
|
+
import { processGradientStops } from '../utils/resolveGradientColor';
|
|
8
|
+
const DEFAULT_CENTER = { x: 0.5, y: 0.5 };
|
|
9
|
+
const styles = StyleSheet.create({
|
|
10
|
+
gradient: {
|
|
11
|
+
...StyleSheet.absoluteFillObject,
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '100%',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* RadialGradient - A container component that renders a radial gradient background.
|
|
18
|
+
*
|
|
19
|
+
* Uses react-native-svg to render gradients that work consistently across platforms.
|
|
20
|
+
* Extends Box, so it supports all lx style props for layout and sizing.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link https://ldls.vercel.app/?path=/docs/utility-radialgradient--docs Storybook}
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* import { RadialGradient } from '@ledgerhq/lumen-ui-rnative';
|
|
27
|
+
*
|
|
28
|
+
* // Basic usage (center to edge)
|
|
29
|
+
* <RadialGradient
|
|
30
|
+
* lx={{ height: 's200', borderRadius: 'lg' }}
|
|
31
|
+
* stops={[
|
|
32
|
+
* { color: '#845EC2', offset: 0 },
|
|
33
|
+
* { color: '#FF6F91', offset: 1 },
|
|
34
|
+
* ]}
|
|
35
|
+
* />
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export const RadialGradient = memo(forwardRef(({ center = DEFAULT_CENTER, stops, children, lx = {}, ...props }, ref) => {
|
|
39
|
+
const gradientId = useId();
|
|
40
|
+
const { theme } = useTheme();
|
|
41
|
+
const processedStops = useMemo(() => {
|
|
42
|
+
return processGradientStops(stops, theme.colors.bg);
|
|
43
|
+
}, [stops, theme.colors.bg]);
|
|
44
|
+
const centerCoordinates = useMemo(() => {
|
|
45
|
+
return {
|
|
46
|
+
cx: `${center.x * 100}%`,
|
|
47
|
+
cy: `${center.y * 100}%`,
|
|
48
|
+
};
|
|
49
|
+
}, [center]);
|
|
50
|
+
return (_jsxs(Box, { ref: ref, lx: { overflow: 'hidden', ...lx }, ...props, children: [_jsxs(Svg, { style: styles.gradient, preserveAspectRatio: 'none', children: [_jsx(Defs, { children: _jsx(SvgRadialGradient, { id: gradientId, cx: centerCoordinates.cx, cy: centerCoordinates.cy, rx: '50%', ry: '50%', fx: centerCoordinates.cx, fy: centerCoordinates.cy, children: processedStops.map((stop, index) => (_jsx(Stop, { offset: `${stop.offset * 100}%`, stopColor: stop.color, stopOpacity: stop.opacity }, index))) }) }), _jsx(Rect, { x: '0', y: '0', width: '100%', height: '100%', fill: `url(#${gradientId})` })] }), children] }));
|
|
51
|
+
}));
|
|
52
|
+
RadialGradient.displayName = 'RadialGradient';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
+
import { RadialGradient } from './RadialGradient';
|
|
3
|
+
declare const meta: Meta<typeof RadialGradient>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof RadialGradient>;
|
|
6
|
+
export declare const Base: Story;
|
|
7
|
+
export declare const CenterPositionShowcase: Story;
|
|
8
|
+
export declare const WithChildren: Story;
|
|
9
|
+
export declare const WithMultipleStops: Story;
|
|
10
|
+
//# sourceMappingURL=RadialGradient.stories.d.ts.map
|
package/dist/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.stories.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadialGradient.stories.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAGvE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAcrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7C,eAAO,MAAM,IAAI,EAAE,KASlB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,KAuEpC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAwB1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAa/B,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '../../Box';
|
|
3
|
+
import { Text } from '../../Text';
|
|
4
|
+
import { RadialGradient } from './RadialGradient';
|
|
5
|
+
const meta = {
|
|
6
|
+
component: RadialGradient,
|
|
7
|
+
title: 'Utility/RadialGradient',
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered',
|
|
10
|
+
backgrounds: { default: 'light' },
|
|
11
|
+
docs: {
|
|
12
|
+
source: {
|
|
13
|
+
language: 'tsx',
|
|
14
|
+
format: true,
|
|
15
|
+
type: 'code',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
export const Base = {
|
|
22
|
+
args: {
|
|
23
|
+
stops: [{ color: 'accent' }, { color: 'active', opacity: 0 }],
|
|
24
|
+
lx: {
|
|
25
|
+
height: 's192',
|
|
26
|
+
width: 's192',
|
|
27
|
+
borderRadius: 'lg',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export const CenterPositionShowcase = {
|
|
32
|
+
render: () => {
|
|
33
|
+
const positions = [
|
|
34
|
+
{
|
|
35
|
+
title: 'Aspect ratio 1:1',
|
|
36
|
+
isSquare: true,
|
|
37
|
+
items: [
|
|
38
|
+
{
|
|
39
|
+
center: { x: 0.5, y: 0.5 },
|
|
40
|
+
label: '{x: 0.5, y: 0.5} (default)',
|
|
41
|
+
},
|
|
42
|
+
{ center: { x: 0.2, y: 0.2 }, label: '{x: 0.2, y: 0.2}' },
|
|
43
|
+
{ center: { x: 0.8, y: 0.8 }, label: '{x: 0.8, y: 0.8}' },
|
|
44
|
+
{ center: { x: 0.2, y: 0.8 }, label: '{x: 0.2, y: 0.8}' },
|
|
45
|
+
{ center: { x: 0.8, y: 0.2 }, label: '{x: 0.8, y: 0.2}' },
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: 'Aspect ratio 1:2',
|
|
50
|
+
isSquare: false,
|
|
51
|
+
items: [
|
|
52
|
+
{
|
|
53
|
+
center: { x: 0.5, y: 0.5 },
|
|
54
|
+
label: '{x: 0.5, y: 0.5} (default)',
|
|
55
|
+
},
|
|
56
|
+
{ center: { x: 0.2, y: 0.2 }, label: '{x: 0.2, y: 0.2}' },
|
|
57
|
+
{ center: { x: 0.8, y: 0.8 }, label: '{x: 0.8, y: 0.8}' },
|
|
58
|
+
{ center: { x: 0.2, y: 0.8 }, label: '{x: 0.2, y: 0.8}' },
|
|
59
|
+
{ center: { x: 0.8, y: 0.2 }, label: '{x: 0.8, y: 0.2}' },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
return (_jsx(Box, { lx: { flexDirection: 'column', gap: 's40' }, children: positions.map(({ title, isSquare, items }) => (_jsxs(Box, { children: [_jsx(Text, { typography: 'heading5SemiBold', lx: { color: 'base', marginBottom: 's16' }, children: title }), _jsx(Box, { lx: { flexDirection: 'row', flexWrap: 'wrap', gap: 's24' }, children: items.map(({ center, label }) => (_jsxs(Box, { lx: { gap: 's8', alignItems: 'center' }, children: [_jsx(RadialGradient, { center: center, stops: [
|
|
64
|
+
{ color: 'accent' },
|
|
65
|
+
{ color: 'active', opacity: 0 },
|
|
66
|
+
], lx: {
|
|
67
|
+
height: 's72',
|
|
68
|
+
width: isSquare ? 's72' : 's144',
|
|
69
|
+
borderRadius: 'md',
|
|
70
|
+
borderColor: 'active',
|
|
71
|
+
borderWidth: 's1',
|
|
72
|
+
} }), _jsx(Text, { typography: 'body4', lx: { color: 'base' }, children: label })] }, label))) })] }, title))) }));
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
export const WithChildren = {
|
|
76
|
+
args: {
|
|
77
|
+
stops: [{ color: 'accent' }, { color: 'active', opacity: 0 }],
|
|
78
|
+
lx: {
|
|
79
|
+
padding: 's24',
|
|
80
|
+
borderRadius: 'lg',
|
|
81
|
+
width: 's288',
|
|
82
|
+
borderColor: 'active',
|
|
83
|
+
borderWidth: 's1',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
render: (args) => (_jsxs(RadialGradient, { ...args, children: [_jsx(Text, { typography: 'heading2SemiBold', lx: { color: 'base' }, children: "With Children" }), _jsx(Text, { typography: 'body2', lx: { color: 'base', marginTop: 's8' }, children: "Adapt height based on content." }), _jsx(Text, { typography: 'body3', lx: { color: 'base', marginTop: 's8' }, children: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos" })] })),
|
|
87
|
+
};
|
|
88
|
+
export const WithMultipleStops = {
|
|
89
|
+
args: {
|
|
90
|
+
stops: [
|
|
91
|
+
{ color: 'warning', offset: 0, opacity: 1 },
|
|
92
|
+
{ color: 'accent', offset: 0.5, opacity: 1 },
|
|
93
|
+
{ color: 'error', offset: 1, opacity: 1 },
|
|
94
|
+
],
|
|
95
|
+
lx: {
|
|
96
|
+
height: 's80',
|
|
97
|
+
width: 's80',
|
|
98
|
+
borderRadius: 'full',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Utility/Gradient/RadialGradient/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StyledViewProps } from '../../../../../styles';
|
|
3
|
+
import { GradientStop } from '../gradient.types';
|
|
4
|
+
export type RadialGradientCenter = {
|
|
5
|
+
/**
|
|
6
|
+
* Horizontal position (0 = left, 1 = right)
|
|
7
|
+
*/
|
|
8
|
+
x: number;
|
|
9
|
+
/**
|
|
10
|
+
* Vertical position (0 = top, 1 = bottom)
|
|
11
|
+
*/
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
export type RadialGradientProps = {
|
|
15
|
+
/**
|
|
16
|
+
* Gradient color stops
|
|
17
|
+
* Takes an object of color, offset and opacity.
|
|
18
|
+
* Offset is a number between 0 and 1.
|
|
19
|
+
* Opacity is a number between 0 and 1.
|
|
20
|
+
*/
|
|
21
|
+
stops: GradientStop[];
|
|
22
|
+
/**
|
|
23
|
+
* Optional children to render on top of the gradient
|
|
24
|
+
*/
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Center position of the gradient.
|
|
28
|
+
* @default { x: 0.5, y: 0.5 }
|
|
29
|
+
*/
|
|
30
|
+
center?: RadialGradientCenter;
|
|
31
|
+
} & StyledViewProps;
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Utility/Gradient/RadialGradient/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;OAKG;IACH,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LumenStyleSheetTheme } from '../../../../styles';
|
|
2
|
+
/**
|
|
3
|
+
* Background color token from the theme
|
|
4
|
+
*/
|
|
5
|
+
export type BackgroundColorToken = keyof LumenStyleSheetTheme['colors']['bg'];
|
|
6
|
+
export type GradientStop = {
|
|
7
|
+
/**
|
|
8
|
+
* Color value - can be a design token key (e.g., 'accent', 'error')
|
|
9
|
+
* or a raw color string (e.g., '#FF6B6B', 'rgba(...)')
|
|
10
|
+
*/
|
|
11
|
+
color: BackgroundColorToken | (string & {});
|
|
12
|
+
/**
|
|
13
|
+
* Position of the stop (0-1). If omitted, stops are auto-spread evenly.
|
|
14
|
+
*/
|
|
15
|
+
offset?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Opacity of the color (0-1).
|
|
18
|
+
*/
|
|
19
|
+
opacity?: number;
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=gradient.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Utility/Gradient/gradient.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,oBAAoB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;AAE9E,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,KAAK,EAAE,oBAAoB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC5C;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LumenStyleSheetTheme } from '../../../../../styles';
|
|
2
|
+
import type { GradientStop } from '../gradient.types';
|
|
3
|
+
type BackgroundColors = LumenStyleSheetTheme['colors']['bg'];
|
|
4
|
+
/**
|
|
5
|
+
* Resolves a gradient stop color to a concrete color value.
|
|
6
|
+
* If the color is a design token, it's resolved from the theme.
|
|
7
|
+
* If it's a raw color string, it's returned as-is.
|
|
8
|
+
*/
|
|
9
|
+
export declare const resolveGradientColor: (color: string, bgColors: BackgroundColors) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Processes gradient stops by:
|
|
12
|
+
* 1. Resolving color tokens to actual values
|
|
13
|
+
* 2. Auto-spreading offsets if not provided
|
|
14
|
+
*/
|
|
15
|
+
export declare const processGradientStops: (stops: GradientStop[], bgColors: BackgroundColors) => Array<{
|
|
16
|
+
color: string;
|
|
17
|
+
offset: number;
|
|
18
|
+
opacity: number;
|
|
19
|
+
}>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=resolveGradientColor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveGradientColor.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Utility/Gradient/utils/resolveGradientColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAwB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE5E,KAAK,gBAAgB,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC;AAI7D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,EACb,UAAU,gBAAgB,KACzB,MAMF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,YAAY,EAAE,EACrB,UAAU,gBAAgB,KACzB,KAAK,CAAC;IACP,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAuBA,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const DEFAULT_OPACITY = 1;
|
|
2
|
+
const DEFAULT_OFFSET = 0;
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a gradient stop color to a concrete color value.
|
|
5
|
+
* If the color is a design token, it's resolved from the theme.
|
|
6
|
+
* If it's a raw color string, it's returned as-is.
|
|
7
|
+
*/
|
|
8
|
+
export const resolveGradientColor = (color, bgColors) => {
|
|
9
|
+
const isBackgroundToken = color in bgColors;
|
|
10
|
+
if (isBackgroundToken) {
|
|
11
|
+
return bgColors[color];
|
|
12
|
+
}
|
|
13
|
+
return color;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Processes gradient stops by:
|
|
17
|
+
* 1. Resolving color tokens to actual values
|
|
18
|
+
* 2. Auto-spreading offsets if not provided
|
|
19
|
+
*/
|
|
20
|
+
export const processGradientStops = (stops, bgColors) => {
|
|
21
|
+
const stopCount = stops.length;
|
|
22
|
+
return stops.map((stop, index) => {
|
|
23
|
+
const resolvedColor = resolveGradientColor(stop.color, bgColors);
|
|
24
|
+
// Auto-spread offsets if not provided
|
|
25
|
+
// For n stops: 0, 1/(n-1), 2/(n-1), ..., 1
|
|
26
|
+
const offset = stop.offset !== undefined
|
|
27
|
+
? stop.offset
|
|
28
|
+
: stopCount === 1
|
|
29
|
+
? DEFAULT_OFFSET
|
|
30
|
+
: index / (stopCount - 1);
|
|
31
|
+
const opacity = stop.opacity !== undefined ? stop.opacity : DEFAULT_OPACITY;
|
|
32
|
+
return {
|
|
33
|
+
color: resolvedColor,
|
|
34
|
+
offset,
|
|
35
|
+
opacity,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Utility/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Utility/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-rnative",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@gorhom/bottom-sheet": "^5.0.0",
|
|
36
|
-
"@ledgerhq/lumen-design-core": "0.0.
|
|
36
|
+
"@ledgerhq/lumen-design-core": "0.0.41",
|
|
37
37
|
"react": "~18.3.1",
|
|
38
38
|
"react-native": "~0.77.3",
|
|
39
39
|
"react-native-reanimated": "^3.0.0",
|
package/src/i18n/locales/de.json
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"components": {
|
|
3
|
-
|
|
2
|
+
"components": {
|
|
3
|
+
"addressInput": {
|
|
4
|
+
"qrCodeAriaLabel": "QR-Code scannen"
|
|
5
|
+
},
|
|
6
|
+
"baseInput": {
|
|
7
|
+
"clearInputAriaLabel": "Eingabe löschen"
|
|
8
|
+
},
|
|
9
|
+
"spinner": {
|
|
10
|
+
"loadingAriaLabel": "Wird geladen"
|
|
11
|
+
},
|
|
12
|
+
"bottomSheetHeader": {
|
|
13
|
+
"goBackAriaLabel": "Zurück",
|
|
14
|
+
"closeAriaLabel": "Schließen"
|
|
15
|
+
},
|
|
16
|
+
"banner": {
|
|
17
|
+
"closeAriaLabel": "Schließen"
|
|
18
|
+
},
|
|
19
|
+
"link": {
|
|
20
|
+
"opensInNewTabAriaLabel": "(Öffnet in neuem Tab)"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/i18n/locales/en.json
CHANGED
package/src/i18n/locales/es.json
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"components": {
|
|
3
|
-
|
|
2
|
+
"components": {
|
|
3
|
+
"addressInput": {
|
|
4
|
+
"qrCodeAriaLabel": "Escanear código QR"
|
|
5
|
+
},
|
|
6
|
+
"baseInput": {
|
|
7
|
+
"clearInputAriaLabel": "Borrar entrada"
|
|
8
|
+
},
|
|
9
|
+
"spinner": {
|
|
10
|
+
"loadingAriaLabel": "Cargando"
|
|
11
|
+
},
|
|
12
|
+
"bottomSheetHeader": {
|
|
13
|
+
"goBackAriaLabel": "Volver",
|
|
14
|
+
"closeAriaLabel": "Cerrar"
|
|
15
|
+
},
|
|
16
|
+
"banner": {
|
|
17
|
+
"closeAriaLabel": "Cerrar"
|
|
18
|
+
},
|
|
19
|
+
"link": {
|
|
20
|
+
"opensInNewTabAriaLabel": "(se abre en una pestaña nueva)"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/i18n/locales/fr.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"components": {
|
|
3
3
|
"addressInput": {
|
|
4
|
-
"qrCodeAriaLabel": "Scanner le QR
|
|
4
|
+
"qrCodeAriaLabel": "Scanner le code QR"
|
|
5
5
|
},
|
|
6
6
|
"baseInput": {
|
|
7
7
|
"clearInputAriaLabel": "Effacer la saisie"
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
},
|
|
16
16
|
"banner": {
|
|
17
17
|
"closeAriaLabel": "Fermer"
|
|
18
|
+
},
|
|
19
|
+
"link": {
|
|
20
|
+
"opensInNewTabAriaLabel": "(s'ouvre dans un nouvel onglet)"
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
|
-
}
|
|
23
|
+
}
|