@ledgerhq/lumen-ui-rnative 0.1.48 → 0.1.49
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 +1 -3
- package/dist/module/i18n/locales/en.json +1 -3
- package/dist/module/i18n/locales/es.json +1 -3
- package/dist/module/i18n/locales/fr.json +1 -3
- package/dist/module/i18n/locales/ja.json +1 -3
- package/dist/module/i18n/locales/ko.json +1 -3
- package/dist/module/i18n/locales/pt.json +1 -3
- package/dist/module/i18n/locales/ru.json +1 -3
- package/dist/module/i18n/locales/th.json +1 -3
- package/dist/module/i18n/locales/tr.json +1 -3
- package/dist/module/i18n/locales/zh.json +1 -3
- package/dist/module/lib/Animations/Pulse/Pulse.js +3 -3
- package/dist/module/lib/Animations/Pulse/Pulse.js.map +1 -1
- package/dist/module/lib/Animations/Pulse/Pulse.mdx +0 -1
- package/dist/module/lib/Animations/Spin/Spin.js +3 -3
- package/dist/module/lib/Animations/Spin/Spin.js.map +1 -1
- package/dist/module/lib/Animations/Spin/Spin.mdx +0 -1
- package/dist/module/lib/Components/AddressInput/AddressInput.figma.js +36 -0
- package/dist/module/lib/Components/AddressInput/AddressInput.figma.js.map +1 -0
- package/dist/module/lib/Components/AddressInput/AddressInput.mdx +0 -183
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.figma.js +31 -0
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.figma.js.map +1 -0
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.mdx +0 -90
- package/dist/module/lib/Components/AmountInput/AmountInput.figma.js +70 -0
- package/dist/module/lib/Components/AmountInput/AmountInput.figma.js.map +1 -0
- package/dist/module/lib/Components/AmountInput/AmountInput.mdx +0 -190
- package/dist/module/lib/Components/Avatar/Avatar.figma.js +15 -12
- package/dist/module/lib/Components/Avatar/Avatar.figma.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.js +4 -27
- package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.mdx +53 -69
- package/dist/module/lib/Components/Avatar/Avatar.stories.js +27 -33
- package/dist/module/lib/Components/Avatar/Avatar.stories.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.test.js +21 -39
- package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
- package/dist/module/lib/Components/Banner/Banner.figma.js +107 -0
- package/dist/module/lib/Components/Banner/Banner.figma.js.map +1 -0
- package/dist/module/lib/Components/Banner/Banner.mdx +0 -86
- package/dist/module/lib/Components/BottomSheet/BottomSheet.figma.js +49 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheet.figma.js.map +1 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +0 -119
- package/dist/module/lib/Components/Button/Button.figma.js +45 -0
- package/dist/module/lib/Components/Button/Button.figma.js.map +1 -0
- package/dist/module/lib/Components/Button/Button.mdx +25 -224
- package/dist/module/lib/Components/Button/Button.stories.js +4 -36
- package/dist/module/lib/Components/Button/Button.stories.js.map +1 -1
- package/dist/module/lib/Components/Card/Card.figma.js +143 -0
- package/dist/module/lib/Components/Card/Card.figma.js.map +1 -0
- package/dist/module/lib/Components/Card/Card.mdx +0 -160
- package/dist/module/lib/Components/CardButton/CardButton.figma.js +38 -0
- package/dist/module/lib/Components/CardButton/CardButton.figma.js.map +1 -0
- package/dist/module/lib/Components/CardButton/CardButton.mdx +0 -48
- package/dist/module/lib/Components/Checkbox/Checkbox.figma.js +48 -0
- package/dist/module/lib/Components/Checkbox/Checkbox.figma.js.map +1 -0
- package/dist/module/lib/Components/Checkbox/Checkbox.mdx +0 -73
- package/dist/module/lib/Components/ContentBanner/ContentBanner.figma.js +91 -0
- package/dist/module/lib/Components/ContentBanner/ContentBanner.figma.js.map +1 -0
- package/dist/module/lib/Components/ContentBanner/ContentBanner.mdx +0 -2
- package/dist/module/lib/Components/CryptoIcon/CryptoIcon.figma.js +17 -0
- package/dist/module/lib/Components/CryptoIcon/CryptoIcon.figma.js.map +1 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.figma.js +29 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.figma.js.map +1 -0
- package/dist/module/lib/Components/Divider/Divider.figma.js +10 -0
- package/dist/module/lib/Components/Divider/Divider.figma.js.map +1 -0
- package/dist/module/lib/Components/Divider/Divider.mdx +0 -2
- package/dist/module/lib/Components/DotCount/DotCount.figma.js +29 -0
- package/dist/module/lib/Components/DotCount/DotCount.figma.js.map +1 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.figma.js +29 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.figma.js.map +1 -0
- package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js +6 -3
- package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.js +17 -0
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.js.map +1 -0
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.test.js +17 -0
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.test.js.map +1 -0
- package/dist/module/lib/Components/DotIndicator/index.js +1 -0
- package/dist/module/lib/Components/DotIndicator/index.js.map +1 -1
- package/dist/module/lib/Components/Icon/Icon.figma.js +1840 -0
- package/dist/module/lib/Components/Icon/Icon.figma.js.map +1 -0
- package/dist/module/lib/Components/Icon/Icon.mdx +0 -62
- package/dist/module/lib/Components/IconButton/IconButton.figma.js +42 -0
- package/dist/module/lib/Components/IconButton/IconButton.figma.js.map +1 -0
- package/dist/module/lib/Components/IconButton/IconButton.mdx +0 -68
- package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.figma.js +51 -0
- package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.figma.js.map +1 -0
- package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.mdx +0 -107
- package/dist/module/lib/Components/Link/Link.figma.js +41 -0
- package/dist/module/lib/Components/Link/Link.figma.js.map +1 -0
- package/dist/module/lib/Components/Link/Link.mdx +0 -102
- package/dist/module/lib/Components/ListItem/ListItem.figma.js +416 -0
- package/dist/module/lib/Components/ListItem/ListItem.figma.js.map +1 -0
- package/dist/module/lib/Components/ListItem/ListItem.mdx +0 -129
- package/dist/module/lib/Components/MediaBanner/MediaBanner.figma.js +25 -0
- package/dist/module/lib/Components/MediaBanner/MediaBanner.figma.js.map +1 -0
- package/dist/module/lib/Components/MediaBanner/MediaBanner.mdx +0 -3
- package/dist/module/lib/Components/MediaButton/MediaButton.figma.js +72 -0
- package/dist/module/lib/Components/MediaButton/MediaButton.figma.js.map +1 -0
- package/dist/module/lib/Components/MediaCard/MediaCard.figma.js +28 -0
- package/dist/module/lib/Components/MediaCard/MediaCard.figma.js.map +1 -0
- package/dist/module/lib/Components/MediaCard/MediaCard.mdx +0 -2
- package/dist/module/lib/Components/MediaImage/MediaImage.mdx +0 -1
- package/dist/module/lib/Components/MediaTag/MediaTag.figma.js +100 -0
- package/dist/module/lib/Components/MediaTag/MediaTag.figma.js.map +1 -0
- package/dist/module/lib/Components/MediaTag/MediaTag.mdx +0 -2
- package/dist/module/lib/Components/NavBar/NavBar.figma.js +79 -0
- package/dist/module/lib/Components/NavBar/NavBar.figma.js.map +1 -0
- package/dist/module/lib/Components/NavBar/NavBar.mdx +0 -2
- package/dist/module/lib/Components/OptionList/OptionList.mdx +0 -90
- package/dist/module/lib/Components/PageIndicator/PageIndicator.figma.js +13 -0
- package/dist/module/lib/Components/PageIndicator/PageIndicator.figma.js.map +1 -0
- package/dist/module/lib/Components/PageIndicator/PageIndicator.mdx +0 -2
- package/dist/module/lib/Components/SearchInput/SearchInput.figma.js +31 -0
- package/dist/module/lib/Components/SearchInput/SearchInput.figma.js.map +1 -0
- package/dist/module/lib/Components/SearchInput/SearchInput.mdx +0 -199
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.figma.js +35 -0
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.figma.js.map +1 -0
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.mdx +0 -1
- package/dist/module/lib/Components/Skeleton/Skeleton.figma.js +18 -0
- package/dist/module/lib/Components/Skeleton/Skeleton.figma.js.map +1 -0
- package/dist/module/lib/Components/Skeleton/Skeleton.mdx +0 -71
- package/dist/module/lib/Components/Spinner/Spinner.figma.js +13 -0
- package/dist/module/lib/Components/Spinner/Spinner.figma.js.map +1 -0
- package/dist/module/lib/Components/Spinner/Spinner.mdx +0 -100
- package/dist/module/lib/Components/Spot/Spot.figma.js +37 -0
- package/dist/module/lib/Components/Spot/Spot.figma.js.map +1 -0
- package/dist/module/lib/Components/Spot/Spot.mdx +0 -94
- package/dist/module/lib/Components/Stepper/Stepper.figma.js +13 -0
- package/dist/module/lib/Components/Stepper/Stepper.figma.js.map +1 -0
- package/dist/module/lib/Components/Stepper/Stepper.mdx +0 -67
- package/dist/module/lib/Components/Subheader/Subheader.figma.js +67 -0
- package/dist/module/lib/Components/Subheader/Subheader.figma.js.map +1 -0
- package/dist/module/lib/Components/Subheader/Subheader.mdx +0 -116
- package/dist/module/lib/Components/Switch/Switch.figma.js +58 -0
- package/dist/module/lib/Components/Switch/Switch.figma.js.map +1 -0
- package/dist/module/lib/Components/Switch/Switch.mdx +0 -39
- package/dist/module/lib/Components/TabBar/TabBar.figma.js +98 -0
- package/dist/module/lib/Components/TabBar/TabBar.figma.js.map +1 -0
- package/dist/module/lib/Components/TabBar/TabBar.mdx +0 -5
- package/dist/module/lib/Components/Tag/Tag.figma.js +41 -0
- package/dist/module/lib/Components/Tag/Tag.figma.js.map +1 -0
- package/dist/module/lib/Components/Tag/Tag.mdx +0 -2
- package/dist/module/lib/Components/TextInput/TextInput.figma.js +37 -0
- package/dist/module/lib/Components/TextInput/TextInput.figma.js.map +1 -0
- package/dist/module/lib/Components/TextInput/TextInput.mdx +0 -178
- package/dist/module/lib/Components/Tile/Tile.figma.js +111 -0
- package/dist/module/lib/Components/Tile/Tile.figma.js.map +1 -0
- package/dist/module/lib/Components/Tile/Tile.mdx +0 -53
- package/dist/module/lib/Components/TileButton/TileButton.figma.js +23 -0
- package/dist/module/lib/Components/TileButton/TileButton.figma.js.map +1 -0
- package/dist/module/lib/Components/TileButton/TileButton.mdx +0 -40
- package/dist/module/lib/Components/Tooltip/Tooltip.figma.js +26 -0
- package/dist/module/lib/Components/Tooltip/Tooltip.figma.js.map +1 -0
- package/dist/module/lib/Components/Tooltip/Tooltip.mdx +0 -183
- package/dist/module/lib/Components/Trend/Trend.figma.js +29 -0
- package/dist/module/lib/Components/Trend/Trend.figma.js.map +1 -0
- package/dist/module/lib/Components/Trend/Trend.mdx +0 -2
- package/dist/module/lib/Components/Utility/Text/Text.mdx +0 -1
- package/dist/module/lib/Symbols/Icons/ChevronAscending.js +1 -1
- package/dist/module/lib/Symbols/Icons/ChevronDescending.js +1 -1
- package/dist/module/lib/Symbols/Icons/Contact.js +50 -0
- package/dist/module/lib/Symbols/Icons/Contact.js.map +1 -0
- package/dist/module/lib/Symbols/index.js +1 -0
- package/dist/module/lib/Symbols/index.js.map +1 -1
- package/dist/typescript/src/lib/Animations/Pulse/Pulse.d.ts.map +1 -1
- package/dist/typescript/src/lib/Animations/Spin/Spin.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts +1 -4
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/types.d.ts +0 -6
- package/dist/typescript/src/lib/Components/Avatar/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIndicator/getDotIndicatorProps.d.ts +24 -0
- package/dist/typescript/src/lib/Components/DotIndicator/getDotIndicatorProps.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DotIndicator/index.d.ts +1 -0
- package/dist/typescript/src/lib/Components/DotIndicator/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Symbols/Icons/Contact.d.ts +35 -0
- package/dist/typescript/src/lib/Symbols/Icons/Contact.d.ts.map +1 -0
- package/dist/typescript/src/lib/Symbols/index.d.ts +1 -0
- package/dist/typescript/src/lib/Symbols/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/i18n/locales/de.json +1 -3
- package/src/i18n/locales/en.json +1 -3
- package/src/i18n/locales/es.json +1 -3
- package/src/i18n/locales/fr.json +1 -3
- package/src/i18n/locales/ja.json +1 -3
- package/src/i18n/locales/ko.json +1 -3
- package/src/i18n/locales/pt.json +1 -3
- package/src/i18n/locales/ru.json +1 -3
- package/src/i18n/locales/th.json +1 -3
- package/src/i18n/locales/tr.json +1 -3
- package/src/i18n/locales/zh.json +1 -3
- package/src/lib/Animations/Pulse/Pulse.mdx +0 -1
- package/src/lib/Animations/Pulse/Pulse.tsx +8 -1
- package/src/lib/Animations/Spin/Spin.mdx +0 -1
- package/src/lib/Animations/Spin/Spin.tsx +8 -1
- package/src/lib/Components/AddressInput/AddressInput.figma.tsx +39 -0
- package/src/lib/Components/AddressInput/AddressInput.mdx +0 -183
- package/src/lib/Components/AmountDisplay/AmountDisplay.figma.tsx +37 -0
- package/src/lib/Components/AmountDisplay/AmountDisplay.mdx +0 -90
- package/src/lib/Components/AmountInput/AmountInput.figma.tsx +78 -0
- package/src/lib/Components/AmountInput/AmountInput.mdx +0 -190
- package/src/lib/Components/Avatar/Avatar.figma.tsx +24 -14
- package/src/lib/Components/Avatar/Avatar.mdx +53 -69
- package/src/lib/Components/Avatar/Avatar.stories.tsx +16 -50
- package/src/lib/Components/Avatar/Avatar.test.tsx +12 -32
- package/src/lib/Components/Avatar/Avatar.tsx +4 -34
- package/src/lib/Components/Avatar/types.ts +0 -6
- package/src/lib/Components/Banner/Banner.figma.tsx +115 -0
- package/src/lib/Components/Banner/Banner.mdx +0 -86
- package/src/lib/Components/BottomSheet/BottomSheet.figma.tsx +52 -0
- package/src/lib/Components/BottomSheet/BottomSheet.mdx +0 -119
- package/src/lib/Components/Button/Button.figma.tsx +57 -0
- package/src/lib/Components/Button/Button.mdx +25 -224
- package/src/lib/Components/Button/Button.stories.tsx +3 -35
- package/src/lib/Components/Card/Card.figma.tsx +149 -0
- package/src/lib/Components/Card/Card.mdx +0 -160
- package/src/lib/Components/CardButton/CardButton.figma.tsx +49 -0
- package/src/lib/Components/CardButton/CardButton.mdx +0 -48
- package/src/lib/Components/Checkbox/Checkbox.figma.tsx +54 -0
- package/src/lib/Components/Checkbox/Checkbox.mdx +0 -73
- package/src/lib/Components/ContentBanner/ContentBanner.figma.tsx +108 -0
- package/src/lib/Components/ContentBanner/ContentBanner.mdx +0 -2
- package/src/lib/Components/CryptoIcon/CryptoIcon.figma.tsx +20 -0
- package/src/lib/Components/DescriptionItem/DescriptionItem.figma.tsx +36 -0
- package/src/lib/Components/Divider/Divider.figma.tsx +11 -0
- package/src/lib/Components/Divider/Divider.mdx +0 -2
- package/src/lib/Components/DotCount/DotCount.figma.tsx +32 -0
- package/src/lib/Components/DotIndicator/DotIndicator.figma.tsx +32 -0
- package/src/lib/Components/DotIndicator/DotIndicator.stories.tsx +4 -1
- package/src/lib/Components/DotIndicator/getDotIndicatorProps.test.ts +15 -0
- package/src/lib/Components/DotIndicator/getDotIndicatorProps.ts +10 -0
- package/src/lib/Components/DotIndicator/index.ts +1 -0
- package/src/lib/Components/Icon/Icon.figma.tsx +3085 -0
- package/src/lib/Components/Icon/Icon.mdx +0 -62
- package/src/lib/Components/IconButton/IconButton.figma.tsx +53 -0
- package/src/lib/Components/IconButton/IconButton.mdx +0 -68
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.figma.tsx +52 -0
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.mdx +0 -107
- package/src/lib/Components/Link/Link.figma.tsx +53 -0
- package/src/lib/Components/Link/Link.mdx +0 -102
- package/src/lib/Components/ListItem/ListItem.figma.tsx +431 -0
- package/src/lib/Components/ListItem/ListItem.mdx +0 -129
- package/src/lib/Components/MediaBanner/MediaBanner.figma.tsx +32 -0
- package/src/lib/Components/MediaBanner/MediaBanner.mdx +0 -3
- package/src/lib/Components/MediaButton/MediaButton.figma.tsx +60 -0
- package/src/lib/Components/MediaCard/MediaCard.figma.tsx +27 -0
- package/src/lib/Components/MediaCard/MediaCard.mdx +0 -2
- package/src/lib/Components/MediaImage/MediaImage.mdx +0 -1
- package/src/lib/Components/MediaTag/MediaTag.figma.tsx +116 -0
- package/src/lib/Components/MediaTag/MediaTag.mdx +0 -2
- package/src/lib/Components/NavBar/NavBar.figma.tsx +84 -0
- package/src/lib/Components/NavBar/NavBar.mdx +0 -2
- package/src/lib/Components/OptionList/OptionList.mdx +0 -90
- package/src/lib/Components/PageIndicator/PageIndicator.figma.tsx +11 -0
- package/src/lib/Components/PageIndicator/PageIndicator.mdx +0 -2
- package/src/lib/Components/SearchInput/SearchInput.figma.tsx +34 -0
- package/src/lib/Components/SearchInput/SearchInput.mdx +0 -199
- package/src/lib/Components/SegmentedControl/SegmentedControl.figma.tsx +34 -0
- package/src/lib/Components/SegmentedControl/SegmentedControl.mdx +0 -1
- package/src/lib/Components/Skeleton/Skeleton.figma.tsx +17 -0
- package/src/lib/Components/Skeleton/Skeleton.mdx +0 -71
- package/src/lib/Components/Spinner/Spinner.figma.tsx +12 -0
- package/src/lib/Components/Spinner/Spinner.mdx +0 -100
- package/src/lib/Components/Spot/Spot.figma.tsx +50 -0
- package/src/lib/Components/Spot/Spot.mdx +0 -94
- package/src/lib/Components/Stepper/Stepper.figma.tsx +11 -0
- package/src/lib/Components/Stepper/Stepper.mdx +0 -67
- package/src/lib/Components/Subheader/Subheader.figma.tsx +72 -0
- package/src/lib/Components/Subheader/Subheader.mdx +0 -116
- package/src/lib/Components/Switch/Switch.figma.tsx +66 -0
- package/src/lib/Components/Switch/Switch.mdx +0 -39
- package/src/lib/Components/TabBar/TabBar.figma.tsx +70 -0
- package/src/lib/Components/TabBar/TabBar.mdx +0 -5
- package/src/lib/Components/Tag/Tag.figma.tsx +52 -0
- package/src/lib/Components/Tag/Tag.mdx +0 -2
- package/src/lib/Components/TextInput/TextInput.figma.tsx +40 -0
- package/src/lib/Components/TextInput/TextInput.mdx +0 -178
- package/src/lib/Components/Tile/Tile.figma.tsx +113 -0
- package/src/lib/Components/Tile/Tile.mdx +0 -53
- package/src/lib/Components/TileButton/TileButton.figma.tsx +35 -0
- package/src/lib/Components/TileButton/TileButton.mdx +0 -40
- package/src/lib/Components/Tooltip/Tooltip.figma.tsx +30 -0
- package/src/lib/Components/Tooltip/Tooltip.mdx +0 -183
- package/src/lib/Components/Trend/Trend.figma.tsx +28 -0
- package/src/lib/Components/Trend/Trend.mdx +0 -2
- package/src/lib/Components/Utility/Text/Text.mdx +0 -1
- package/src/lib/Symbols/Icons/ChevronAscending.tsx +1 -1
- package/src/lib/Symbols/Icons/ChevronDescending.tsx +1 -1
- package/src/lib/Symbols/Icons/Contact.tsx +45 -0
- package/src/lib/Symbols/index.ts +1 -0
- package/dist/typescript/src/lib/Components/Avatar/Avatar.figma.d.ts +0 -2
- package/dist/typescript/src/lib/Components/Avatar/Avatar.figma.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/OptionList/OptionList.figma.d.ts +0 -2
- package/dist/typescript/src/lib/Components/OptionList/OptionList.figma.d.ts.map +0 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import figma from '@figma/code-connect';
|
|
4
|
+
import { AmountInput } from "./AmountInput.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
figma.connect(AmountInput, 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=17523-37413', {
|
|
7
|
+
imports: ["import { AmountInput } from '@ledgerhq/lumen-ui-rnative'"],
|
|
8
|
+
props: {
|
|
9
|
+
size: figma.enum('size', {
|
|
10
|
+
md: 'md',
|
|
11
|
+
sm: 'sm'
|
|
12
|
+
}),
|
|
13
|
+
value: figma.string('amount'),
|
|
14
|
+
currencyText: figma.enum('currency', {
|
|
15
|
+
$: '$',
|
|
16
|
+
'€': '€',
|
|
17
|
+
'£': '£'
|
|
18
|
+
}),
|
|
19
|
+
currencyPosition: figma.enum('currency', {
|
|
20
|
+
$: 'left',
|
|
21
|
+
'£': 'left',
|
|
22
|
+
'€': 'right'
|
|
23
|
+
}),
|
|
24
|
+
disabled: figma.enum('state', {
|
|
25
|
+
disabled: true
|
|
26
|
+
}),
|
|
27
|
+
isInvalid: figma.enum('state', {
|
|
28
|
+
error: true
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
example: props => /*#__PURE__*/_jsx(AmountInput, {
|
|
32
|
+
size: props.size,
|
|
33
|
+
disabled: props.disabled,
|
|
34
|
+
isInvalid: props.isInvalid,
|
|
35
|
+
value: props.value,
|
|
36
|
+
onChangeText: () => {},
|
|
37
|
+
currencyText: props.currencyText,
|
|
38
|
+
currencyPosition: props.currencyPosition
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
figma.connect(AmountInput, 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=17523-37413', {
|
|
42
|
+
imports: ["import { AmountInput } from '@ledgerhq/lumen-ui-rnative'"],
|
|
43
|
+
variant: {
|
|
44
|
+
currency: 'crypto'
|
|
45
|
+
},
|
|
46
|
+
props: {
|
|
47
|
+
size: figma.enum('size', {
|
|
48
|
+
md: 'md',
|
|
49
|
+
sm: 'sm'
|
|
50
|
+
}),
|
|
51
|
+
value: figma.string('amount'),
|
|
52
|
+
currencyText: figma.string('crypto'),
|
|
53
|
+
disabled: figma.enum('state', {
|
|
54
|
+
disabled: true
|
|
55
|
+
}),
|
|
56
|
+
isInvalid: figma.enum('state', {
|
|
57
|
+
error: true
|
|
58
|
+
})
|
|
59
|
+
},
|
|
60
|
+
example: props => /*#__PURE__*/_jsx(AmountInput, {
|
|
61
|
+
size: props.size,
|
|
62
|
+
disabled: props.disabled,
|
|
63
|
+
isInvalid: props.isInvalid,
|
|
64
|
+
value: props.value,
|
|
65
|
+
onChangeText: () => {},
|
|
66
|
+
currencyText: props.currencyText,
|
|
67
|
+
currencyPosition: "right"
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=AmountInput.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","AmountInput","jsx","_jsx","connect","imports","props","size","enum","md","sm","value","string","currencyText","$","currencyPosition","disabled","isInvalid","error","example","onChangeText","variant","currency"],"sourceRoot":"../../../../../src","sources":["lib/Components/AmountInput/AmountInput.figma.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,qBAAqB;AACvC,SAASC,WAAW,QAAQ,kBAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5CH,KAAK,CAACI,OAAO,CACXH,WAAW,EACX,yEAAyE,EACzE;EACEI,OAAO,EAAE,CAAC,0DAA0D,CAAC;EACrEC,KAAK,EAAE;IACLC,IAAI,EAAEP,KAAK,CAACQ,IAAI,CAAC,MAAM,EAAE;MACvBC,EAAE,EAAE,IAAI;MACRC,EAAE,EAAE;IACN,CAAC,CAAC;IACFC,KAAK,EAAEX,KAAK,CAACY,MAAM,CAAC,QAAQ,CAAC;IAC7BC,YAAY,EAAEb,KAAK,CAACQ,IAAI,CAAC,UAAU,EAAE;MACnCM,CAAC,EAAE,GAAG;MACN,GAAG,EAAE,GAAG;MACR,GAAG,EAAE;IACP,CAAC,CAAC;IACFC,gBAAgB,EAAEf,KAAK,CAACQ,IAAI,CAAC,UAAU,EAAE;MACvCM,CAAC,EAAE,MAAM;MACT,GAAG,EAAE,MAAM;MACX,GAAG,EAAE;IACP,CAAC,CAAC;IACFE,QAAQ,EAAEhB,KAAK,CAACQ,IAAI,CAAC,OAAO,EAAE;MAC5BQ,QAAQ,EAAE;IACZ,CAAC,CAAC;IACFC,SAAS,EAAEjB,KAAK,CAACQ,IAAI,CAAC,OAAO,EAAE;MAC7BU,KAAK,EAAE;IACT,CAAC;EACH,CAAC;EACDC,OAAO,EAAGb,KAAK,iBACbH,IA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AO,CACzB;AAEL,CACF,CAAC","ignoreList":[]}
|
|
@@ -2,8 +2,6 @@ import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
|
2
2
|
import * as AmountInputStories from './AmountInput.stories';
|
|
3
3
|
import { AmountInput } from './AmountInput';
|
|
4
4
|
import { CustomTabs, Tab } from '../../../../.storybook/components';
|
|
5
|
-
import { DoVsDontRow, DoBlockItem, DontBlockItem } from '../../../../.storybook/components/DoVsDont';
|
|
6
|
-
import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/CommonRulesDoAndDont.mdx';
|
|
7
5
|
|
|
8
6
|
<Meta title='Core/AmountInput' of={AmountInputStories} />
|
|
9
7
|
|
|
@@ -277,194 +275,6 @@ Use the `editable` prop to disable the input:
|
|
|
277
275
|
<AmountInput value='1000' currencyText='USD' editable={false} />
|
|
278
276
|
```
|
|
279
277
|
|
|
280
|
-
## Do's and Don'ts
|
|
281
|
-
|
|
282
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
|
|
283
|
-
<DoVsDontRow>
|
|
284
|
-
<DoBlockItem
|
|
285
|
-
title='Use integer-only for whole number scenarios'
|
|
286
|
-
description='Disable decimals for quantities, counts, or other whole number inputs'
|
|
287
|
-
>
|
|
288
|
-
|
|
289
|
-
{/* prettier-ignore */}
|
|
290
|
-
```tsx
|
|
291
|
-
import { AmountInput } from '@ledgerhq/lumen-ui-rnative';
|
|
292
|
-
import { useState } from 'react';
|
|
293
|
-
|
|
294
|
-
const [quantity, setQuantity] = useState('');
|
|
295
|
-
|
|
296
|
-
// Use integer-only for whole number scenarios (quantity, age, etc.)
|
|
297
|
-
<AmountInput
|
|
298
|
-
value={quantity}
|
|
299
|
-
onChangeText={setQuantity}
|
|
300
|
-
currencyText='items'
|
|
301
|
-
allowDecimals={false}
|
|
302
|
-
maxIntegerLength={4}
|
|
303
|
-
/>
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
</DoBlockItem>
|
|
307
|
-
<DontBlockItem
|
|
308
|
-
title="Don't allow decimals for count-based inputs"
|
|
309
|
-
description='Items, quantities, and counts should always be whole numbers'
|
|
310
|
-
>
|
|
311
|
-
|
|
312
|
-
{/* prettier-ignore */}
|
|
313
|
-
```tsx
|
|
314
|
-
import { AmountInput } from '@ledgerhq/lumen-ui-rnative';
|
|
315
|
-
import { useState } from 'react';
|
|
316
|
-
|
|
317
|
-
const [quantity, setQuantity] = useState('');
|
|
318
|
-
|
|
319
|
-
<AmountInput
|
|
320
|
-
value={quantity}
|
|
321
|
-
onChangeText={setQuantity}
|
|
322
|
-
currencyText='items'
|
|
323
|
-
allowDecimals={true}
|
|
324
|
-
maxIntegerLength={4}
|
|
325
|
-
/>
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
</DontBlockItem>
|
|
329
|
-
|
|
330
|
-
</DoVsDontRow>
|
|
331
|
-
|
|
332
|
-
<DoVsDontRow>
|
|
333
|
-
<DoBlockItem
|
|
334
|
-
title='Always use controlled input pattern'
|
|
335
|
-
description='AmountInput requires both value and onChangeText props'
|
|
336
|
-
>
|
|
337
|
-
|
|
338
|
-
{/* prettier-ignore */}
|
|
339
|
-
```tsx
|
|
340
|
-
import { AmountInput } from '@ledgerhq/lumen-ui-rnative';
|
|
341
|
-
import { useState } from 'react';
|
|
342
|
-
|
|
343
|
-
const [value, setValue] = useState('');
|
|
344
|
-
|
|
345
|
-
<AmountInput
|
|
346
|
-
value={value}
|
|
347
|
-
onChangeText={setValue}
|
|
348
|
-
currencyText='USD'
|
|
349
|
-
/>
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
</DoBlockItem>
|
|
353
|
-
<DontBlockItem
|
|
354
|
-
title="Don't use uncontrolled pattern"
|
|
355
|
-
description='AmountInput does not support defaultValue - always use controlled pattern'
|
|
356
|
-
>
|
|
357
|
-
|
|
358
|
-
{/* prettier-ignore */}
|
|
359
|
-
```tsx
|
|
360
|
-
import { AmountInput } from '@ledgerhq/lumen-ui-rnative';
|
|
361
|
-
import { useState } from 'react';
|
|
362
|
-
|
|
363
|
-
const [value, setValue] = useState('');
|
|
364
|
-
|
|
365
|
-
<AmountInput
|
|
366
|
-
defaultValue='0.00'
|
|
367
|
-
currencyText='USD'
|
|
368
|
-
/>
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
</DontBlockItem>
|
|
372
|
-
|
|
373
|
-
</DoVsDontRow>
|
|
374
|
-
|
|
375
|
-
<DoVsDontRow>
|
|
376
|
-
<DoBlockItem
|
|
377
|
-
title='Use isInvalid for error states'
|
|
378
|
-
description='Use the isInvalid prop to indicate validation errors'
|
|
379
|
-
>
|
|
380
|
-
|
|
381
|
-
{/* prettier-ignore */}
|
|
382
|
-
```tsx
|
|
383
|
-
import { AmountInput } from '@ledgerhq/lumen-ui-rnative';
|
|
384
|
-
import { useState } from 'react';
|
|
385
|
-
|
|
386
|
-
const [value, setValue] = useState('');
|
|
387
|
-
const [hasError, setHasError] = useState(false);
|
|
388
|
-
|
|
389
|
-
<AmountInput
|
|
390
|
-
value={value}
|
|
391
|
-
onChangeText={setValue}
|
|
392
|
-
currencyText='USD'
|
|
393
|
-
isInvalid={hasError}
|
|
394
|
-
/>
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
</DoBlockItem>
|
|
398
|
-
<DontBlockItem
|
|
399
|
-
title="Don't use custom error props"
|
|
400
|
-
description='Use the isInvalid prop for error styling. AmountInput does not accept ad-hoc validation props.'
|
|
401
|
-
>
|
|
402
|
-
|
|
403
|
-
{/* prettier-ignore */}
|
|
404
|
-
```tsx
|
|
405
|
-
import { AmountInput } from '@ledgerhq/lumen-ui-rnative';
|
|
406
|
-
import { useState } from 'react';
|
|
407
|
-
|
|
408
|
-
const [value, setValue] = useState('');
|
|
409
|
-
const [hasError, setHasError] = useState(false);
|
|
410
|
-
|
|
411
|
-
<AmountInput
|
|
412
|
-
value={value}
|
|
413
|
-
onChangeText={setValue}
|
|
414
|
-
currencyText='USD'
|
|
415
|
-
status={hasError ? 'error' : undefined}
|
|
416
|
-
helperText={hasError ? 'Invalid amount' : undefined}
|
|
417
|
-
/>
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
</DontBlockItem>
|
|
421
|
-
|
|
422
|
-
</DoVsDontRow>
|
|
423
|
-
|
|
424
|
-
<DoVsDontRow>
|
|
425
|
-
<DoBlockItem
|
|
426
|
-
title='Use appropriate length limits'
|
|
427
|
-
description='Set maxIntegerLength and maxDecimalLength based on your use case'
|
|
428
|
-
>
|
|
429
|
-
|
|
430
|
-
{/* prettier-ignore */}
|
|
431
|
-
```tsx
|
|
432
|
-
import { AmountInput } from '@ledgerhq/lumen-ui-rnative';
|
|
433
|
-
|
|
434
|
-
<AmountInput
|
|
435
|
-
value={amount}
|
|
436
|
-
onChangeText={setAmount}
|
|
437
|
-
currencyText='$'
|
|
438
|
-
maxIntegerLength={9}
|
|
439
|
-
maxDecimalLength={2}
|
|
440
|
-
/>
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
</DoBlockItem>
|
|
444
|
-
<DontBlockItem
|
|
445
|
-
title="Don't use overly restrictive or excessive limits"
|
|
446
|
-
description='Length limits should match real-world requirements'
|
|
447
|
-
>
|
|
448
|
-
|
|
449
|
-
{/* prettier-ignore */}
|
|
450
|
-
```tsx
|
|
451
|
-
import { AmountInput } from '@ledgerhq/lumen-ui-rnative';
|
|
452
|
-
|
|
453
|
-
<AmountInput
|
|
454
|
-
value={amount}
|
|
455
|
-
onChangeText={setAmount}
|
|
456
|
-
currencyText='$'
|
|
457
|
-
maxIntegerLength={1}
|
|
458
|
-
maxDecimalLength={25}
|
|
459
|
-
/>
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
</DontBlockItem>
|
|
463
|
-
|
|
464
|
-
</DoVsDontRow>
|
|
465
|
-
|
|
466
|
-
<CommonRulesDoAndDont />
|
|
467
|
-
</div>
|
|
468
278
|
|
|
469
279
|
## Platform Considerations
|
|
470
280
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import figma from '@figma/code-connect';
|
|
4
|
+
import { DotIndicator, getDotIndicatorProps } from "../DotIndicator/index.js";
|
|
4
5
|
import { Avatar } from "./Avatar.js";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
figma.connect(Avatar, 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=11097-8', {
|
|
7
|
-
imports: ["import { Avatar } from '@ledgerhq/lumen-ui-rnative'"],
|
|
8
|
+
imports: ["import { Avatar, DotIndicator, getDotIndicatorProps } from '@ledgerhq/lumen-ui-rnative'"],
|
|
8
9
|
props: {
|
|
9
10
|
appearance: figma.enum('appearance', {
|
|
10
11
|
gray: 'gray',
|
|
@@ -16,17 +17,19 @@ figma.connect(Avatar, 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-
|
|
|
16
17
|
lg: 'lg',
|
|
17
18
|
xl: 'xl'
|
|
18
19
|
}),
|
|
19
|
-
showNotification: figma.boolean('show-notification'
|
|
20
|
-
true: true,
|
|
21
|
-
false: false
|
|
22
|
-
})
|
|
20
|
+
showNotification: figma.boolean('show-notification')
|
|
23
21
|
},
|
|
24
|
-
example: props =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
example: props => {
|
|
23
|
+
const avatar = /*#__PURE__*/_jsx(Avatar, {
|
|
24
|
+
src: "https://example-image.com",
|
|
25
|
+
appearance: props.appearance,
|
|
26
|
+
size: props.size,
|
|
27
|
+
alt: "John Doe's Avatar"
|
|
28
|
+
});
|
|
29
|
+
return props.showNotification && (props.size === 'sm' || props.size === 'md') ? /*#__PURE__*/_jsx(DotIndicator, {
|
|
30
|
+
...getDotIndicatorProps('avatar', props.size),
|
|
31
|
+
children: avatar
|
|
32
|
+
}) : avatar;
|
|
33
|
+
}
|
|
31
34
|
});
|
|
32
35
|
//# sourceMappingURL=Avatar.figma.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["figma","Avatar","jsx","_jsx","connect","imports","props","appearance","enum","gray","transparent","size","sm","md","lg","xl","showNotification","boolean","
|
|
1
|
+
{"version":3,"names":["figma","DotIndicator","getDotIndicatorProps","Avatar","jsx","_jsx","connect","imports","props","appearance","enum","gray","transparent","size","sm","md","lg","xl","showNotification","boolean","example","avatar","src","alt","children"],"sourceRoot":"../../../../../src","sources":["lib/Components/Avatar/Avatar.figma.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,qBAAqB;AACvC,SAASC,YAAY,EAAEC,oBAAoB,QAAQ,0BAAiB;AACpE,SAASC,MAAM,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElCL,KAAK,CAACM,OAAO,CACXH,MAAM,EACN,qEAAqE,EACrE;EACEI,OAAO,EAAE,CACP,yFAAyF,CAC1F;EACDC,KAAK,EAAE;IACLC,UAAU,EAAET,KAAK,CAACU,IAAI,CAAC,YAAY,EAAE;MACnCC,IAAI,EAAE,MAAM;MACZC,WAAW,EAAE;IACf,CAAC,CAAC;IACFC,IAAI,EAAEb,KAAK,CAACU,IAAI,CAAC,MAAM,EAAE;MACvBI,EAAE,EAAE,IAAI;MACRC,EAAE,EAAE,IAAI;MACRC,EAAE,EAAE,IAAI;MACRC,EAAE,EAAE;IACN,CAAC,CAAC;IACFC,gBAAgB,EAAElB,KAAK,CAACmB,OAAO,CAAC,mBAAmB;EACrD,CAAC;EACDC,OAAO,EAAGZ,KAAK,IAAK;IAClB,MAAMa,MAAM,gBACVhB,IAAA,CAACF,MAAM;MACLmB,GAAG,EAAC,2BAA2B;MAC/Bb,UAAU,EAAED,KAAK,CAACC,UAAW;MAC7BI,IAAI,EAAEL,KAAK,CAACK,IAAK;MACjBU,GAAG,EAAC;IAAmB,CACxB,CACF;IAED,OAAOf,KAAK,CAACU,gBAAgB,KAC1BV,KAAK,CAACK,IAAI,KAAK,IAAI,IAAIL,KAAK,CAACK,IAAI,KAAK,IAAI,CAAC,gBAC5CR,IAAA,CAACJ,YAAY;MAAA,GAAKC,oBAAoB,CAAC,QAAQ,EAAEM,KAAK,CAACK,IAAI,CAAC;MAAAW,QAAA,EACzDH;IAAM,CACK,CAAC,GAEfA,MACD;EACH;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { Image, StyleSheet } from 'react-native';
|
|
5
5
|
import { useCommonTranslation } from "../../../i18n/index.js";
|
|
6
6
|
import { useStyleSheet } from "../../../styles/index.js";
|
|
7
7
|
import { User } from "../../Symbols/index.js";
|
|
8
|
-
import { DotIndicator } from "../DotIndicator/index.js";
|
|
9
8
|
import { Box } from "../Utility/index.js";
|
|
10
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
10
|
const fallbackSizes = {
|
|
@@ -14,10 +13,6 @@ const fallbackSizes = {
|
|
|
14
13
|
lg: 32,
|
|
15
14
|
xl: 40
|
|
16
15
|
};
|
|
17
|
-
const dotSizeMap = {
|
|
18
|
-
sm: 'lg',
|
|
19
|
-
md: 'xl'
|
|
20
|
-
};
|
|
21
16
|
const useStyles = ({
|
|
22
17
|
appearance,
|
|
23
18
|
size
|
|
@@ -78,9 +73,6 @@ const useStyles = ({
|
|
|
78
73
|
* import { Avatar } from '@ledgerhq/lumen-ui-rnative';
|
|
79
74
|
*
|
|
80
75
|
* <Avatar src="https://example.com/photo.jpg" size="md" />
|
|
81
|
-
*
|
|
82
|
-
* // With notification indicator
|
|
83
|
-
* <Avatar src="https://example.com/photo.jpg" showNotification />
|
|
84
76
|
*/
|
|
85
77
|
export const Avatar = ({
|
|
86
78
|
lx,
|
|
@@ -89,8 +81,6 @@ export const Avatar = ({
|
|
|
89
81
|
alt = 'avatar',
|
|
90
82
|
appearance = 'transparent',
|
|
91
83
|
size = 'md',
|
|
92
|
-
showNotification: showNotificationProp = false,
|
|
93
|
-
testID,
|
|
94
84
|
ref,
|
|
95
85
|
...props
|
|
96
86
|
}) => {
|
|
@@ -103,11 +93,7 @@ export const Avatar = ({
|
|
|
103
93
|
appearance,
|
|
104
94
|
size
|
|
105
95
|
});
|
|
106
|
-
const resolvedAlt = alt || t('components.avatar.
|
|
107
|
-
|
|
108
|
-
// dot indicator is not visible on larger sizes, regardless of the `showNotification` prop
|
|
109
|
-
const showNotification = showNotificationProp && (size === 'sm' || size === 'md');
|
|
110
|
-
const accessibilityLabel = showNotification ? `${resolvedAlt}, ${t('components.avatar.notificationAriaLabel')}` : resolvedAlt;
|
|
96
|
+
const resolvedAlt = alt || t('components.avatar.defaultAriaLabel');
|
|
111
97
|
useEffect(() => {
|
|
112
98
|
setError(false);
|
|
113
99
|
}, [src]);
|
|
@@ -116,8 +102,7 @@ export const Avatar = ({
|
|
|
116
102
|
lx: lx,
|
|
117
103
|
style: StyleSheet.flatten([styles.root, style]),
|
|
118
104
|
accessibilityRole: "image",
|
|
119
|
-
accessibilityLabel:
|
|
120
|
-
testID: showNotification ? undefined : testID,
|
|
105
|
+
accessibilityLabel: resolvedAlt,
|
|
121
106
|
...props,
|
|
122
107
|
children: shouldFallback ? /*#__PURE__*/_jsx(User, {
|
|
123
108
|
size: fallbackSizes[size],
|
|
@@ -133,14 +118,6 @@ export const Avatar = ({
|
|
|
133
118
|
testID: "avatar-image"
|
|
134
119
|
})
|
|
135
120
|
});
|
|
136
|
-
if (showNotification) {
|
|
137
|
-
return /*#__PURE__*/_jsx(DotIndicator, {
|
|
138
|
-
size: dotSizeMap[size],
|
|
139
|
-
appearance: "red",
|
|
140
|
-
testID: testID,
|
|
141
|
-
children: avatarContent
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
121
|
return avatarContent;
|
|
145
122
|
};
|
|
146
123
|
//# sourceMappingURL=Avatar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useEffect","useState","Image","StyleSheet","useCommonTranslation","useStyleSheet","User","Box","jsx","_jsx","fallbackSizes","sm","md","lg","xl","useStyles","appearance","size","t","backgroundColors","gray","colors","bg","muted","transparent","mutedTransparent","sizeMap","sizes","s40","padding","spacings","s4","s48","s56","s72","root","position","width","height","borderRadius","backgroundColor","alignItems","justifyContent","image","overflow","Avatar","lx","style","src","alt","ref","props","error","setError","shouldFallback","styles","resolvedAlt","avatarContent","flatten","accessibilityRole","accessibilityLabel","children","accessible","testID","source","uri","onError"],"sourceRoot":"../../../../../src","sources":["lib/Components/Avatar/Avatar.tsx"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,KAAK,EAAEC,UAAU,QAAQ,cAAc;AAChD,SAASC,oBAAoB,QAAQ,wBAAe;AACpD,SAASC,aAAa,QAAQ,0BAAiB;AAC/C,SAASC,IAAI,QAAQ,wBAAe;AACpC,SAASC,GAAG,QAAQ,qBAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMjC,MAAMC,aAAa,GAAG;EACpBC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE,EAAE;EACNC,EAAE,EAAE;AACN,CAAU;AAEV,MAAMC,SAAS,GAAGA,CAAC;EACjBC,UAAU;EACVC;AAIF,CAAC,KAAK;EACJ,OAAOZ,aAAa,CACjBa,CAAC,IAAK;IACL,MAAMC,gBAA4C,GAAG;MACnDC,IAAI,EAAEF,CAAC,CAACG,MAAM,CAACC,EAAE,CAACC,KAAK;MACvBC,WAAW,EAAEN,CAAC,CAACG,MAAM,CAACC,EAAE,CAACG;IAC3B,CAAC;IAED,MAAMC,OAAO,GAAG;MACdf,EAAE,EAAE;QAAEM,IAAI,EAAEC,CAAC,CAACS,KAAK,CAACC,GAAG;QAAEC,OAAO,EAAEX,CAAC,CAACY,QAAQ,CAACC;MAAG,CAAC;MACjDnB,E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ar.stories';
|
|
3
3
|
import { Avatar } from './Avatar';
|
|
4
4
|
import { CustomTabs, Tab } from '../../../../.storybook/components';
|
|
5
|
-
import { DoVsDontRow, DoBlockItem, DontBlockItem } from '../../../../.storybook/components/DoVsDont';
|
|
6
|
-
import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/CommonRulesDoAndDont.mdx';
|
|
7
5
|
import { Box } from '../Utility';
|
|
8
6
|
|
|
9
7
|
<Meta title='Core/Avatar' of={AvatarStories} />
|
|
@@ -60,11 +58,22 @@ The Avatar component handles two primary states automatically:
|
|
|
60
58
|
|
|
61
59
|
### Notification Indicator
|
|
62
60
|
|
|
63
|
-
|
|
61
|
+
To show a status or alert dot, wrap the Avatar in a `DotIndicator` and derive the dot props from the avatar size with the `getDotIndicatorProps` helper:
|
|
64
62
|
|
|
65
|
-
|
|
63
|
+
```tsx
|
|
64
|
+
import { Avatar, DotIndicator, getDotIndicatorProps } from '@ledgerhq/lumen-ui-rnative';
|
|
65
|
+
|
|
66
|
+
<DotIndicator
|
|
67
|
+
{...getDotIndicatorProps('avatar', 'md')}
|
|
68
|
+
accessibilityLabel="New notifications"
|
|
69
|
+
>
|
|
70
|
+
<Avatar src="https://example.com/photo.jpg" size="md" />
|
|
71
|
+
</DotIndicator>;
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
> The notification dot is only supported on the `sm` and `md` sizes.
|
|
66
75
|
|
|
67
|
-
>
|
|
76
|
+
> When the dot conveys state to the user, pass an `accessibilityLabel` to `DotIndicator`.
|
|
68
77
|
|
|
69
78
|
<Canvas of={AvatarStories.NotificationShowcase} />
|
|
70
79
|
|
|
@@ -116,21 +125,23 @@ function MyComponent() {
|
|
|
116
125
|
|
|
117
126
|
### With Notification
|
|
118
127
|
|
|
119
|
-
|
|
128
|
+
Wrap the Avatar in a `DotIndicator` to show a status or alert dot, using `getDotIndicatorProps` to match the dot to the avatar size:
|
|
120
129
|
|
|
121
130
|
```tsx
|
|
122
|
-
import { Avatar } from '@ledgerhq/lumen-ui-rnative';
|
|
131
|
+
import { Avatar, DotIndicator, getDotIndicatorProps } from '@ledgerhq/lumen-ui-rnative';
|
|
123
132
|
|
|
124
133
|
function MyComponent() {
|
|
125
|
-
const hasNotifications = true;
|
|
126
|
-
|
|
127
134
|
return (
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
135
|
+
<DotIndicator
|
|
136
|
+
{...getDotIndicatorProps('avatar', 'md')}
|
|
137
|
+
accessibilityLabel="New notifications"
|
|
138
|
+
>
|
|
139
|
+
<Avatar
|
|
140
|
+
src="https://example.com/photo.jpg"
|
|
141
|
+
size="md"
|
|
142
|
+
alt="User profile"
|
|
143
|
+
/>
|
|
144
|
+
</DotIndicator>
|
|
134
145
|
);
|
|
135
146
|
}
|
|
136
147
|
```
|
|
@@ -159,7 +170,7 @@ function MyComponent() {
|
|
|
159
170
|
Avatars are commonly used as interactive triggers for navigation or actions. Wrap the Avatar in a `Pressable` component:
|
|
160
171
|
|
|
161
172
|
```tsx
|
|
162
|
-
import { Avatar } from '@ledgerhq/lumen-ui-rnative';
|
|
173
|
+
import { Avatar, DotIndicator, getDotIndicatorProps } from '@ledgerhq/lumen-ui-rnative';
|
|
163
174
|
import { Pressable, Linking } from 'react-native';
|
|
164
175
|
|
|
165
176
|
function UserProfile() {
|
|
@@ -177,12 +188,12 @@ function UserProfile() {
|
|
|
177
188
|
backgroundColor: pressed ? 'rgba(0, 0, 0, 0.05)' : 'transparent',
|
|
178
189
|
})}
|
|
179
190
|
>
|
|
180
|
-
<
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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>
|
|
186
197
|
</Pressable>
|
|
187
198
|
);
|
|
188
199
|
}
|
|
@@ -193,6 +204,7 @@ function UserProfile() {
|
|
|
193
204
|
- Use `borderRadius: 9999` to maintain circular touch area
|
|
194
205
|
- Add opacity changes for visual feedback on press
|
|
195
206
|
- Provide appropriate `alt` text for accessibility
|
|
207
|
+
- Pass an `accessibilityLabel` to `DotIndicator` so the notification state is announced by screen readers
|
|
196
208
|
|
|
197
209
|
### Custom Styling
|
|
198
210
|
|
|
@@ -221,7 +233,7 @@ You can also use the `style` prop for escape-hatch styling when needed:
|
|
|
221
233
|
Here's a comprehensive example showing all Avatar features in a user profile context:
|
|
222
234
|
|
|
223
235
|
```tsx
|
|
224
|
-
import { Avatar, Box, Text } from '@ledgerhq/lumen-ui-rnative';
|
|
236
|
+
import { Avatar, Box, Text, DotIndicator, getDotIndicatorProps } from '@ledgerhq/lumen-ui-rnative';
|
|
225
237
|
import { Pressable } from 'react-native';
|
|
226
238
|
import { useState } from 'react';
|
|
227
239
|
|
|
@@ -237,6 +249,14 @@ function UserProfileHeader() {
|
|
|
237
249
|
// Navigate to profile or show menu
|
|
238
250
|
};
|
|
239
251
|
|
|
252
|
+
const avatar = (
|
|
253
|
+
<Avatar
|
|
254
|
+
src={user.avatar}
|
|
255
|
+
size="md"
|
|
256
|
+
alt={`${user.name} profile picture`}
|
|
257
|
+
/>
|
|
258
|
+
);
|
|
259
|
+
|
|
240
260
|
return (
|
|
241
261
|
<Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's12', padding: 's16' }}>
|
|
242
262
|
<Pressable
|
|
@@ -247,12 +267,16 @@ function UserProfileHeader() {
|
|
|
247
267
|
backgroundColor: pressed ? 'rgba(0, 0, 0, 0.05)' : 'transparent',
|
|
248
268
|
})}
|
|
249
269
|
>
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
270
|
+
{user.hasNotifications ? (
|
|
271
|
+
<DotIndicator
|
|
272
|
+
{...getDotIndicatorProps('avatar', 'md')}
|
|
273
|
+
accessibilityLabel="You have new notifications"
|
|
274
|
+
>
|
|
275
|
+
{avatar}
|
|
276
|
+
</DotIndicator>
|
|
277
|
+
) : (
|
|
278
|
+
avatar
|
|
279
|
+
)}
|
|
256
280
|
</Pressable>
|
|
257
281
|
<Box lx={{ flexDirection: 'column' }}>
|
|
258
282
|
<Text>{user.name}</Text>
|
|
@@ -267,46 +291,6 @@ function UserProfileHeader() {
|
|
|
267
291
|
}
|
|
268
292
|
```
|
|
269
293
|
|
|
270
|
-
## Do's and Don'ts
|
|
271
|
-
|
|
272
|
-
The following guidelines ensure consistent usage of the Avatar component and maintain design system principles.
|
|
273
|
-
|
|
274
|
-
<Box lx={{ flexDirection: 'column', gap: 's24' }}>
|
|
275
|
-
<DoVsDontRow>
|
|
276
|
-
<DoBlockItem
|
|
277
|
-
title='Provide descriptive alt text'
|
|
278
|
-
description='Use meaningful alt text for better accessibility and screen reader support'
|
|
279
|
-
>
|
|
280
|
-
|
|
281
|
-
{/* prettier-ignore */}
|
|
282
|
-
```tsx
|
|
283
|
-
<Avatar
|
|
284
|
-
src="https://example.com/photo.jpg"
|
|
285
|
-
alt="John Doe profile picture"
|
|
286
|
-
size="md"
|
|
287
|
-
/>
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
</DoBlockItem>
|
|
291
|
-
<DontBlockItem
|
|
292
|
-
title="Don't omit alt text"
|
|
293
|
-
description='Missing alt text reduces accessibility for screen reader users'
|
|
294
|
-
>
|
|
295
|
-
|
|
296
|
-
{/* prettier-ignore */}
|
|
297
|
-
```tsx
|
|
298
|
-
<Avatar
|
|
299
|
-
src="https://example.com/photo.jpg"
|
|
300
|
-
size="md"
|
|
301
|
-
/>
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
</DontBlockItem>
|
|
305
|
-
|
|
306
|
-
</DoVsDontRow>
|
|
307
|
-
|
|
308
|
-
<CommonRulesDoAndDont />
|
|
309
|
-
</Box>
|
|
310
294
|
|
|
311
295
|
## Platform Considerations
|
|
312
296
|
|