@ledgerhq/lumen-ui-rnative 0.1.35 → 0.1.37
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/lib/Animations/Pulse/Pulse.js +2 -2
- package/dist/module/lib/Animations/Pulse/Pulse.js.map +1 -1
- package/dist/module/lib/Animations/Pulse/Pulse.mdx +1 -1
- package/dist/module/lib/Animations/Spin/Spin.mdx +1 -1
- package/dist/module/lib/Components/AddressInput/AddressInput.mdx +1 -1
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.js +68 -39
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.js.map +1 -1
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.mdx +7 -1
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.stories.js +24 -0
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.stories.js.map +1 -1
- package/dist/module/lib/Components/AmountDisplay/types.js.map +1 -1
- package/dist/module/lib/Components/AmountInput/AmountInput.mdx +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.mdx +1 -1
- package/dist/module/lib/Components/Banner/Banner.mdx +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +1 -1
- package/dist/module/lib/Components/Button/Button.mdx +1 -1
- package/dist/module/lib/Components/Card/Card.stories.js +4 -9
- package/dist/module/lib/Components/Card/Card.stories.js.map +1 -1
- package/dist/module/lib/Components/CardButton/CardButton.mdx +1 -1
- package/dist/module/lib/Components/Checkbox/Checkbox.mdx +1 -1
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.js +184 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.js.map +1 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.mdx +139 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.stories.js +258 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.stories.js.map +1 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.test.js +94 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.test.js.map +1 -0
- package/dist/module/lib/Components/DescriptionItem/index.js +5 -0
- package/dist/module/lib/Components/DescriptionItem/index.js.map +1 -0
- package/dist/module/lib/Components/DescriptionItem/types.js +4 -0
- package/dist/module/lib/Components/DescriptionItem/types.js.map +1 -0
- package/dist/module/lib/Components/Divider/Divider.mdx +1 -1
- package/dist/module/lib/Components/DotIcon/DotIcon.js +44 -23
- package/dist/module/lib/Components/DotIcon/DotIcon.js.map +1 -1
- package/dist/module/lib/Components/DotIcon/DotIcon.mdx +92 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.stories.js +47 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.stories.js.map +1 -1
- package/dist/module/lib/Components/DotSymbol/DotSymbol.js +52 -30
- package/dist/module/lib/Components/DotSymbol/DotSymbol.js.map +1 -1
- package/dist/module/lib/Components/DotSymbol/DotSymbol.mdx +79 -2
- package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js +41 -0
- package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js.map +1 -1
- package/dist/module/lib/Components/IconButton/IconButton.mdx +1 -1
- package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.mdx +1 -1
- package/dist/module/lib/Components/Link/Link.mdx +1 -1
- package/dist/module/lib/Components/MediaBanner/MediaBanner.mdx +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.js +17 -17
- package/dist/module/lib/Components/MediaButton/MediaButton.js.map +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.mdx +3 -3
- package/dist/module/lib/Components/MediaButton/MediaButton.stories.js +17 -17
- package/dist/module/lib/Components/MediaButton/MediaButton.stories.js.map +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.test.js +4 -4
- package/dist/module/lib/Components/MediaButton/MediaButton.test.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.js +20 -4
- package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js +35 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js.map +1 -1
- package/dist/module/lib/Components/NavBar/CoinCapsule.js +3 -2
- package/dist/module/lib/Components/NavBar/CoinCapsule.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.js +2 -2
- package/dist/module/lib/Components/NavBar/NavBar.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.mdx +2 -2
- package/dist/module/lib/Components/NavBar/NavBar.stories.js +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.stories.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.test.js +3 -3
- package/dist/module/lib/Components/NavBar/NavBar.test.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.stories.js +4 -4
- package/dist/module/lib/Components/OptionList/OptionList.stories.js.map +1 -1
- package/dist/module/lib/Components/PageIndicator/PageIndicator.js +13 -8
- package/dist/module/lib/Components/PageIndicator/PageIndicator.js.map +1 -1
- package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js +58 -0
- package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js.map +1 -1
- package/dist/module/lib/Components/SearchInput/SearchInput.mdx +1 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.mdx +1 -1
- package/dist/module/lib/Components/Select/Select.mdx +1 -1
- package/dist/module/lib/Components/Spinner/Spinner.mdx +1 -1
- package/dist/module/lib/Components/Spot/Spot.mdx +1 -1
- package/dist/module/lib/Components/Stepper/Stepper.mdx +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.mdx +1 -1
- package/dist/module/lib/Components/Switch/Switch.mdx +1 -1
- package/dist/module/lib/Components/TabBar/TabBar.mdx +1 -1
- package/dist/module/lib/Components/TextInput/TextInput.mdx +1 -1
- package/dist/module/lib/Components/Tile/Tile.mdx +1 -1
- package/dist/module/lib/Components/Tooltip/Tooltip.mdx +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/lib/Animations/Pulse/Pulse.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AmountDisplay/AmountDisplay.d.ts +1 -1
- package/dist/typescript/src/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AmountDisplay/index.d.ts +1 -1
- package/dist/typescript/src/lib/Components/AmountDisplay/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AmountDisplay/types.d.ts +10 -3
- package/dist/typescript/src/lib/Components/AmountDisplay/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DescriptionItem/DescriptionItem.d.ts +42 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/DescriptionItem.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/types.d.ts +39 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/types.d.ts +6 -0
- package/dist/typescript/src/lib/Components/DotIcon/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts +1 -1
- package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts +6 -0
- package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts +3 -3
- package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaButton/types.d.ts +6 -6
- package/dist/typescript/src/lib/Components/MediaButton/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts +6 -0
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/NavBar/CoinCapsule.d.ts +1 -1
- package/dist/typescript/src/lib/Components/NavBar/CoinCapsule.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/NavBar/NavBar.d.ts +1 -1
- package/dist/typescript/src/lib/Components/NavBar/NavBar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/NavBar/types.d.ts +3 -3
- package/dist/typescript/src/lib/Components/NavBar/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/PageIndicator/PageIndicator.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/lib/Animations/Pulse/Pulse.mdx +1 -1
- package/src/lib/Animations/Pulse/Pulse.tsx +6 -3
- package/src/lib/Animations/Spin/Spin.mdx +1 -1
- package/src/lib/Components/AddressInput/AddressInput.mdx +1 -1
- package/src/lib/Components/AmountDisplay/AmountDisplay.mdx +7 -1
- package/src/lib/Components/AmountDisplay/AmountDisplay.stories.tsx +18 -0
- package/src/lib/Components/AmountDisplay/AmountDisplay.tsx +71 -40
- package/src/lib/Components/AmountDisplay/index.ts +5 -1
- package/src/lib/Components/AmountDisplay/types.ts +12 -3
- package/src/lib/Components/AmountInput/AmountInput.mdx +1 -1
- package/src/lib/Components/Avatar/Avatar.mdx +1 -1
- package/src/lib/Components/Banner/Banner.mdx +1 -1
- package/src/lib/Components/BottomSheet/BottomSheet.mdx +1 -1
- package/src/lib/Components/Button/Button.mdx +1 -1
- package/src/lib/Components/Card/Card.stories.tsx +1 -3
- package/src/lib/Components/CardButton/CardButton.mdx +1 -1
- package/src/lib/Components/Checkbox/Checkbox.mdx +1 -1
- package/src/lib/Components/DescriptionItem/DescriptionItem.mdx +139 -0
- package/src/lib/Components/DescriptionItem/DescriptionItem.stories.tsx +234 -0
- package/src/lib/Components/DescriptionItem/DescriptionItem.test.tsx +112 -0
- package/src/lib/Components/DescriptionItem/DescriptionItem.tsx +224 -0
- package/src/lib/Components/DescriptionItem/index.ts +2 -0
- package/src/lib/Components/DescriptionItem/types.ts +44 -0
- package/src/lib/Components/Divider/Divider.mdx +1 -1
- package/src/lib/Components/DotIcon/DotIcon.mdx +92 -0
- package/src/lib/Components/DotIcon/DotIcon.stories.tsx +35 -0
- package/src/lib/Components/DotIcon/DotIcon.tsx +31 -14
- package/src/lib/Components/DotIcon/types.ts +6 -0
- package/src/lib/Components/DotSymbol/DotSymbol.mdx +79 -2
- package/src/lib/Components/DotSymbol/DotSymbol.stories.tsx +17 -0
- package/src/lib/Components/DotSymbol/DotSymbol.tsx +42 -24
- package/src/lib/Components/DotSymbol/types.ts +6 -0
- package/src/lib/Components/IconButton/IconButton.mdx +1 -1
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.mdx +1 -1
- package/src/lib/Components/Link/Link.mdx +1 -1
- package/src/lib/Components/MediaBanner/MediaBanner.mdx +1 -1
- package/src/lib/Components/MediaButton/MediaButton.mdx +3 -3
- package/src/lib/Components/MediaButton/MediaButton.stories.tsx +29 -15
- package/src/lib/Components/MediaButton/MediaButton.test.tsx +4 -4
- package/src/lib/Components/MediaButton/MediaButton.tsx +33 -20
- package/src/lib/Components/MediaButton/types.ts +6 -6
- package/src/lib/Components/MediaImage/MediaImage.stories.tsx +18 -0
- package/src/lib/Components/MediaImage/MediaImage.tsx +12 -2
- package/src/lib/Components/MediaImage/types.ts +6 -0
- package/src/lib/Components/NavBar/CoinCapsule.tsx +3 -2
- package/src/lib/Components/NavBar/NavBar.mdx +2 -2
- package/src/lib/Components/NavBar/NavBar.stories.tsx +3 -1
- package/src/lib/Components/NavBar/NavBar.test.tsx +3 -3
- package/src/lib/Components/NavBar/NavBar.tsx +2 -2
- package/src/lib/Components/NavBar/types.ts +3 -3
- package/src/lib/Components/OptionList/OptionList.stories.tsx +4 -4
- package/src/lib/Components/PageIndicator/PageIndicator.test.tsx +78 -0
- package/src/lib/Components/PageIndicator/PageIndicator.tsx +15 -7
- package/src/lib/Components/SearchInput/SearchInput.mdx +1 -1
- package/src/lib/Components/SegmentedControl/SegmentedControl.mdx +1 -1
- package/src/lib/Components/Select/Select.mdx +1 -1
- package/src/lib/Components/Spinner/Spinner.mdx +1 -1
- package/src/lib/Components/Spot/Spot.mdx +1 -1
- package/src/lib/Components/Stepper/Stepper.mdx +1 -1
- package/src/lib/Components/Subheader/Subheader.mdx +1 -1
- package/src/lib/Components/Switch/Switch.mdx +1 -1
- package/src/lib/Components/TabBar/TabBar.mdx +1 -1
- package/src/lib/Components/TextInput/TextInput.mdx +1 -1
- package/src/lib/Components/Tile/Tile.mdx +1 -1
- package/src/lib/Components/Tooltip/Tooltip.mdx +1 -1
- package/src/lib/Components/index.ts +1 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { StyledTextProps, StyledViewProps } from '../../../styles';
|
|
3
|
+
|
|
4
|
+
export type DescriptionItemSize = 'sm' | 'md';
|
|
5
|
+
|
|
6
|
+
export type DescriptionItemProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The content of the description item (DescriptionItemLeading, DescriptionItemTrailing).
|
|
9
|
+
*/
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* The size of the description item.
|
|
13
|
+
* @default 'md'
|
|
14
|
+
*/
|
|
15
|
+
size?: DescriptionItemSize;
|
|
16
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
17
|
+
|
|
18
|
+
export type DescriptionItemLeadingProps = {
|
|
19
|
+
/**
|
|
20
|
+
* The leading content (DescriptionItemLabel + optional info icon sibling).
|
|
21
|
+
*/
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
24
|
+
|
|
25
|
+
export type DescriptionItemLabelProps = {
|
|
26
|
+
/**
|
|
27
|
+
* The label text or custom content.
|
|
28
|
+
*/
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
} & Omit<StyledTextProps, 'children'>;
|
|
31
|
+
|
|
32
|
+
export type DescriptionItemTrailingProps = {
|
|
33
|
+
/**
|
|
34
|
+
* The trailing content (DescriptionItemValue, Tag, Link, etc.).
|
|
35
|
+
*/
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
38
|
+
|
|
39
|
+
export type DescriptionItemValueProps = {
|
|
40
|
+
/**
|
|
41
|
+
* The value text or custom content.
|
|
42
|
+
*/
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
} & Omit<StyledTextProps, 'children'>;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
2
|
import * as DotIconStories from './DotIcon.stories';
|
|
3
|
+
import { CustomTabs, Tab } from '../../../../.storybook/components';
|
|
3
4
|
|
|
4
5
|
<Meta title='Communication/DotIcon' of={DotIconStories} />
|
|
5
6
|
|
|
6
7
|
# DotIcon
|
|
7
8
|
|
|
9
|
+
<CustomTabs>
|
|
10
|
+
<Tab label="Overview">
|
|
11
|
+
|
|
8
12
|
## Introduction
|
|
9
13
|
|
|
10
14
|
DotIcon positions a small icon indicator at a configurable corner of a child element such as MediaImage or Spot. The dot background uses a semantic color (`success`, `muted`, or `error`) to convey meaning at a glance.
|
|
15
|
+
|
|
11
16
|
> View in [Figma](https://www.figma.com/design/zSkvGGiqcnhywp2l3HTHxA/1.-Symbol-Library?node-id=6159-1866).
|
|
12
17
|
|
|
13
18
|
## Anatomy
|
|
@@ -50,7 +55,94 @@ The dot size is driven by the parent MediaImage or Spot size via the mapping hel
|
|
|
50
55
|
|
|
51
56
|
<Canvas of={DotIconStories.SizeShowcase} />
|
|
52
57
|
|
|
58
|
+
### Disabled
|
|
59
|
+
|
|
60
|
+
Only set `disabled` on `DotIcon`. The state is propagated to the child via context. Passing it to both stacks the opacity overlay.
|
|
61
|
+
|
|
62
|
+
<Canvas of={DotIconStories.DisabledShowcase} />
|
|
63
|
+
|
|
53
64
|
## Accessibility
|
|
54
65
|
|
|
55
66
|
- The icon is purely decorative; the child element should carry its own accessibility label.
|
|
56
67
|
- Pair semantic appearances with meaningful icons so the state can be understood without relying on color alone.
|
|
68
|
+
|
|
69
|
+
</Tab>
|
|
70
|
+
<Tab label="Implementation">
|
|
71
|
+
|
|
72
|
+
## Setup
|
|
73
|
+
|
|
74
|
+
Install and set up the library with our [Setup Guide →](?path=/docs/getting-started-setup--docs).
|
|
75
|
+
|
|
76
|
+
### Basic Usage
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
import { DotIcon, MediaImage } from '@ledgerhq/lumen-ui-rnative';
|
|
80
|
+
import { ArrowDown } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
81
|
+
|
|
82
|
+
function MyComponent() {
|
|
83
|
+
return (
|
|
84
|
+
<DotIcon appearance='success' icon={ArrowDown}>
|
|
85
|
+
<MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
|
|
86
|
+
</DotIcon>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Pin Placement
|
|
92
|
+
|
|
93
|
+
Position the dot at any of the four corners of the child:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<DotIcon appearance='success' icon={ArrowDown} pin='top-end'>
|
|
97
|
+
<MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
|
|
98
|
+
</DotIcon>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Shapes
|
|
102
|
+
|
|
103
|
+
Use `shape='square'` to match a square child element:
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<DotIcon appearance='muted' icon={ArrowDown} shape='square'>
|
|
107
|
+
<MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} shape='square' />
|
|
108
|
+
</DotIcon>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Appearances
|
|
112
|
+
|
|
113
|
+
Pick a semantic color via `appearance`:
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
<DotIcon appearance='success' icon={ArrowDown}>...</DotIcon>
|
|
117
|
+
<DotIcon appearance='muted' icon={ArrowUp}>...</DotIcon>
|
|
118
|
+
<DotIcon appearance='error' icon={Close}>...</DotIcon>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Sizing
|
|
122
|
+
|
|
123
|
+
The dot size is driven by the parent's size via the mapping helpers:
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
import { DotIcon, mediaImageDotIconSizeMap, MediaImage } from '@ledgerhq/lumen-ui-rnative';
|
|
127
|
+
|
|
128
|
+
<DotIcon
|
|
129
|
+
appearance='success'
|
|
130
|
+
icon={ArrowDown}
|
|
131
|
+
size={mediaImageDotIconSizeMap[48]}
|
|
132
|
+
>
|
|
133
|
+
<MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
|
|
134
|
+
</DotIcon>;
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Disabled State
|
|
138
|
+
|
|
139
|
+
Only set `disabled` on `DotIcon`. The state is propagated to the child via context. Passing it to both stacks the opacity overlay.
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
<DotIcon appearance='success' icon={ArrowDown} disabled>
|
|
143
|
+
<MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
|
|
144
|
+
</DotIcon>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
</Tab>
|
|
148
|
+
</CustomTabs>
|
|
@@ -113,6 +113,41 @@ export const AppearanceShowcase: Story = {
|
|
|
113
113
|
),
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
+
export const DisabledShowcase: Story = {
|
|
117
|
+
args: { appearance: 'success', icon: ArrowDown },
|
|
118
|
+
render: () => (
|
|
119
|
+
<Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's32' }}>
|
|
120
|
+
<DotIcon
|
|
121
|
+
appearance='success'
|
|
122
|
+
icon={ArrowDown}
|
|
123
|
+
size={mediaImageDotIconSizeMap[48]}
|
|
124
|
+
pin='bottom-end'
|
|
125
|
+
disabled
|
|
126
|
+
>
|
|
127
|
+
<MediaImage src={parentSrc} size={48} shape='circle' />
|
|
128
|
+
</DotIcon>
|
|
129
|
+
<DotIcon
|
|
130
|
+
appearance='muted'
|
|
131
|
+
icon={ArrowUp}
|
|
132
|
+
size={mediaImageDotIconSizeMap[48]}
|
|
133
|
+
pin='bottom-end'
|
|
134
|
+
disabled
|
|
135
|
+
>
|
|
136
|
+
<MediaImage src={parentSrc} size={48} shape='circle' />
|
|
137
|
+
</DotIcon>
|
|
138
|
+
<DotIcon
|
|
139
|
+
appearance='error'
|
|
140
|
+
icon={Close}
|
|
141
|
+
size={mediaImageDotIconSizeMap[48]}
|
|
142
|
+
pin='bottom-end'
|
|
143
|
+
disabled
|
|
144
|
+
>
|
|
145
|
+
<MediaImage src={parentSrc} size={48} shape='circle' />
|
|
146
|
+
</DotIcon>
|
|
147
|
+
</Box>
|
|
148
|
+
),
|
|
149
|
+
};
|
|
150
|
+
|
|
116
151
|
export const SizeShowcase: Story = {
|
|
117
152
|
args: { appearance: 'muted', icon: Link },
|
|
118
153
|
render: () => (
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
DisabledProvider,
|
|
3
|
+
useDisabledContext,
|
|
4
|
+
} from '@ledgerhq/lumen-utils-shared';
|
|
2
5
|
import { useStyleSheet } from '../../../styles';
|
|
3
6
|
import type { IconSize } from '../Icon';
|
|
4
7
|
import { Box } from '../Utility';
|
|
@@ -63,11 +66,13 @@ const useStyles = ({
|
|
|
63
66
|
shape,
|
|
64
67
|
pin,
|
|
65
68
|
appearance,
|
|
69
|
+
disabled,
|
|
66
70
|
}: {
|
|
67
71
|
size: DotIconSize;
|
|
68
72
|
shape: 'square' | 'circle';
|
|
69
73
|
pin: DotIconPin;
|
|
70
74
|
appearance: DotIconAppearance;
|
|
75
|
+
disabled: boolean;
|
|
71
76
|
}) => {
|
|
72
77
|
return useStyleSheet(
|
|
73
78
|
(t) => {
|
|
@@ -77,6 +82,10 @@ const useStyles = ({
|
|
|
77
82
|
const pinOffset = getPinOffset(pin);
|
|
78
83
|
|
|
79
84
|
return {
|
|
85
|
+
root: {
|
|
86
|
+
position: 'relative',
|
|
87
|
+
...(disabled && { opacity: 0.3 }),
|
|
88
|
+
},
|
|
80
89
|
dot: {
|
|
81
90
|
position: 'absolute',
|
|
82
91
|
zIndex: 10,
|
|
@@ -96,7 +105,7 @@ const useStyles = ({
|
|
|
96
105
|
},
|
|
97
106
|
};
|
|
98
107
|
},
|
|
99
|
-
[size, shape, pin, appearance],
|
|
108
|
+
[size, shape, pin, appearance, disabled],
|
|
100
109
|
);
|
|
101
110
|
};
|
|
102
111
|
|
|
@@ -119,27 +128,35 @@ export const DotIcon = ({
|
|
|
119
128
|
pin = 'bottom-end',
|
|
120
129
|
size = 20,
|
|
121
130
|
shape = 'circle',
|
|
131
|
+
disabled: disabledProp = false,
|
|
122
132
|
lx = {},
|
|
123
133
|
style,
|
|
124
134
|
ref,
|
|
125
135
|
...rest
|
|
126
136
|
}: DotIconProps) => {
|
|
127
|
-
const
|
|
137
|
+
const disabled = useDisabledContext({
|
|
138
|
+
consumerName: 'DotIcon',
|
|
139
|
+
mergeWith: { disabled: disabledProp },
|
|
140
|
+
});
|
|
141
|
+
const styles = useStyles({ size, shape, pin, appearance, disabled });
|
|
128
142
|
|
|
129
143
|
return (
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
<Box
|
|
139
|
-
|
|
144
|
+
<DisabledProvider value={{ disabled: false }}>
|
|
145
|
+
<Box
|
|
146
|
+
ref={ref}
|
|
147
|
+
lx={lx}
|
|
148
|
+
style={[styles.root, style]}
|
|
149
|
+
accessibilityState={{ disabled }}
|
|
150
|
+
{...rest}
|
|
151
|
+
>
|
|
152
|
+
<Box style={{ alignSelf: 'flex-start', position: 'relative' }}>
|
|
153
|
+
{children}
|
|
154
|
+
<Box testID='dot-icon-dot' style={styles.dot}>
|
|
155
|
+
<Icon size={dotIconSizeMap[size]} style={styles.icon} />
|
|
156
|
+
</Box>
|
|
140
157
|
</Box>
|
|
141
158
|
</Box>
|
|
142
|
-
</
|
|
159
|
+
</DisabledProvider>
|
|
143
160
|
);
|
|
144
161
|
};
|
|
145
162
|
|
|
@@ -37,6 +37,12 @@ export type DotIconProps = {
|
|
|
37
37
|
* @default 'circle'
|
|
38
38
|
*/
|
|
39
39
|
shape?: 'square' | 'circle';
|
|
40
|
+
/**
|
|
41
|
+
* Shows a disabled appearance.
|
|
42
|
+
* @optional
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
disabled?: boolean;
|
|
40
46
|
/**
|
|
41
47
|
* The wrapped component (e.g. MediaImage or Spot).
|
|
42
48
|
*/
|
|
@@ -4,14 +4,17 @@ import { CustomTabs, Tab } from '../../../../.storybook/components';
|
|
|
4
4
|
|
|
5
5
|
<Meta title='Communication/DotSymbol' of={DotSymbolStories} />
|
|
6
6
|
|
|
7
|
+
# DotSymbol
|
|
8
|
+
|
|
7
9
|
<CustomTabs>
|
|
8
10
|
<Tab label="Overview">
|
|
9
|
-
# DotSymbol
|
|
10
11
|
|
|
11
12
|
## Introduction
|
|
12
13
|
|
|
13
14
|
DotSymbol positions a small image indicator at a configurable corner of a child element such as MediaImage or Spot. It is commonly used to show a network badge or secondary icon overlapping a primary symbol.
|
|
14
15
|
|
|
16
|
+
> View in [Figma](https://www.figma.com/design/zSkvGGiqcnhywp2l3HTHxA/1.-Symbol-Library?node-id=8602-380&m=dev).
|
|
17
|
+
|
|
15
18
|
## Anatomy
|
|
16
19
|
|
|
17
20
|
<Canvas of={DotSymbolStories.Base} />
|
|
@@ -46,9 +49,83 @@ The dot size is driven by the parent MediaImage or Spot size via the mapping hel
|
|
|
46
49
|
|
|
47
50
|
<Canvas of={DotSymbolStories.SizeShowcase} />
|
|
48
51
|
|
|
52
|
+
### Disabled
|
|
53
|
+
|
|
54
|
+
Only set `disabled` on `DotSymbol`. The state is propagated to the child via context. Passing it to both stacks the opacity overlay.
|
|
55
|
+
|
|
56
|
+
<Canvas of={DotSymbolStories.DisabledShowcase} />
|
|
57
|
+
|
|
49
58
|
## Accessibility
|
|
50
59
|
|
|
51
60
|
- Always provide a meaningful `alt` prop on the DotSymbol so the indicator image is announced by screen readers.
|
|
52
61
|
- The child element should carry its own accessibility label independently.
|
|
62
|
+
|
|
63
|
+
</Tab>
|
|
64
|
+
<Tab label="Implementation">
|
|
65
|
+
|
|
66
|
+
## Setup
|
|
67
|
+
|
|
68
|
+
Install and set up the library with our [Setup Guide →](?path=/docs/getting-started-setup--docs).
|
|
69
|
+
|
|
70
|
+
### Basic Usage
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { DotSymbol, MediaImage } from '@ledgerhq/lumen-ui-rnative';
|
|
74
|
+
|
|
75
|
+
function MyComponent() {
|
|
76
|
+
return (
|
|
77
|
+
<DotSymbol src='https://example.com/btc.png' alt='Bitcoin network'>
|
|
78
|
+
<MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
|
|
79
|
+
</DotSymbol>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Pin Placement
|
|
85
|
+
|
|
86
|
+
Position the dot at any of the four corners of the child:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<DotSymbol src='https://example.com/btc.png' alt='Bitcoin' pin='top-end'>
|
|
90
|
+
<MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
|
|
91
|
+
</DotSymbol>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Shapes
|
|
95
|
+
|
|
96
|
+
Use `shape='square'` to match a square child element:
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<DotSymbol src='https://example.com/btc.png' alt='Bitcoin' shape='square'>
|
|
100
|
+
<MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} shape='square' />
|
|
101
|
+
</DotSymbol>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Sizing
|
|
105
|
+
|
|
106
|
+
The dot size is driven by the parent's size via the mapping helpers:
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
import { DotSymbol, mediaImageDotSizeMap, MediaImage } from '@ledgerhq/lumen-ui-rnative';
|
|
110
|
+
|
|
111
|
+
<DotSymbol
|
|
112
|
+
src='https://example.com/btc.png'
|
|
113
|
+
alt='Bitcoin'
|
|
114
|
+
size={mediaImageDotSizeMap[48]}
|
|
115
|
+
>
|
|
116
|
+
<MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
|
|
117
|
+
</DotSymbol>;
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Disabled State
|
|
121
|
+
|
|
122
|
+
Only set `disabled` on `DotSymbol`. The state is propagated to the child via context. Passing it to both stacks the opacity overlay.
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
<DotSymbol src='https://example.com/btc.png' alt='Bitcoin' disabled>
|
|
126
|
+
<MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
|
|
127
|
+
</DotSymbol>
|
|
128
|
+
```
|
|
129
|
+
|
|
53
130
|
</Tab>
|
|
54
|
-
</CustomTabs>
|
|
131
|
+
</CustomTabs>
|
|
@@ -92,6 +92,23 @@ export const ShapeShowcase: Story = {
|
|
|
92
92
|
),
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
export const DisabledShowcase: Story = {
|
|
96
|
+
args: { src: dotSrc, alt: 'Disabled showcase' },
|
|
97
|
+
render: () => (
|
|
98
|
+
<Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's32' }}>
|
|
99
|
+
<DotSymbol src={dotSrc} pin='bottom-end' disabled>
|
|
100
|
+
<MediaImage src={parentSrc} size={48} shape='circle' />
|
|
101
|
+
</DotSymbol>
|
|
102
|
+
<DotSymbol src={dotSrc} pin='bottom-end' shape='square' disabled>
|
|
103
|
+
<MediaImage src={parentSrc} size={48} shape='square' />
|
|
104
|
+
</DotSymbol>
|
|
105
|
+
<DotSymbol src={dotSrc} pin='bottom-end' disabled>
|
|
106
|
+
<Spot appearance='icon' icon={CoinAlert} />
|
|
107
|
+
</DotSymbol>
|
|
108
|
+
</Box>
|
|
109
|
+
),
|
|
110
|
+
};
|
|
111
|
+
|
|
95
112
|
export const SizeShowcase: Story = {
|
|
96
113
|
args: { src: dotSrc, alt: 'Size showcase' },
|
|
97
114
|
render: () => (
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DisabledProvider,
|
|
3
|
+
useDisabledContext,
|
|
4
|
+
} from '@ledgerhq/lumen-utils-shared';
|
|
1
5
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import { Image
|
|
6
|
+
import { Image } from 'react-native';
|
|
3
7
|
import { useStyleSheet } from '../../../styles';
|
|
4
8
|
import type { MediaImageSize } from '../MediaImage';
|
|
5
9
|
import type { SpotSize } from '../Spot';
|
|
@@ -65,10 +69,12 @@ const useStyles = ({
|
|
|
65
69
|
size,
|
|
66
70
|
shape,
|
|
67
71
|
pin,
|
|
72
|
+
disabled,
|
|
68
73
|
}: {
|
|
69
74
|
size: DotSymbolSize;
|
|
70
75
|
shape: 'square' | 'circle';
|
|
71
76
|
pin: DotSymbolPin;
|
|
77
|
+
disabled: boolean;
|
|
72
78
|
}) => {
|
|
73
79
|
return useStyleSheet(
|
|
74
80
|
(t) => {
|
|
@@ -78,6 +84,10 @@ const useStyles = ({
|
|
|
78
84
|
const pinOffset = getPinOffset(pin, size);
|
|
79
85
|
|
|
80
86
|
return {
|
|
87
|
+
root: {
|
|
88
|
+
position: 'relative',
|
|
89
|
+
...(disabled && { opacity: 0.3 }),
|
|
90
|
+
},
|
|
81
91
|
dot: {
|
|
82
92
|
position: 'absolute',
|
|
83
93
|
zIndex: 10,
|
|
@@ -96,7 +106,7 @@ const useStyles = ({
|
|
|
96
106
|
},
|
|
97
107
|
};
|
|
98
108
|
},
|
|
99
|
-
[size, shape, pin],
|
|
109
|
+
[size, shape, pin, disabled],
|
|
100
110
|
);
|
|
101
111
|
};
|
|
102
112
|
|
|
@@ -118,42 +128,50 @@ export const DotSymbol = ({
|
|
|
118
128
|
pin = 'bottom-end',
|
|
119
129
|
size = 20,
|
|
120
130
|
shape = 'circle',
|
|
131
|
+
disabled: disabledProp = false,
|
|
121
132
|
lx = {},
|
|
122
133
|
style,
|
|
123
134
|
ref,
|
|
124
135
|
...rest
|
|
125
136
|
}: DotSymbolProps) => {
|
|
126
|
-
const styles = useStyles({ size, shape, pin });
|
|
127
137
|
const [error, setError] = useState(false);
|
|
138
|
+
const disabled = useDisabledContext({
|
|
139
|
+
consumerName: 'DotSymbol',
|
|
140
|
+
mergeWith: { disabled: disabledProp },
|
|
141
|
+
});
|
|
142
|
+
const styles = useStyles({ size, shape, pin, disabled });
|
|
128
143
|
|
|
129
144
|
useEffect(() => {
|
|
130
145
|
setError(false);
|
|
131
146
|
}, [src]);
|
|
132
147
|
|
|
133
148
|
return (
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
<Box style={
|
|
145
|
-
{
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
<DisabledProvider value={{ disabled: false }}>
|
|
150
|
+
<Box
|
|
151
|
+
ref={ref}
|
|
152
|
+
lx={lx}
|
|
153
|
+
style={[styles.root, style]}
|
|
154
|
+
accessibilityRole='image'
|
|
155
|
+
accessibilityLabel={alt}
|
|
156
|
+
accessibilityState={{ disabled }}
|
|
157
|
+
{...rest}
|
|
158
|
+
>
|
|
159
|
+
<Box style={{ alignSelf: 'flex-start', position: 'relative' }}>
|
|
160
|
+
{children}
|
|
161
|
+
<Box style={styles.dot}>
|
|
162
|
+
{!error && (
|
|
163
|
+
<Image
|
|
164
|
+
source={{ uri: src }}
|
|
165
|
+
style={styles.image}
|
|
166
|
+
accessible={false}
|
|
167
|
+
onError={() => setError(true)}
|
|
168
|
+
testID='dot-symbol-img'
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
171
|
+
</Box>
|
|
154
172
|
</Box>
|
|
155
173
|
</Box>
|
|
156
|
-
</
|
|
174
|
+
</DisabledProvider>
|
|
157
175
|
);
|
|
158
176
|
};
|
|
159
177
|
|
|
@@ -33,6 +33,12 @@ export type DotSymbolProps = {
|
|
|
33
33
|
* @default 'circle'
|
|
34
34
|
*/
|
|
35
35
|
shape?: 'square' | 'circle';
|
|
36
|
+
/**
|
|
37
|
+
* Shows a disabled appearance.
|
|
38
|
+
* @optional
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
disabled?: boolean;
|
|
36
42
|
/**
|
|
37
43
|
* The wrapped component (e.g. MediaImage or Spot).
|
|
38
44
|
*/
|
|
@@ -32,13 +32,13 @@ Three appearances are available: `gray` (default), `transparent`, and `no-backgr
|
|
|
32
32
|
|
|
33
33
|
<Canvas of={MediaButtonStories.SizeShowcase} />
|
|
34
34
|
|
|
35
|
-
##
|
|
35
|
+
## Leading Content Shapes
|
|
36
36
|
|
|
37
|
-
The `
|
|
37
|
+
The `leadingContentShape` prop controls the padding scheme based on the leading content's shape:
|
|
38
38
|
|
|
39
39
|
- **`flat`**: Standard padding for interface icons (line icons without background).
|
|
40
40
|
- **`rounded`**: Tighter left padding for circular icons with their own background (e.g., crypto icons).
|
|
41
41
|
|
|
42
|
-
<Canvas of={MediaButtonStories.
|
|
42
|
+
<Canvas of={MediaButtonStories.LeadingContentShapeShowcase} />
|
|
43
43
|
</Tab>
|
|
44
44
|
</CustomTabs>
|