@ledgerhq/lumen-ui-rnative 0.1.28 → 0.1.29
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/i18n/locales/de.json +2 -1
- package/dist/module/i18n/locales/en.json +2 -1
- package/dist/module/i18n/locales/es.json +2 -1
- package/dist/module/i18n/locales/fr.json +2 -1
- package/dist/module/i18n/locales/ja.json +3 -2
- package/dist/module/i18n/locales/ko.json +3 -2
- package/dist/module/i18n/locales/pt.json +2 -1
- package/dist/module/i18n/locales/ru.json +2 -1
- package/dist/module/i18n/locales/th.json +2 -1
- package/dist/module/i18n/locales/tr.json +3 -2
- package/dist/module/i18n/locales/zh.json +3 -2
- package/dist/module/lib/Components/Avatar/Avatar.figma.js +2 -1
- package/dist/module/lib/Components/Avatar/Avatar.figma.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.js +11 -5
- package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.mdx +3 -2
- package/dist/module/lib/Components/Avatar/Avatar.stories.js +16 -0
- package/dist/module/lib/Components/Avatar/Avatar.stories.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.test.js +21 -4
- package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
- package/dist/module/lib/Components/Card/Card.stories.js +19 -19
- package/dist/module/lib/Components/Card/Card.stories.js.map +1 -1
- package/dist/module/lib/Components/DotIcon/DotIcon.js +1 -1
- package/dist/module/lib/Components/DotIndicator/DotIndicator.js +2 -1
- package/dist/module/lib/Components/DotIndicator/DotIndicator.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/DotIndicator.mdx +3 -2
- package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js +20 -4
- package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js +10 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js.map +1 -1
- package/dist/module/lib/Components/ListItem/ListItem.stories.js +3 -3
- package/dist/module/lib/Components/ListItem/ListItem.stories.js.map +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.stories.js +4 -4
- package/dist/module/lib/Components/MediaButton/MediaButton.stories.js.map +1 -1
- package/dist/module/lib/Components/MediaCard/MediaCard.stories.js +3 -3
- package/dist/module/lib/Components/MediaCard/MediaCard.stories.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.js +41 -7
- package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.mdx +38 -5
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js +92 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.test.js +117 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.test.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.mdx +0 -1
- package/dist/module/lib/Components/NavBar/NavBar.stories.js +2 -2
- package/dist/module/lib/Components/NavBar/NavBar.stories.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.stories.js +7 -7
- package/dist/module/lib/Components/OptionList/OptionList.stories.js.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Avatar/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIndicator/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/DotIndicator/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts +9 -3
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts +12 -0
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/i18n/locales/de.json +2 -1
- package/src/i18n/locales/en.json +2 -1
- package/src/i18n/locales/es.json +2 -1
- package/src/i18n/locales/fr.json +2 -1
- package/src/i18n/locales/ja.json +3 -2
- package/src/i18n/locales/ko.json +3 -2
- package/src/i18n/locales/pt.json +2 -1
- package/src/i18n/locales/ru.json +2 -1
- package/src/i18n/locales/th.json +2 -1
- package/src/i18n/locales/tr.json +3 -2
- package/src/i18n/locales/zh.json +3 -2
- package/src/lib/Components/Avatar/Avatar.figma.tsx +1 -0
- package/src/lib/Components/Avatar/Avatar.mdx +3 -2
- package/src/lib/Components/Avatar/Avatar.stories.tsx +9 -0
- package/src/lib/Components/Avatar/Avatar.test.tsx +21 -4
- package/src/lib/Components/Avatar/Avatar.tsx +6 -3
- package/src/lib/Components/Avatar/types.ts +1 -1
- package/src/lib/Components/Card/Card.stories.tsx +19 -19
- package/src/lib/Components/DotIcon/DotIcon.tsx +1 -1
- package/src/lib/Components/DotIndicator/DotIndicator.mdx +3 -2
- package/src/lib/Components/DotIndicator/DotIndicator.stories.tsx +11 -1
- package/src/lib/Components/DotIndicator/DotIndicator.test.tsx +10 -0
- package/src/lib/Components/DotIndicator/DotIndicator.tsx +2 -1
- package/src/lib/Components/DotIndicator/types.ts +1 -1
- package/src/lib/Components/ListItem/ListItem.stories.tsx +3 -3
- package/src/lib/Components/MediaButton/MediaButton.stories.tsx +4 -4
- package/src/lib/Components/MediaCard/MediaCard.stories.tsx +3 -3
- package/src/lib/Components/MediaImage/MediaImage.mdx +38 -5
- package/src/lib/Components/MediaImage/MediaImage.stories.tsx +32 -0
- package/src/lib/Components/MediaImage/MediaImage.test.tsx +108 -0
- package/src/lib/Components/MediaImage/MediaImage.tsx +37 -3
- package/src/lib/Components/MediaImage/types.ts +12 -0
- package/src/lib/Components/NavBar/NavBar.mdx +0 -1
- package/src/lib/Components/NavBar/NavBar.stories.tsx +2 -2
- package/src/lib/Components/OptionList/OptionList.stories.tsx +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Avatar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Avatar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,WAAW,GAAG;IACxB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/DotIndicator/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/DotIndicator/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import type { MediaImageProps } from './types';
|
|
1
|
+
import type { MediaImageProps, MediaImageSize } from './types';
|
|
2
|
+
export declare const fontSizeMap: Record<MediaImageSize, number>;
|
|
2
3
|
/**
|
|
3
4
|
* A generic media image component that displays an image with optional shape variants.
|
|
4
5
|
* Supports square and circular appearances with consistent sizing.
|
|
5
6
|
*
|
|
6
|
-
* When the image fails to load or no src is provided, displays a
|
|
7
|
+
* When the image fails to load or no src is provided, displays a fallback letter (if `fallback`
|
|
8
|
+
* is provided) or a muted background placeholder.
|
|
9
|
+
*
|
|
10
|
+
* While `loading` is true, a pulsing skeleton overlay is shown regardless of `src`.
|
|
7
11
|
*
|
|
8
12
|
* @example
|
|
9
13
|
* import { MediaImage } from '@ledgerhq/lumen-ui-rnative';
|
|
10
14
|
*
|
|
11
15
|
* <MediaImage src="https://example.com/icon.png" alt="Bitcoin" size={32} />
|
|
16
|
+
* <MediaImage fallback="Bitcoin" size={32} />
|
|
17
|
+
* <MediaImage loading size={32} />
|
|
12
18
|
*/
|
|
13
|
-
export declare const MediaImage: ({ src, alt, size, shape, lx, style, ref, ...props }: MediaImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const MediaImage: ({ src, alt, size, shape, fallback, loading, lx, style, ref, ...props }: MediaImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
20
|
//# sourceMappingURL=MediaImage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaImage.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaImage/MediaImage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MediaImage.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaImage/MediaImage.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAC;AAgBhF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAUtD,CAAC;AAyCF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,GAAI,wEAWxB,eAAe,4CAuCjB,CAAC"}
|
|
@@ -21,5 +21,17 @@ export type MediaImageProps = {
|
|
|
21
21
|
* Alternative text for the image, used for accessibility.
|
|
22
22
|
*/
|
|
23
23
|
alt?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Text used to derive a single-letter fallback when no `src` is provided or the image fails to load.
|
|
26
|
+
* The first character is displayed, uppercased.
|
|
27
|
+
* @optional
|
|
28
|
+
*/
|
|
29
|
+
fallback?: string;
|
|
30
|
+
/**
|
|
31
|
+
* When true, displays a pulsing skeleton placeholder instead of the image or fallback.
|
|
32
|
+
* @optional
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
loading?: boolean;
|
|
24
36
|
} & Omit<StyledViewProps, 'children'>;
|
|
25
37
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaImage/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAExE,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaImage/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAExE,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/i18n/locales/de.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"avatar": {
|
|
13
13
|
"defaultAlt": "Benutzer-Avatar",
|
|
14
|
-
"notificationAriaLabel": "Hat Benachrichtigung"
|
|
14
|
+
"notificationAriaLabel": "Hat Benachrichtigung",
|
|
15
|
+
"fallbackIconAriaLabel": "Fallback-Icon"
|
|
15
16
|
},
|
|
16
17
|
"baseInput": {
|
|
17
18
|
"clearInputAriaLabel": "Eingabe löschen"
|
package/src/i18n/locales/en.json
CHANGED
package/src/i18n/locales/es.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"avatar": {
|
|
13
13
|
"defaultAlt": "Avatar de usuario",
|
|
14
|
-
"notificationAriaLabel": "Tiene notificación"
|
|
14
|
+
"notificationAriaLabel": "Tiene notificación",
|
|
15
|
+
"fallbackIconAriaLabel": "Ícono alternativo"
|
|
15
16
|
},
|
|
16
17
|
"baseInput": {
|
|
17
18
|
"clearInputAriaLabel": "Borrar entrada"
|
package/src/i18n/locales/fr.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"avatar": {
|
|
13
13
|
"defaultAlt": "Avatar de l'utilisateur",
|
|
14
|
-
"notificationAriaLabel": "A une notification"
|
|
14
|
+
"notificationAriaLabel": "A une notification",
|
|
15
|
+
"fallbackIconAriaLabel": "Icône par défaut"
|
|
15
16
|
},
|
|
16
17
|
"baseInput": {
|
|
17
18
|
"clearInputAriaLabel": "Effacer la saisie"
|
package/src/i18n/locales/ja.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"avatar": {
|
|
13
13
|
"defaultAlt": "ユーザーアバター",
|
|
14
|
-
"notificationAriaLabel": "通知あり"
|
|
14
|
+
"notificationAriaLabel": "通知あり",
|
|
15
|
+
"fallbackIconAriaLabel": "フォールバックアイコン"
|
|
15
16
|
},
|
|
16
17
|
"baseInput": {
|
|
17
18
|
"clearInputAriaLabel": "インプットを削除"
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"opensInNewTabAriaLabel": "(新しいタブで開く)"
|
|
31
32
|
},
|
|
32
33
|
"stepper": {
|
|
33
|
-
"progressAriaLabel": "ステップ
|
|
34
|
+
"progressAriaLabel": "ステップ{{currentStep}}/{{totalSteps}}"
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
}
|
package/src/i18n/locales/ko.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"avatar": {
|
|
13
13
|
"defaultAlt": "사용자 아바타",
|
|
14
|
-
"notificationAriaLabel": "알림 있음"
|
|
14
|
+
"notificationAriaLabel": "알림 있음",
|
|
15
|
+
"fallbackIconAriaLabel": "대체 아이콘"
|
|
15
16
|
},
|
|
16
17
|
"baseInput": {
|
|
17
18
|
"clearInputAriaLabel": "입력 값 지우기"
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"opensInNewTabAriaLabel": "(새 탭에서 열기)"
|
|
31
32
|
},
|
|
32
33
|
"stepper": {
|
|
33
|
-
"progressAriaLabel": "{{totalSteps}}
|
|
34
|
+
"progressAriaLabel": "{{totalSteps}} 중 {{currentStep}} 단계"
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
}
|
package/src/i18n/locales/pt.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"avatar": {
|
|
13
13
|
"defaultAlt": "Avatar do usuário",
|
|
14
|
-
"notificationAriaLabel": "Tem notificação"
|
|
14
|
+
"notificationAriaLabel": "Tem notificação",
|
|
15
|
+
"fallbackIconAriaLabel": "Ícone fallback"
|
|
15
16
|
},
|
|
16
17
|
"baseInput": {
|
|
17
18
|
"clearInputAriaLabel": "Limpar input"
|
package/src/i18n/locales/ru.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"avatar": {
|
|
13
13
|
"defaultAlt": "Аватар пользователя",
|
|
14
|
-
"notificationAriaLabel": "Есть уведомление"
|
|
14
|
+
"notificationAriaLabel": "Есть уведомление",
|
|
15
|
+
"fallbackIconAriaLabel": "Стандартная иконка"
|
|
15
16
|
},
|
|
16
17
|
"baseInput": {
|
|
17
18
|
"clearInputAriaLabel": "Очистить поле"
|
package/src/i18n/locales/th.json
CHANGED
package/src/i18n/locales/tr.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"avatar": {
|
|
13
13
|
"defaultAlt": "Kullanıcı avatarı",
|
|
14
|
-
"notificationAriaLabel": "Bildirim var"
|
|
14
|
+
"notificationAriaLabel": "Bildirim var",
|
|
15
|
+
"fallbackIconAriaLabel": "Yedek simge"
|
|
15
16
|
},
|
|
16
17
|
"baseInput": {
|
|
17
18
|
"clearInputAriaLabel": "Girdiyi temizle"
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"opensInNewTabAriaLabel": "(yeni sekmede açılır)"
|
|
31
32
|
},
|
|
32
33
|
"stepper": {
|
|
33
|
-
"progressAriaLabel": "{{totalSteps}}
|
|
34
|
+
"progressAriaLabel": "Adım {{totalSteps}} / {{currentStep}}"
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
}
|
package/src/i18n/locales/zh.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"avatar": {
|
|
13
13
|
"defaultAlt": "用户头像",
|
|
14
|
-
"notificationAriaLabel": "有通知"
|
|
14
|
+
"notificationAriaLabel": "有通知",
|
|
15
|
+
"fallbackIconAriaLabel": "备用图标"
|
|
15
16
|
},
|
|
16
17
|
"baseInput": {
|
|
17
18
|
"clearInputAriaLabel": "清空输入框"
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"opensInNewTabAriaLabel": "(在新选项卡中打开)"
|
|
31
32
|
},
|
|
32
33
|
"stepper": {
|
|
33
|
-
"progressAriaLabel": "第 {{currentStep}}
|
|
34
|
+
"progressAriaLabel": "第 {{currentStep}} / {{totalSteps}} 步"
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
}
|
|
@@ -15,7 +15,7 @@ import { Box } from '../Utility';
|
|
|
15
15
|
|
|
16
16
|
## Introduction
|
|
17
17
|
|
|
18
|
-
The Avatar component displays a circular user profile image with automatic fallback to a User icon when the image is unavailable or fails to load. It supports an optional notification indicator and
|
|
18
|
+
The Avatar component displays a circular user profile image with automatic fallback to a User icon when the image is unavailable or fails to load. It supports an optional notification indicator and four size variants. This React Native implementation ensures consistent behavior across mobile platforms while maintaining design system coherence.
|
|
19
19
|
|
|
20
20
|
> View in [Figma](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=10546-614&p=f&m=dev).
|
|
21
21
|
|
|
@@ -36,7 +36,7 @@ The Avatar component displays a circular user profile image with automatic fallb
|
|
|
36
36
|
|
|
37
37
|
### Size
|
|
38
38
|
|
|
39
|
-
Avatars come in
|
|
39
|
+
Avatars come in four different sizes:
|
|
40
40
|
|
|
41
41
|
<Canvas of={AvatarStories.SizeShowcase} />
|
|
42
42
|
|
|
@@ -137,6 +137,7 @@ function MyComponent() {
|
|
|
137
137
|
<Avatar src="https://example.com/photo.jpg" size="sm" />
|
|
138
138
|
<Avatar src="https://example.com/photo.jpg" size="md" />
|
|
139
139
|
<Avatar src="https://example.com/photo.jpg" size="lg" />
|
|
140
|
+
<Avatar src="https://example.com/photo.jpg" size="xl" />
|
|
140
141
|
</Box>
|
|
141
142
|
);
|
|
142
143
|
}
|
|
@@ -77,6 +77,15 @@ export const SizeShowcase: Story = {
|
|
|
77
77
|
/>
|
|
78
78
|
<Text style={{ marginTop: 4 }}>lg</Text>
|
|
79
79
|
</View>
|
|
80
|
+
<View style={{ alignItems: 'center', justifyContent: 'flex-end' }}>
|
|
81
|
+
<Avatar
|
|
82
|
+
src={exampleSrc}
|
|
83
|
+
alt='avatar'
|
|
84
|
+
size='xl'
|
|
85
|
+
showNotification={false}
|
|
86
|
+
/>
|
|
87
|
+
<Text style={{ marginTop: 4 }}>xl</Text>
|
|
88
|
+
</View>
|
|
80
89
|
</Box>
|
|
81
90
|
),
|
|
82
91
|
};
|
|
@@ -39,12 +39,20 @@ describe('Avatar Component', () => {
|
|
|
39
39
|
<Avatar testID='avatar-id' size='sm' />
|
|
40
40
|
</TestWrapper>,
|
|
41
41
|
);
|
|
42
|
+
expect(getByTestId('avatar-id').props.style.width).toBe(sizes.s32);
|
|
43
|
+
expect(getByTestId('avatar-id').props.style.height).toBe(sizes.s32);
|
|
44
|
+
|
|
45
|
+
rerender(
|
|
46
|
+
<TestWrapper>
|
|
47
|
+
<Avatar testID='avatar-id' size='md' />
|
|
48
|
+
</TestWrapper>,
|
|
49
|
+
);
|
|
42
50
|
expect(getByTestId('avatar-id').props.style.width).toBe(sizes.s40);
|
|
43
51
|
expect(getByTestId('avatar-id').props.style.height).toBe(sizes.s40);
|
|
44
52
|
|
|
45
53
|
rerender(
|
|
46
54
|
<TestWrapper>
|
|
47
|
-
<Avatar testID='avatar-id' size='
|
|
55
|
+
<Avatar testID='avatar-id' size='lg' />
|
|
48
56
|
</TestWrapper>,
|
|
49
57
|
);
|
|
50
58
|
expect(getByTestId('avatar-id').props.style.width).toBe(sizes.s48);
|
|
@@ -52,11 +60,11 @@ describe('Avatar Component', () => {
|
|
|
52
60
|
|
|
53
61
|
rerender(
|
|
54
62
|
<TestWrapper>
|
|
55
|
-
<Avatar testID='avatar-id' size='
|
|
63
|
+
<Avatar testID='avatar-id' size='xl' />
|
|
56
64
|
</TestWrapper>,
|
|
57
65
|
);
|
|
58
|
-
expect(getByTestId('avatar-id').props.style.width).toBe(sizes.
|
|
59
|
-
expect(getByTestId('avatar-id').props.style.height).toBe(sizes.
|
|
66
|
+
expect(getByTestId('avatar-id').props.style.width).toBe(sizes.s64);
|
|
67
|
+
expect(getByTestId('avatar-id').props.style.height).toBe(sizes.s64);
|
|
60
68
|
});
|
|
61
69
|
|
|
62
70
|
it('should render fallback icon when no src is provided', () => {
|
|
@@ -194,6 +202,15 @@ describe('Avatar Component', () => {
|
|
|
194
202
|
</TestWrapper>,
|
|
195
203
|
);
|
|
196
204
|
|
|
205
|
+
dot = toJSON().children[0];
|
|
206
|
+
expect(dot.props.style.height).toBe(sizes.s14);
|
|
207
|
+
|
|
208
|
+
rerender(
|
|
209
|
+
<TestWrapper>
|
|
210
|
+
<Avatar testID='avatar-id' size='xl' showNotification />
|
|
211
|
+
</TestWrapper>,
|
|
212
|
+
);
|
|
213
|
+
|
|
197
214
|
dot = toJSON().children[0];
|
|
198
215
|
expect(dot.props.style.height).toBe(sizes.s16);
|
|
199
216
|
});
|
|
@@ -13,6 +13,7 @@ const fallbackSizes = {
|
|
|
13
13
|
sm: 16,
|
|
14
14
|
md: 24,
|
|
15
15
|
lg: 32,
|
|
16
|
+
xl: 40,
|
|
16
17
|
} as const;
|
|
17
18
|
|
|
18
19
|
const dotSizeMap: Record<
|
|
@@ -22,15 +23,17 @@ const dotSizeMap: Record<
|
|
|
22
23
|
sm: 'xs',
|
|
23
24
|
md: 'sm',
|
|
24
25
|
lg: 'md',
|
|
26
|
+
xl: 'lg',
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
const useStyles = ({ size }: { size: Size }) => {
|
|
28
30
|
return useStyleSheet(
|
|
29
31
|
(t) => {
|
|
30
32
|
const sizeMap = {
|
|
31
|
-
sm: { size: t.sizes.
|
|
32
|
-
md: { size: t.sizes.
|
|
33
|
-
lg: { size: t.sizes.
|
|
33
|
+
sm: { size: t.sizes.s32, padding: t.spacings.s4 },
|
|
34
|
+
md: { size: t.sizes.s40, padding: t.spacings.s4 },
|
|
35
|
+
lg: { size: t.sizes.s48, padding: t.spacings.s4 },
|
|
36
|
+
xl: { size: t.sizes.s64, padding: t.spacings.s4 },
|
|
34
37
|
};
|
|
35
38
|
|
|
36
39
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import CryptoIcon from '@ledgerhq/crypto-icons/native';
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { Wallet } from '../../Symbols';
|
|
@@ -71,7 +71,7 @@ export const Base: Story = {
|
|
|
71
71
|
<Card {...args}>
|
|
72
72
|
<CardHeader>
|
|
73
73
|
<CardLeading>
|
|
74
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
74
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
75
75
|
<CardContent>
|
|
76
76
|
<CardContentTitle>Bitcoin</CardContentTitle>
|
|
77
77
|
<CardContentDescription>BTC</CardContentDescription>
|
|
@@ -96,7 +96,7 @@ export const Base: Story = {
|
|
|
96
96
|
<Card onPress={handlePress}>
|
|
97
97
|
<CardHeader>
|
|
98
98
|
<CardLeading>
|
|
99
|
-
<CryptoIcon ledgerId="bitcoin" ticker="BTC" size=
|
|
99
|
+
<CryptoIcon ledgerId="bitcoin" ticker="BTC" size={48} />
|
|
100
100
|
<CardContent>
|
|
101
101
|
<CardContentTitle>Bitcoin</CardContentTitle>
|
|
102
102
|
<CardContentDescription>BTC</CardContentDescription>
|
|
@@ -125,7 +125,7 @@ export const StatesShowcase: Story = {
|
|
|
125
125
|
<Card {...args} lx={{ width: 's320' }}>
|
|
126
126
|
<CardHeader>
|
|
127
127
|
<CardLeading>
|
|
128
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
128
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
129
129
|
<CardContent>
|
|
130
130
|
<CardContentTitle>Interactive (default)</CardContentTitle>
|
|
131
131
|
<CardContentDescription>
|
|
@@ -150,7 +150,7 @@ export const StatesShowcase: Story = {
|
|
|
150
150
|
<Card {...args} lx={{ width: 's320' }} outlined>
|
|
151
151
|
<CardHeader>
|
|
152
152
|
<CardLeading>
|
|
153
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
153
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
154
154
|
<CardContent>
|
|
155
155
|
<CardContentTitle>Outlined</CardContentTitle>
|
|
156
156
|
<CardContentDescription>Selected state</CardContentDescription>
|
|
@@ -173,7 +173,7 @@ export const StatesShowcase: Story = {
|
|
|
173
173
|
<Card {...args} lx={{ width: 's320' }} type='info'>
|
|
174
174
|
<CardHeader>
|
|
175
175
|
<CardLeading>
|
|
176
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
176
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
177
177
|
<CardContent>
|
|
178
178
|
<CardContentTitle>Info</CardContentTitle>
|
|
179
179
|
<CardContentDescription>Data display only</CardContentDescription>
|
|
@@ -197,7 +197,7 @@ export const StatesShowcase: Story = {
|
|
|
197
197
|
<CardHeader>
|
|
198
198
|
<CardLeading>
|
|
199
199
|
<Box lx={{ opacity: 0.3 }}>
|
|
200
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
200
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
201
201
|
</Box>
|
|
202
202
|
<CardContent>
|
|
203
203
|
<CardContentTitle>Disabled</CardContentTitle>
|
|
@@ -286,7 +286,7 @@ export const ExpandableShowcase: Story = {
|
|
|
286
286
|
>
|
|
287
287
|
<CardHeader>
|
|
288
288
|
<CardLeading>
|
|
289
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
289
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
290
290
|
<CardContent>
|
|
291
291
|
<CardContentTitle>Expandable Card</CardContentTitle>
|
|
292
292
|
<CardContentDescription>
|
|
@@ -332,7 +332,7 @@ export const LayoutShowcase: Story = {
|
|
|
332
332
|
<Card {...args}>
|
|
333
333
|
<CardHeader>
|
|
334
334
|
<CardLeading>
|
|
335
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
335
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
336
336
|
<CardContent>
|
|
337
337
|
<CardContentTitle>Defined width (320px)</CardContentTitle>
|
|
338
338
|
<CardContentDescription>BTC</CardContentDescription>
|
|
@@ -347,7 +347,7 @@ export const LayoutShowcase: Story = {
|
|
|
347
347
|
<Card {...args} lx={{ width: 's320' }}>
|
|
348
348
|
<CardHeader>
|
|
349
349
|
<CardLeading>
|
|
350
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
350
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
351
351
|
<CardContent>
|
|
352
352
|
<CardContentRow>
|
|
353
353
|
<CardContentTitle>With Tags</CardContentTitle>
|
|
@@ -370,7 +370,7 @@ export const LayoutShowcase: Story = {
|
|
|
370
370
|
<Card {...args} lx={{ width: 's320' }}>
|
|
371
371
|
<CardHeader>
|
|
372
372
|
<CardLeading>
|
|
373
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
373
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
374
374
|
<CardContent>
|
|
375
375
|
<CardContentRow>
|
|
376
376
|
<CardContentTitle>Trailing values</CardContentTitle>
|
|
@@ -403,7 +403,7 @@ export const LayoutShowcase: Story = {
|
|
|
403
403
|
<Card {...args} lx={{ width: 'full' }}>
|
|
404
404
|
<CardHeader>
|
|
405
405
|
<CardLeading>
|
|
406
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
406
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
407
407
|
<CardContent>
|
|
408
408
|
<CardContentTitle>Full width (fills parent)</CardContentTitle>
|
|
409
409
|
<CardContentDescription>BTC</CardContentDescription>
|
|
@@ -433,7 +433,7 @@ export const CompositionsShowcase: Story = {
|
|
|
433
433
|
<Card type='info'>
|
|
434
434
|
<CardHeader>
|
|
435
435
|
<CardLeading>
|
|
436
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
436
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
437
437
|
<CardContent>
|
|
438
438
|
<CardContentTitle>Account 1</CardContentTitle>
|
|
439
439
|
<CardContentDescription>Ethereum</CardContentDescription>
|
|
@@ -457,7 +457,7 @@ export const CompositionsShowcase: Story = {
|
|
|
457
457
|
<Card>
|
|
458
458
|
<CardHeader>
|
|
459
459
|
<CardLeading>
|
|
460
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
460
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
461
461
|
<CardContent>
|
|
462
462
|
<CardContentTitle>Bitcoin</CardContentTitle>
|
|
463
463
|
<CardContentDescription>BTC</CardContentDescription>
|
|
@@ -503,7 +503,7 @@ export const CompositionsShowcase: Story = {
|
|
|
503
503
|
<Card>
|
|
504
504
|
<CardHeader>
|
|
505
505
|
<CardLeading>
|
|
506
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
506
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
507
507
|
<CardContent>
|
|
508
508
|
<CardContentTitle>My Wallet</CardContentTitle>
|
|
509
509
|
<CardContentDescription>Ethereum</CardContentDescription>
|
|
@@ -523,7 +523,7 @@ export const CompositionsShowcase: Story = {
|
|
|
523
523
|
<Card>
|
|
524
524
|
<CardHeader>
|
|
525
525
|
<CardLeading>
|
|
526
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
526
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
527
527
|
<CardContent>
|
|
528
528
|
<CardContentRow>
|
|
529
529
|
<CardContentTitle>Bitcoin</CardContentTitle>
|
|
@@ -576,7 +576,7 @@ export const CompositionsShowcase: Story = {
|
|
|
576
576
|
<Card type='info'>
|
|
577
577
|
<CardHeader>
|
|
578
578
|
<CardLeading>
|
|
579
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
579
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
580
580
|
<CardContent>
|
|
581
581
|
<CardContentTitle>Staking</CardContentTitle>
|
|
582
582
|
<CardContentDescription>Earn rewards</CardContentDescription>
|
|
@@ -604,7 +604,7 @@ export const CompositionsShowcase: Story = {
|
|
|
604
604
|
<Card type='info'>
|
|
605
605
|
<CardHeader>
|
|
606
606
|
<CardLeading>
|
|
607
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
607
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
608
608
|
<CardContent>
|
|
609
609
|
<CardContentTitle>My Wallet</CardContentTitle>
|
|
610
610
|
<CardContentDescription>Ethereum</CardContentDescription>
|
|
@@ -630,7 +630,7 @@ export const CompositionsShowcase: Story = {
|
|
|
630
630
|
>
|
|
631
631
|
<CardHeader>
|
|
632
632
|
<CardLeading>
|
|
633
|
-
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size=
|
|
633
|
+
<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
|
|
634
634
|
<CardContent>
|
|
635
635
|
<CardContentTitle>Bitcoin</CardContentTitle>
|
|
636
636
|
<CardContentDescription>BTC</CardContentDescription>
|
|
@@ -22,11 +22,12 @@ import { CustomTabs, Tab } from '../../../../.storybook/components';
|
|
|
22
22
|
|
|
23
23
|
## Sizes
|
|
24
24
|
|
|
25
|
-
DotIndicator comes in
|
|
25
|
+
DotIndicator comes in four sizes:
|
|
26
26
|
|
|
27
27
|
- **xs** - compact dot for tight layouts.
|
|
28
28
|
- **sm** (default) - standard dot for most use cases.
|
|
29
|
-
- **md** -
|
|
29
|
+
- **md** - medium dot for prominent indicators.
|
|
30
|
+
- **lg** - large dot for maximum visibility.
|
|
30
31
|
|
|
31
32
|
<Canvas of={DotIndicatorStories.SizeShowcase} />
|
|
32
33
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
+
import { Settings } from '../../Symbols';
|
|
3
|
+
import { Avatar } from '../Avatar/Avatar';
|
|
2
4
|
import { Button } from '../Button/Button';
|
|
5
|
+
import { IconButton } from '../IconButton/IconButton';
|
|
3
6
|
import { Box } from '../Utility/Box';
|
|
4
7
|
import { DotIndicator } from './DotIndicator';
|
|
5
8
|
|
|
@@ -18,7 +21,7 @@ const meta = {
|
|
|
18
21
|
argTypes: {
|
|
19
22
|
size: {
|
|
20
23
|
control: 'radio',
|
|
21
|
-
options: ['xs', 'sm', 'md'],
|
|
24
|
+
options: ['xs', 'sm', 'md', 'lg'],
|
|
22
25
|
},
|
|
23
26
|
appearance: {
|
|
24
27
|
control: 'radio',
|
|
@@ -42,6 +45,7 @@ export const SizeShowcase: Story = {
|
|
|
42
45
|
<DotIndicator size='xs' />
|
|
43
46
|
<DotIndicator size='sm' />
|
|
44
47
|
<DotIndicator size='md' />
|
|
48
|
+
<DotIndicator size='lg' />
|
|
45
49
|
</Box>
|
|
46
50
|
),
|
|
47
51
|
};
|
|
@@ -62,6 +66,12 @@ export const WithChildren: Story = {
|
|
|
62
66
|
<DotIndicator appearance='red'>
|
|
63
67
|
<Button size='sm'>Submit</Button>
|
|
64
68
|
</DotIndicator>
|
|
69
|
+
<DotIndicator appearance='red'>
|
|
70
|
+
<Avatar size='md' />
|
|
71
|
+
</DotIndicator>
|
|
72
|
+
<DotIndicator appearance='red'>
|
|
73
|
+
<IconButton accessibilityLabel='Settings' icon={Settings} />
|
|
74
|
+
</DotIndicator>
|
|
65
75
|
</Box>
|
|
66
76
|
),
|
|
67
77
|
};
|
|
@@ -97,6 +97,16 @@ describe('DotIndicator', () => {
|
|
|
97
97
|
expect(toJSON()).toBeTruthy();
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
+
it('should render in lg size', () => {
|
|
101
|
+
const { toJSON } = render(
|
|
102
|
+
<TestWrapper>
|
|
103
|
+
<DotIndicator size='lg' />
|
|
104
|
+
</TestWrapper>,
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
expect(toJSON()).toBeTruthy();
|
|
108
|
+
});
|
|
109
|
+
|
|
100
110
|
it('should render with red appearance', () => {
|
|
101
111
|
const { toJSON } = render(
|
|
102
112
|
<TestWrapper>
|