@ledgerhq/lumen-ui-rnative 0.1.51 → 0.1.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/module/index.js +1 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.figma.js +3 -6
- package/dist/module/lib/Components/Avatar/Avatar.figma.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.js +92 -39
- package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.mdx +36 -191
- package/dist/module/lib/Components/Avatar/Avatar.stories.js +80 -125
- package/dist/module/lib/Components/Avatar/Avatar.stories.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.test.js +56 -45
- package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
- package/dist/module/lib/Components/Avatar/index.js +1 -0
- package/dist/module/lib/Components/Avatar/index.js.map +1 -1
- package/dist/module/lib/Components/Avatar/resolveAvatarColor.js +18 -0
- package/dist/module/lib/Components/Avatar/resolveAvatarColor.js.map +1 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.js +77 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.js.map +1 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.mdx +62 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.stories.js +59 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.stories.js.map +1 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.test.js +100 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.test.js.map +1 -0
- package/dist/module/lib/Components/AvatarButton/index.js +5 -0
- package/dist/module/lib/Components/AvatarButton/index.js.map +1 -0
- package/dist/module/lib/Components/AvatarButton/types.js +4 -0
- package/dist/module/lib/Components/AvatarButton/types.js.map +1 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js +4 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +133 -2
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js +114 -7
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js +150 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheetContent.js +35 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheetContent.js.map +1 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheetFooter.js +43 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheetFooter.js.map +1 -0
- package/dist/module/lib/Components/BottomSheet/Scrollables.js +18 -3
- package/dist/module/lib/Components/BottomSheet/Scrollables.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/index.js +2 -0
- package/dist/module/lib/Components/BottomSheet/index.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.js +16 -1
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.test.js +16 -0
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.test.js.map +1 -1
- package/dist/module/lib/Components/MediaBanner/MediaBanner.js +55 -37
- package/dist/module/lib/Components/MediaBanner/MediaBanner.js.map +1 -1
- package/dist/module/lib/Components/MediaBanner/MediaBanner.mdx +25 -3
- package/dist/module/lib/Components/MediaBanner/MediaBanner.stories.js +23 -0
- package/dist/module/lib/Components/MediaBanner/MediaBanner.stories.js.map +1 -1
- package/dist/module/lib/Components/MediaBanner/MediaBanner.test.js +17 -0
- package/dist/module/lib/Components/MediaBanner/MediaBanner.test.js.map +1 -1
- package/dist/module/lib/Components/index.js +1 -0
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/typescript/src/index.d.ts +1 -1
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts +3 -3
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/index.d.ts +1 -0
- package/dist/typescript/src/lib/Components/Avatar/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/resolveAvatarColor.d.ts +8 -0
- package/dist/typescript/src/lib/Components/Avatar/resolveAvatarColor.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Avatar/types.d.ts +22 -7
- package/dist/typescript/src/lib/Components/Avatar/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AvatarButton/AvatarButton.d.ts +13 -0
- package/dist/typescript/src/lib/Components/AvatarButton/AvatarButton.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/AvatarButton/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/AvatarButton/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/AvatarButton/types.d.ts +11 -0
- package/dist/typescript/src/lib/Components/AvatarButton/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts +8 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetContent.d.ts +3 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetContent.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetFooter.d.ts +3 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetFooter.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/Scrollables.d.ts +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/Scrollables.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/index.d.ts +2 -0
- package/dist/typescript/src/lib/Components/BottomSheet/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts +2 -0
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIndicator/getDotIndicatorProps.d.ts +32 -0
- package/dist/typescript/src/lib/Components/DotIndicator/getDotIndicatorProps.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaBanner/MediaBanner.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaBanner/MediaBanner.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaBanner/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaBanner/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/index.d.ts +1 -0
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/lib/Components/Avatar/Avatar.figma.tsx +2 -5
- package/src/lib/Components/Avatar/Avatar.mdx +36 -191
- package/src/lib/Components/Avatar/Avatar.stories.tsx +58 -83
- package/src/lib/Components/Avatar/Avatar.test.tsx +58 -58
- package/src/lib/Components/Avatar/Avatar.tsx +100 -32
- package/src/lib/Components/Avatar/index.ts +1 -0
- package/src/lib/Components/Avatar/resolveAvatarColor.ts +19 -0
- package/src/lib/Components/Avatar/types.ts +23 -7
- package/src/lib/Components/AvatarButton/AvatarButton.mdx +62 -0
- package/src/lib/Components/AvatarButton/AvatarButton.stories.tsx +58 -0
- package/src/lib/Components/AvatarButton/AvatarButton.test.tsx +92 -0
- package/src/lib/Components/AvatarButton/AvatarButton.tsx +77 -0
- package/src/lib/Components/AvatarButton/index.ts +2 -0
- package/src/lib/Components/AvatarButton/types.ts +15 -0
- package/src/lib/Components/BottomSheet/BottomSheet.mdx +133 -2
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +111 -5
- package/src/lib/Components/BottomSheet/BottomSheet.test.tsx +140 -0
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +25 -9
- package/src/lib/Components/BottomSheet/BottomSheetContent.tsx +44 -0
- package/src/lib/Components/BottomSheet/BottomSheetFooter.tsx +47 -0
- package/src/lib/Components/BottomSheet/Scrollables.tsx +25 -12
- package/src/lib/Components/BottomSheet/index.ts +2 -0
- package/src/lib/Components/BottomSheet/types.ts +2 -1
- package/src/lib/Components/DotIndicator/getDotIndicatorProps.test.ts +16 -0
- package/src/lib/Components/DotIndicator/getDotIndicatorProps.ts +6 -2
- package/src/lib/Components/MediaBanner/MediaBanner.mdx +25 -3
- package/src/lib/Components/MediaBanner/MediaBanner.stories.tsx +25 -0
- package/src/lib/Components/MediaBanner/MediaBanner.test.tsx +18 -0
- package/src/lib/Components/MediaBanner/MediaBanner.tsx +54 -32
- package/src/lib/Components/MediaBanner/types.ts +1 -1
- package/src/lib/Components/index.ts +1 -0
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export declare const getDotIndicatorProps: <Context extends "avatar", Variant extends keyof {
|
|
2
2
|
avatar: {
|
|
3
|
+
xs: {
|
|
4
|
+
size: "sm";
|
|
5
|
+
appearance: "red";
|
|
6
|
+
};
|
|
3
7
|
sm: {
|
|
4
8
|
size: "lg";
|
|
5
9
|
appearance: "red";
|
|
@@ -8,9 +12,25 @@ export declare const getDotIndicatorProps: <Context extends "avatar", Variant ex
|
|
|
8
12
|
size: "xl";
|
|
9
13
|
appearance: "red";
|
|
10
14
|
};
|
|
15
|
+
lg: {
|
|
16
|
+
size: "xl";
|
|
17
|
+
appearance: "red";
|
|
18
|
+
};
|
|
19
|
+
xl: {
|
|
20
|
+
size: "xl";
|
|
21
|
+
appearance: "red";
|
|
22
|
+
};
|
|
23
|
+
'2xl': {
|
|
24
|
+
size: "xl";
|
|
25
|
+
appearance: "red";
|
|
26
|
+
};
|
|
11
27
|
};
|
|
12
28
|
}[Context]>(context: Context, variant: Variant) => {
|
|
13
29
|
avatar: {
|
|
30
|
+
xs: {
|
|
31
|
+
size: "sm";
|
|
32
|
+
appearance: "red";
|
|
33
|
+
};
|
|
14
34
|
sm: {
|
|
15
35
|
size: "lg";
|
|
16
36
|
appearance: "red";
|
|
@@ -19,6 +39,18 @@ export declare const getDotIndicatorProps: <Context extends "avatar", Variant ex
|
|
|
19
39
|
size: "xl";
|
|
20
40
|
appearance: "red";
|
|
21
41
|
};
|
|
42
|
+
lg: {
|
|
43
|
+
size: "xl";
|
|
44
|
+
appearance: "red";
|
|
45
|
+
};
|
|
46
|
+
xl: {
|
|
47
|
+
size: "xl";
|
|
48
|
+
appearance: "red";
|
|
49
|
+
};
|
|
50
|
+
'2xl': {
|
|
51
|
+
size: "xl";
|
|
52
|
+
appearance: "red";
|
|
53
|
+
};
|
|
22
54
|
};
|
|
23
55
|
}[Context][Variant];
|
|
24
56
|
//# sourceMappingURL=getDotIndicatorProps.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDotIndicatorProps.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/DotIndicator/getDotIndicatorProps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getDotIndicatorProps.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/DotIndicator/getDotIndicatorProps.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAS/B,CAAC"}
|
|
@@ -4,7 +4,7 @@ import type { MediaBannerDescriptionProps, MediaBannerProps, MediaBannerTitlePro
|
|
|
4
4
|
*
|
|
5
5
|
* @see {@link https://ldls-react-native.vercel.app/?path=/docs/rnative-mediabanner--docs Storybook}
|
|
6
6
|
*/
|
|
7
|
-
export declare function MediaBanner({ lx, style, imageUrl, onClose, closeAccessibilityLabel, children, ...props }: MediaBannerProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function MediaBanner({ lx, style, imageUrl, onPress, onClose, closeAccessibilityLabel, children, ...props }: MediaBannerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
/**
|
|
9
9
|
* The title of the MediaBanner. Clamps at 1 line.
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaBanner.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaBanner/MediaBanner.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,KAAK,EACL,QAAQ,EACR,OAAO,EACP,uBAAuB,EACvB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"MediaBanner.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaBanner/MediaBanner.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,uBAAuB,EACvB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,gBAAgB,2CA6GlB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,EAAE,EACF,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,2CAgBvB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,EAAE,EACF,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,2BAA2B,2CAqB7B"}
|
|
@@ -20,7 +20,7 @@ export type MediaBannerProps = {
|
|
|
20
20
|
* The banner content (MediaBannerTitle, MediaBannerDescription).
|
|
21
21
|
*/
|
|
22
22
|
children: ReactNode;
|
|
23
|
-
} & Omit<StyledPressableProps, 'children'>;
|
|
23
|
+
} & Omit<StyledPressableProps, 'children' | 'disabled'>;
|
|
24
24
|
/**
|
|
25
25
|
* Props for the MediaBannerTitle component.
|
|
26
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaBanner/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaBanner/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,UAAU,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -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,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,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,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,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,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,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,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-rnative",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.53",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"!**/*.tsbuildinfo"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ledgerhq/lumen-utils-shared": "0.1.
|
|
45
|
+
"@ledgerhq/lumen-utils-shared": "0.1.10",
|
|
46
46
|
"i18next": "^23.7.0",
|
|
47
47
|
"react-i18next": "^14.0.0"
|
|
48
48
|
},
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@types/react": "^19.0.0",
|
|
54
54
|
"@gorhom/bottom-sheet": "^5.0.0",
|
|
55
|
-
"@ledgerhq/lumen-design-core": "0.1.
|
|
55
|
+
"@ledgerhq/lumen-design-core": "0.1.23",
|
|
56
56
|
"react": "^19.0.0",
|
|
57
57
|
"react-native": "~0.81.6",
|
|
58
58
|
"react-native-reanimated": "^4.1.0",
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { type SupportedLocale, Languages } from './i18n';
|
|
2
|
-
export { RuntimeConstants } from './lib/utils';
|
|
2
|
+
export { RuntimeConstants, useControllableState } from './lib/utils';
|
|
3
3
|
export { useTheme, useStyleSheet } from './styles';
|
|
4
4
|
export * from './lib/Components';
|
|
5
5
|
export * from './lib/Animations';
|
|
@@ -10,15 +10,13 @@ figma.connect(
|
|
|
10
10
|
"import { Avatar, DotIndicator, getDotIndicatorProps } from '@ledgerhq/lumen-ui-rnative'",
|
|
11
11
|
],
|
|
12
12
|
props: {
|
|
13
|
-
appearance: figma.enum('appearance', {
|
|
14
|
-
gray: 'gray',
|
|
15
|
-
transparent: 'transparent',
|
|
16
|
-
}),
|
|
17
13
|
size: figma.enum('size', {
|
|
14
|
+
xs: 'xs',
|
|
18
15
|
sm: 'sm',
|
|
19
16
|
md: 'md',
|
|
20
17
|
lg: 'lg',
|
|
21
18
|
xl: 'xl',
|
|
19
|
+
'2xl': '2xl',
|
|
22
20
|
}),
|
|
23
21
|
showNotification: figma.boolean('show-notification'),
|
|
24
22
|
},
|
|
@@ -26,7 +24,6 @@ figma.connect(
|
|
|
26
24
|
const avatar = (
|
|
27
25
|
<Avatar
|
|
28
26
|
src='https://example-image.com'
|
|
29
|
-
appearance={props.appearance}
|
|
30
27
|
size={props.size}
|
|
31
28
|
alt="John Doe's Avatar"
|
|
32
29
|
/>
|
|
@@ -13,7 +13,7 @@ import { Box } from '../Utility';
|
|
|
13
13
|
|
|
14
14
|
## Introduction
|
|
15
15
|
|
|
16
|
-
The Avatar component displays a circular user profile image with automatic fallback
|
|
16
|
+
The Avatar component displays a circular user profile image with automatic fallback (initials or a User icon) when the image is unavailable or fails to load. It supports an optional notification indicator and six size variants.
|
|
17
17
|
|
|
18
18
|
> View in [Figma](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=10546-614&p=f&m=dev).
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ The Avatar component displays a circular user profile image with automatic fallb
|
|
|
23
23
|
|
|
24
24
|
- **Image/Fallback Icon**: The circular user image or User icon fallback displayed when image is unavailable
|
|
25
25
|
- **Notification Indicator (optional)**: A red dot positioned at the top-right corner to indicate notifications
|
|
26
|
-
- **Container**: Rounded
|
|
26
|
+
- **Container**: Rounded-full container with a subtle bordered background, or a solid `fallbackColor` when showing a fallback
|
|
27
27
|
|
|
28
28
|
## Properties
|
|
29
29
|
|
|
@@ -34,27 +34,26 @@ The Avatar component displays a circular user profile image with automatic fallb
|
|
|
34
34
|
|
|
35
35
|
### Size
|
|
36
36
|
|
|
37
|
-
Avatars come in
|
|
37
|
+
Avatars come in six sizes: `xs`, `sm`, `md`, `lg`, `xl`, and `2xl`.
|
|
38
38
|
|
|
39
39
|
<Canvas of={AvatarStories.SizeShowcase} />
|
|
40
40
|
|
|
41
|
-
###
|
|
41
|
+
### Fallback
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
When no image is shown, the Avatar renders a fallback. Provide `fallbackText` for initials, and pass a `fallbackColor` to give each user a stable background color.
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
- **`transparent`**: Uses a semi-transparent muted background — default
|
|
45
|
+
<Canvas of={AvatarStories.FallbackShowcase} />
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
### Appearance
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
Use `appearance` to display an inset ring around the avatar. Two variants are available:
|
|
51
50
|
|
|
52
|
-
|
|
51
|
+
- `thin` — 1px ring, `border-icon` color
|
|
52
|
+
- `thick` — 2px ring, `border-muted-subtle-transparent` color
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
- **Fallback**: Shows a User icon when `src` is undefined or the image fails to load
|
|
54
|
+
Omit the prop (or leave it `undefined`) for no ring.
|
|
56
55
|
|
|
57
|
-
<Canvas of={AvatarStories.
|
|
56
|
+
<Canvas of={AvatarStories.AppearanceShowcase} />
|
|
58
57
|
|
|
59
58
|
### Notification Indicator
|
|
60
59
|
|
|
@@ -71,27 +70,13 @@ import { Avatar, DotIndicator, getDotIndicatorProps } from '@ledgerhq/lumen-ui-r
|
|
|
71
70
|
</DotIndicator>;
|
|
72
71
|
```
|
|
73
72
|
|
|
74
|
-
> The notification dot is only supported on the `sm` and `md` sizes.
|
|
75
|
-
|
|
76
|
-
> When the dot conveys state to the user, pass an `accessibilityLabel` to `DotIndicator`.
|
|
77
|
-
|
|
78
73
|
<Canvas of={AvatarStories.NotificationShowcase} />
|
|
79
74
|
|
|
80
|
-
### As Interactive Trigger
|
|
81
|
-
|
|
82
|
-
Avatars are commonly used as interactive triggers for navigation or actions:
|
|
83
|
-
|
|
84
|
-
<Canvas of={AvatarStories.InteractiveShowcase} />
|
|
85
|
-
|
|
86
75
|
## Accessibility
|
|
87
76
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
- **Text zoom support**
|
|
92
|
-
- **Semantic alt text for images**
|
|
93
|
-
- **Screen reader announcements for notification state**
|
|
94
|
-
- **Touch target sizing** (minimum 44px)
|
|
77
|
+
- Renders with `accessibilityRole="image"` and exposes `alt` as `accessibilityLabel`.
|
|
78
|
+
- Provide a meaningful `alt` describing the user (e.g. `"John Doe's profile picture"`).
|
|
79
|
+
- When using `DotIndicator` for notifications, pass an `accessibilityLabel` to it so the notification state is announced by screen readers.
|
|
95
80
|
|
|
96
81
|
</Tab>
|
|
97
82
|
<Tab label="Implementation">
|
|
@@ -100,7 +85,7 @@ To be implemented:
|
|
|
100
85
|
|
|
101
86
|
Install and set up the library with our [Setup Guide →](?path=/docs/getting-started-setup--docs).
|
|
102
87
|
|
|
103
|
-
|
|
88
|
+
## Basic Usage
|
|
104
89
|
|
|
105
90
|
```tsx
|
|
106
91
|
import { Avatar } from '@ledgerhq/lumen-ui-rnative';
|
|
@@ -110,22 +95,21 @@ function MyComponent() {
|
|
|
110
95
|
}
|
|
111
96
|
```
|
|
112
97
|
|
|
113
|
-
|
|
98
|
+
## Fallback with Initials and Color
|
|
114
99
|
|
|
115
|
-
|
|
100
|
+
Use `fallbackText` for initials and `fallbackColor` for a stable per-user background:
|
|
116
101
|
|
|
117
102
|
```tsx
|
|
118
|
-
import { Avatar } from '@ledgerhq/lumen-ui-rnative';
|
|
103
|
+
import { Avatar, resolveAvatarColor } from '@ledgerhq/lumen-ui-rnative';
|
|
119
104
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
105
|
+
<Avatar
|
|
106
|
+
fallbackColor={resolveAvatarColor(user.id)}
|
|
107
|
+
fallbackText={user.initials}
|
|
108
|
+
alt={user.name}
|
|
109
|
+
/>;
|
|
124
110
|
```
|
|
125
111
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
Wrap the Avatar in a `DotIndicator` to show a status or alert dot, using `getDotIndicatorProps` to match the dot to the avatar size:
|
|
112
|
+
## With Notification
|
|
129
113
|
|
|
130
114
|
```tsx
|
|
131
115
|
import { Avatar, DotIndicator, getDotIndicatorProps } from '@ledgerhq/lumen-ui-rnative';
|
|
@@ -146,9 +130,16 @@ function MyComponent() {
|
|
|
146
130
|
}
|
|
147
131
|
```
|
|
148
132
|
|
|
149
|
-
|
|
133
|
+
## Appearance
|
|
150
134
|
|
|
151
|
-
|
|
135
|
+
Use the `appearance` prop to display a predefined inset ring:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
<Avatar src="https://example.com/photo.jpg" size="md" appearance="thin" />
|
|
139
|
+
<Avatar src="https://example.com/photo.jpg" size="md" appearance="thick" />
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Different Sizes
|
|
152
143
|
|
|
153
144
|
```tsx
|
|
154
145
|
import { Avatar, Box } from '@ledgerhq/lumen-ui-rnative';
|
|
@@ -156,162 +147,16 @@ import { Avatar, Box } from '@ledgerhq/lumen-ui-rnative';
|
|
|
156
147
|
function MyComponent() {
|
|
157
148
|
return (
|
|
158
149
|
<Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's8' }}>
|
|
150
|
+
<Avatar src="https://example.com/photo.jpg" size="xs" />
|
|
159
151
|
<Avatar src="https://example.com/photo.jpg" size="sm" />
|
|
160
152
|
<Avatar src="https://example.com/photo.jpg" size="md" />
|
|
161
153
|
<Avatar src="https://example.com/photo.jpg" size="lg" />
|
|
162
154
|
<Avatar src="https://example.com/photo.jpg" size="xl" />
|
|
155
|
+
<Avatar src="https://example.com/photo.jpg" size="2xl" />
|
|
163
156
|
</Box>
|
|
164
157
|
);
|
|
165
158
|
}
|
|
166
159
|
```
|
|
167
160
|
|
|
168
|
-
### As Interactive Trigger
|
|
169
|
-
|
|
170
|
-
Avatars are commonly used as interactive triggers for navigation or actions. Wrap the Avatar in a `Pressable` component:
|
|
171
|
-
|
|
172
|
-
```tsx
|
|
173
|
-
import { Avatar, DotIndicator, getDotIndicatorProps } from '@ledgerhq/lumen-ui-rnative';
|
|
174
|
-
import { Pressable, Linking } from 'react-native';
|
|
175
|
-
|
|
176
|
-
function UserProfile() {
|
|
177
|
-
const handlePress = () => {
|
|
178
|
-
// Navigate or perform action
|
|
179
|
-
console.log('Avatar pressed');
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
return (
|
|
183
|
-
<Pressable
|
|
184
|
-
onPress={handlePress}
|
|
185
|
-
style={({ pressed }) => ({
|
|
186
|
-
borderRadius: 9999,
|
|
187
|
-
opacity: pressed ? 0.7 : 1,
|
|
188
|
-
backgroundColor: pressed ? 'rgba(0, 0, 0, 0.05)' : 'transparent',
|
|
189
|
-
})}
|
|
190
|
-
>
|
|
191
|
-
<DotIndicator
|
|
192
|
-
{...getDotIndicatorProps('avatar', 'md')}
|
|
193
|
-
accessibilityLabel="New notifications"
|
|
194
|
-
>
|
|
195
|
-
<Avatar src="https://example.com/photo.jpg" size="md" alt="User menu" />
|
|
196
|
-
</DotIndicator>
|
|
197
|
-
</Pressable>
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**Key points:**
|
|
203
|
-
- Wrap Avatar in a `Pressable` component for touch interactions
|
|
204
|
-
- Use `borderRadius: 9999` to maintain circular touch area
|
|
205
|
-
- Add opacity changes for visual feedback on press
|
|
206
|
-
- Provide appropriate `alt` text for accessibility
|
|
207
|
-
- Pass an `accessibilityLabel` to `DotIndicator` so the notification state is announced by screen readers
|
|
208
|
-
|
|
209
|
-
### Custom Styling
|
|
210
|
-
|
|
211
|
-
While the component comes with predefined styles, you can extend them using the `lx` prop for token-based styling:
|
|
212
|
-
|
|
213
|
-
```tsx
|
|
214
|
-
<Avatar
|
|
215
|
-
src="https://example.com/photo.jpg"
|
|
216
|
-
size="md"
|
|
217
|
-
lx={{ marginRight: 's8' }} // Layout positioning with design tokens
|
|
218
|
-
/>
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
You can also use the `style` prop for escape-hatch styling when needed:
|
|
222
|
-
|
|
223
|
-
```tsx
|
|
224
|
-
<Avatar
|
|
225
|
-
src="https://example.com/photo.jpg"
|
|
226
|
-
size="md"
|
|
227
|
-
style={{ marginRight: 8 }} // Raw style values
|
|
228
|
-
/>
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### Complete Example
|
|
232
|
-
|
|
233
|
-
Here's a comprehensive example showing all Avatar features in a user profile context:
|
|
234
|
-
|
|
235
|
-
```tsx
|
|
236
|
-
import { Avatar, Box, Text, DotIndicator, getDotIndicatorProps } from '@ledgerhq/lumen-ui-rnative';
|
|
237
|
-
import { Pressable } from 'react-native';
|
|
238
|
-
import { useState } from 'react';
|
|
239
|
-
|
|
240
|
-
function UserProfileHeader() {
|
|
241
|
-
const [user, setUser] = useState({
|
|
242
|
-
name: 'John Doe',
|
|
243
|
-
avatar: 'https://example.com/photo.jpg',
|
|
244
|
-
hasNotifications: true,
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
const handleProfilePress = () => {
|
|
248
|
-
console.log('Opening user menu...');
|
|
249
|
-
// Navigate to profile or show menu
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
const avatar = (
|
|
253
|
-
<Avatar
|
|
254
|
-
src={user.avatar}
|
|
255
|
-
size="md"
|
|
256
|
-
alt={`${user.name} profile picture`}
|
|
257
|
-
/>
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
return (
|
|
261
|
-
<Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's12', padding: 's16' }}>
|
|
262
|
-
<Pressable
|
|
263
|
-
onPress={handleProfilePress}
|
|
264
|
-
style={({ pressed }) => ({
|
|
265
|
-
borderRadius: 9999,
|
|
266
|
-
opacity: pressed ? 0.7 : 1,
|
|
267
|
-
backgroundColor: pressed ? 'rgba(0, 0, 0, 0.05)' : 'transparent',
|
|
268
|
-
})}
|
|
269
|
-
>
|
|
270
|
-
{user.hasNotifications ? (
|
|
271
|
-
<DotIndicator
|
|
272
|
-
{...getDotIndicatorProps('avatar', 'md')}
|
|
273
|
-
accessibilityLabel="You have new notifications"
|
|
274
|
-
>
|
|
275
|
-
{avatar}
|
|
276
|
-
</DotIndicator>
|
|
277
|
-
) : (
|
|
278
|
-
avatar
|
|
279
|
-
)}
|
|
280
|
-
</Pressable>
|
|
281
|
-
<Box lx={{ flexDirection: 'column' }}>
|
|
282
|
-
<Text>{user.name}</Text>
|
|
283
|
-
{user.hasNotifications && (
|
|
284
|
-
<Text style={{ fontSize: 12, color: '#666' }}>
|
|
285
|
-
You have new notifications
|
|
286
|
-
</Text>
|
|
287
|
-
)}
|
|
288
|
-
</Box>
|
|
289
|
-
</Box>
|
|
290
|
-
);
|
|
291
|
-
}
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
## Platform Considerations
|
|
296
|
-
|
|
297
|
-
### iOS Specific
|
|
298
|
-
|
|
299
|
-
- Avatars automatically adapt to iOS design guidelines
|
|
300
|
-
- Touch feedback uses appropriate opacity transitions
|
|
301
|
-
- Respects iOS accessibility settings like reduced motion
|
|
302
|
-
|
|
303
|
-
### Android Specific
|
|
304
|
-
|
|
305
|
-
- Material Design touch feedback is supported through React Native's Pressable
|
|
306
|
-
- Handles Android back button interactions appropriately
|
|
307
|
-
- Respects Android accessibility services
|
|
308
|
-
|
|
309
|
-
### Cross-Platform
|
|
310
|
-
|
|
311
|
-
- Consistent visual appearance across platforms
|
|
312
|
-
- Platform-appropriate touch feedback via Pressable
|
|
313
|
-
- Unified API regardless of platform
|
|
314
|
-
- Images load using React Native's Image component with cross-platform optimization
|
|
315
|
-
|
|
316
161
|
</Tab>
|
|
317
162
|
</CustomTabs>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { AVATAR_COLOR_KEYS } from '@ledgerhq/lumen-utils-shared';
|
|
1
2
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
-
import { View, Text, Pressable, Linking } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { DotIndicator, getDotIndicatorProps } from '../DotIndicator';
|
|
5
5
|
import { Box } from '../Utility';
|
|
6
6
|
import { Avatar } from './Avatar';
|
|
7
|
+
import { resolveAvatarColor } from '.';
|
|
7
8
|
|
|
8
9
|
const meta = {
|
|
9
10
|
component: Avatar,
|
|
@@ -26,6 +27,12 @@ type Story = StoryObj<typeof meta>;
|
|
|
26
27
|
const exampleSrc =
|
|
27
28
|
'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';
|
|
28
29
|
|
|
30
|
+
const getInitials = (index: number) => {
|
|
31
|
+
const left = String.fromCharCode(65 + index * 2);
|
|
32
|
+
const right = String.fromCharCode(66 + index * 2);
|
|
33
|
+
return left + right;
|
|
34
|
+
};
|
|
35
|
+
|
|
29
36
|
export const Base: Story = {
|
|
30
37
|
args: {
|
|
31
38
|
src: exampleSrc,
|
|
@@ -44,110 +51,78 @@ export const Base: Story = {
|
|
|
44
51
|
|
|
45
52
|
export const SizeShowcase: Story = {
|
|
46
53
|
render: () => (
|
|
47
|
-
<Box
|
|
48
|
-
lx={{
|
|
49
|
-
alignItems: 'stretch',
|
|
50
|
-
flexDirection: 'row',
|
|
51
|
-
gap: 's16',
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
<View style={{ alignItems: 'center', justifyContent: 'flex-end' }}>
|
|
55
|
-
<Avatar src={exampleSrc} alt='avatar' size='sm' />
|
|
56
|
-
<Text style={{ marginTop: 4 }}>sm</Text>
|
|
57
|
-
</View>
|
|
58
|
-
<View style={{ alignItems: 'center', justifyContent: 'flex-end' }}>
|
|
59
|
-
<Avatar src={exampleSrc} alt='avatar' size='md' />
|
|
60
|
-
<Text style={{ marginTop: 4 }}>md</Text>
|
|
61
|
-
</View>
|
|
62
|
-
<View style={{ alignItems: 'center', justifyContent: 'flex-end' }}>
|
|
63
|
-
<Avatar src={exampleSrc} alt='avatar' size='lg' />
|
|
64
|
-
<Text style={{ marginTop: 4 }}>lg</Text>
|
|
65
|
-
</View>
|
|
66
|
-
<View style={{ alignItems: 'center', justifyContent: 'flex-end' }}>
|
|
67
|
-
<Avatar src={exampleSrc} alt='avatar' size='xl' />
|
|
68
|
-
<Text style={{ marginTop: 4 }}>xl</Text>
|
|
69
|
-
</View>
|
|
70
|
-
</Box>
|
|
71
|
-
),
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const AppearanceShowcaseRender = () => {
|
|
75
|
-
return (
|
|
76
54
|
<Box lx={{ gap: 's8' }}>
|
|
77
|
-
<Box lx={{
|
|
78
|
-
|
|
79
|
-
|
|
55
|
+
<Box lx={{ alignItems: 'flex-end', flexDirection: 'row', gap: 's16' }}>
|
|
56
|
+
{(['xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const).map((size) => (
|
|
57
|
+
<Avatar key={size} src={exampleSrc} alt={size} size={size} />
|
|
58
|
+
))}
|
|
59
|
+
</Box>
|
|
60
|
+
<Box lx={{ alignItems: 'flex-end', flexDirection: 'row', gap: 's16' }}>
|
|
61
|
+
{(['xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const).map((size) => (
|
|
62
|
+
<Avatar key={size} alt={size} size={size} fallbackText='AB' />
|
|
63
|
+
))}
|
|
80
64
|
</Box>
|
|
81
|
-
<Box lx={{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
size='md'
|
|
86
|
-
appearance='gray'
|
|
87
|
-
/>
|
|
88
|
-
<Avatar
|
|
89
|
-
src={exampleSrc}
|
|
90
|
-
alt='transparent with image'
|
|
91
|
-
size='md'
|
|
92
|
-
appearance='transparent'
|
|
93
|
-
/>
|
|
65
|
+
<Box lx={{ alignItems: 'flex-end', flexDirection: 'row', gap: 's16' }}>
|
|
66
|
+
{(['xs', 'sm', 'md', 'lg', 'xl', '2xl'] as const).map((size) => (
|
|
67
|
+
<Avatar key={size} alt={size} size={size} />
|
|
68
|
+
))}
|
|
94
69
|
</Box>
|
|
95
70
|
</Box>
|
|
96
|
-
)
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
export const AppearanceShowcase: Story = {
|
|
100
|
-
render: () => <AppearanceShowcaseRender />,
|
|
71
|
+
),
|
|
101
72
|
};
|
|
102
73
|
|
|
103
74
|
export const FallbackShowcase: Story = {
|
|
104
|
-
args: {
|
|
105
|
-
src: 'https://brokenLink.random',
|
|
106
|
-
size: 'md',
|
|
107
|
-
alt: 'Fallback example',
|
|
108
|
-
},
|
|
109
|
-
render: (args) => <Avatar {...args} />,
|
|
110
75
|
parameters: {
|
|
111
76
|
docs: {
|
|
112
77
|
source: {
|
|
113
|
-
code: `<Avatar
|
|
78
|
+
code: `<Avatar fallbackColor={resolveAvatarColor(user.id)} alt={user.name} />`,
|
|
114
79
|
},
|
|
115
80
|
},
|
|
116
81
|
},
|
|
82
|
+
render: () => (
|
|
83
|
+
<Box lx={{ gap: 's16' }}>
|
|
84
|
+
<Box lx={{ flexDirection: 'row', flexWrap: 'wrap', gap: 's16' }}>
|
|
85
|
+
{AVATAR_COLOR_KEYS.map((_, i) => (
|
|
86
|
+
<Avatar
|
|
87
|
+
key={i}
|
|
88
|
+
fallbackColor={resolveAvatarColor(`user-${i}`)}
|
|
89
|
+
fallbackText={getInitials(i)}
|
|
90
|
+
alt={getInitials(i)}
|
|
91
|
+
/>
|
|
92
|
+
))}
|
|
93
|
+
<Avatar fallbackText={getInitials(AVATAR_COLOR_KEYS.length)} />
|
|
94
|
+
</Box>
|
|
95
|
+
<Box lx={{ flexDirection: 'row', flexWrap: 'wrap', gap: 's16' }}>
|
|
96
|
+
{AVATAR_COLOR_KEYS.map((_, i) => (
|
|
97
|
+
<Avatar
|
|
98
|
+
key={i}
|
|
99
|
+
fallbackColor={resolveAvatarColor(`user-${i}`)}
|
|
100
|
+
alt={`User ${i}`}
|
|
101
|
+
/>
|
|
102
|
+
))}
|
|
103
|
+
<Avatar />
|
|
104
|
+
</Box>
|
|
105
|
+
</Box>
|
|
106
|
+
),
|
|
117
107
|
};
|
|
118
108
|
|
|
119
|
-
export const
|
|
109
|
+
export const AppearanceShowcase: Story = {
|
|
120
110
|
render: () => (
|
|
121
|
-
<Box
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}}
|
|
126
|
-
>
|
|
127
|
-
<Avatar src={exampleSrc} alt='avatar' size='md' />
|
|
128
|
-
<DotIndicator {...getDotIndicatorProps('avatar', 'md')}>
|
|
129
|
-
<Avatar src={exampleSrc} alt='avatar' size='md' />
|
|
130
|
-
</DotIndicator>
|
|
111
|
+
<Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's16' }}>
|
|
112
|
+
<Avatar size='md' alt='No ring' />
|
|
113
|
+
<Avatar size='md' alt='Thin ring' appearance='thin' />
|
|
114
|
+
<Avatar size='md' alt='Thick ring' appearance='thick' />
|
|
131
115
|
</Box>
|
|
132
116
|
),
|
|
133
117
|
};
|
|
134
118
|
|
|
135
|
-
const
|
|
136
|
-
Linking.openURL('https://shop.ledger.com/pages/ledger-nano-gen5');
|
|
137
|
-
|
|
138
|
-
export const InteractiveShowcase: Story = {
|
|
119
|
+
export const NotificationShowcase: Story = {
|
|
139
120
|
render: () => (
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
style={({ pressed }) => ({
|
|
143
|
-
borderRadius: 9999,
|
|
144
|
-
opacity: pressed ? 0.7 : 1,
|
|
145
|
-
backgroundColor: pressed ? 'rgba(0, 0, 0, 0.05)' : 'transparent',
|
|
146
|
-
})}
|
|
147
|
-
>
|
|
121
|
+
<Box lx={{ flexDirection: 'row', gap: 's16' }}>
|
|
122
|
+
<Avatar src={exampleSrc} alt='avatar' size='md' />
|
|
148
123
|
<DotIndicator {...getDotIndicatorProps('avatar', 'md')}>
|
|
149
|
-
<Avatar src={exampleSrc} size='md' />
|
|
124
|
+
<Avatar src={exampleSrc} alt='avatar' size='md' />
|
|
150
125
|
</DotIndicator>
|
|
151
|
-
</
|
|
126
|
+
</Box>
|
|
152
127
|
),
|
|
153
128
|
};
|