@ledgerhq/lumen-ui-rnative 0.1.10 → 0.1.12
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 +3 -0
- package/dist/module/i18n/locales/en.json +3 -0
- package/dist/module/i18n/locales/es.json +3 -0
- package/dist/module/i18n/locales/fr.json +3 -0
- package/dist/module/i18n/locales/ja.json +3 -0
- package/dist/module/i18n/locales/ko.json +3 -0
- package/dist/module/i18n/locales/pt.json +3 -0
- package/dist/module/i18n/locales/ru.json +3 -0
- package/dist/module/i18n/locales/th.json +3 -0
- package/dist/module/i18n/locales/tr.json +3 -0
- package/dist/module/i18n/locales/zh.json +3 -0
- package/dist/module/lib/Animations/Pulse/Pulse.js +1 -1
- package/dist/module/lib/Animations/Spin/Spin.js +1 -1
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.js +21 -21
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.js.map +1 -1
- package/dist/module/lib/Components/AmountInput/AmountInput.js +19 -13
- package/dist/module/lib/Components/AmountInput/AmountInput.js.map +1 -1
- package/dist/module/lib/Components/BaseInput/BaseInput.js +16 -9
- package/dist/module/lib/Components/BaseInput/BaseInput.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js.map +1 -1
- package/dist/module/lib/Components/Button/BaseButton.js +8 -1
- package/dist/module/lib/Components/Button/BaseButton.js.map +1 -1
- package/dist/module/lib/Components/Card/Card.js +20 -14
- package/dist/module/lib/Components/Card/Card.js.map +1 -1
- package/dist/module/lib/Components/CardButton/CardButton.js +8 -1
- package/dist/module/lib/Components/CardButton/CardButton.js.map +1 -1
- package/dist/module/lib/Components/Checkbox/Checkbox.js +8 -1
- package/dist/module/lib/Components/Checkbox/Checkbox.js.map +1 -1
- package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.js +32 -5
- package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.js.map +1 -1
- package/dist/module/lib/Components/Label/Label.js +9 -2
- package/dist/module/lib/Components/Label/Label.js.map +1 -1
- package/dist/module/lib/Components/Link/Link.mdx +1 -0
- package/dist/module/lib/Components/ListItem/ListItem.js +14 -19
- package/dist/module/lib/Components/ListItem/ListItem.js.map +1 -1
- package/dist/module/lib/Components/MediaCard/MediaCard.js +183 -0
- package/dist/module/lib/Components/MediaCard/MediaCard.js.map +1 -0
- package/dist/module/lib/Components/MediaCard/MediaCard.mdx +111 -0
- package/dist/module/lib/Components/MediaCard/MediaCard.stories.js +199 -0
- package/dist/module/lib/Components/MediaCard/MediaCard.stories.js.map +1 -0
- package/dist/module/lib/Components/MediaCard/MediaCard.test.js +140 -0
- package/dist/module/lib/Components/MediaCard/MediaCard.test.js.map +1 -0
- package/dist/module/lib/Components/MediaCard/index.js +5 -0
- package/dist/module/lib/Components/MediaCard/index.js.map +1 -0
- package/dist/module/lib/Components/MediaCard/types.js +4 -0
- package/dist/module/lib/Components/MediaCard/types.js.map +1 -0
- package/dist/module/lib/Components/PageIndicator/PageIndicator.js +2 -2
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.js +8 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/module/lib/Components/SegmentedControl/usePillLayout.js +1 -1
- package/dist/module/lib/Components/Select/Select.js +8 -1
- package/dist/module/lib/Components/Select/Select.js.map +1 -1
- package/dist/module/lib/Components/Spot/Spot.js +4 -4
- package/dist/module/lib/Components/Spot/Spot.js.map +1 -1
- package/dist/module/lib/Components/Stepper/Stepper.js +10 -4
- package/dist/module/lib/Components/Stepper/Stepper.js.map +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.js +1 -34
- package/dist/module/lib/Components/Subheader/Subheader.js.map +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.mdx +26 -61
- package/dist/module/lib/Components/Subheader/Subheader.stories.js +23 -12
- package/dist/module/lib/Components/Subheader/Subheader.stories.js.map +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.test.js +2 -26
- package/dist/module/lib/Components/Subheader/Subheader.test.js.map +1 -1
- package/dist/module/lib/Components/Subheader/index.js +1 -1
- package/dist/module/lib/Components/Subheader/index.js.map +1 -1
- package/dist/module/lib/Components/Switch/BaseSwitch.js +1 -1
- package/dist/module/lib/Components/Switch/Switch.js +8 -1
- package/dist/module/lib/Components/Switch/Switch.js.map +1 -1
- package/dist/module/lib/Components/TabBar/TabBar.js +8 -7
- package/dist/module/lib/Components/TabBar/TabBar.js.map +1 -1
- package/dist/module/lib/Components/Tag/Tag.js +9 -2
- package/dist/module/lib/Components/Tag/Tag.js.map +1 -1
- package/dist/module/lib/Components/ThemeProvider/ThemeProvider.test.js +22 -20
- package/dist/module/lib/Components/ThemeProvider/ThemeProvider.test.js.map +1 -1
- package/dist/module/lib/Components/Tile/Tile.js +27 -48
- package/dist/module/lib/Components/Tile/Tile.js.map +1 -1
- package/dist/module/lib/Components/Tile/Tile.mdx +34 -26
- package/dist/module/lib/Components/Tile/Tile.stories.js +31 -28
- package/dist/module/lib/Components/Tile/Tile.stories.js.map +1 -1
- package/dist/module/lib/Components/Tile/Tile.test.js +33 -188
- package/dist/module/lib/Components/Tile/Tile.test.js.map +1 -1
- package/dist/module/lib/Components/Tile/index.js +1 -1
- package/dist/module/lib/Components/Tile/index.js.map +1 -1
- package/dist/module/lib/Components/TileButton/TileButton.js +8 -2
- package/dist/module/lib/Components/TileButton/TileButton.js.map +1 -1
- package/dist/module/lib/Components/TriggerButton/TriggerButton.js +197 -0
- package/dist/module/lib/Components/TriggerButton/TriggerButton.js.map +1 -0
- package/dist/module/lib/Components/TriggerButton/TriggerButton.mdx +44 -0
- package/dist/module/lib/Components/TriggerButton/TriggerButton.stories.js +170 -0
- package/dist/module/lib/Components/TriggerButton/TriggerButton.stories.js.map +1 -0
- package/dist/module/lib/Components/TriggerButton/TriggerButton.test.js +146 -0
- package/dist/module/lib/Components/TriggerButton/TriggerButton.test.js.map +1 -0
- package/dist/module/lib/Components/TriggerButton/index.js +5 -0
- package/dist/module/lib/Components/TriggerButton/index.js.map +1 -0
- package/dist/module/lib/Components/TriggerButton/types.js +4 -0
- package/dist/module/lib/Components/TriggerButton/types.js.map +1 -0
- package/dist/module/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.stories.js.map +1 -1
- package/dist/module/lib/Components/index.js +2 -0
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/module/lib/Symbols/Icons/NanoGen5.js +49 -0
- package/dist/module/lib/Symbols/Icons/NanoGen5.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/Components/AmountInput/AmountInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BaseInput/BaseInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Button/BaseButton.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Button/BaseButton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Card/Card.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Card/types.d.ts +1 -3
- package/dist/typescript/src/lib/Components/Card/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/CardButton/CardButton.d.ts +1 -1
- package/dist/typescript/src/lib/Components/CardButton/CardButton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts +1 -1
- package/dist/typescript/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/InteractiveIcon/types.d.ts +14 -1
- package/dist/typescript/src/lib/Components/InteractiveIcon/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Label/Label.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Label/Label.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts +1 -1
- package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaCard/MediaCard.d.ts +32 -0
- package/dist/typescript/src/lib/Components/MediaCard/MediaCard.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/MediaCard/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/MediaCard/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/MediaCard/types.d.ts +38 -0
- package/dist/typescript/src/lib/Components/MediaCard/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControlContext.d.ts +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Select/Select.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Select/Select.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Stepper/Stepper.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Stepper/Stepper.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Subheader/Subheader.d.ts +2 -7
- package/dist/typescript/src/lib/Components/Subheader/Subheader.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Subheader/index.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Subheader/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Subheader/types.d.ts +1 -11
- package/dist/typescript/src/lib/Components/Subheader/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Switch/Switch.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Switch/Switch.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/TabBar/TabBar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tag/Tag.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Tag/Tag.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tile/Tile.d.ts +17 -23
- package/dist/typescript/src/lib/Components/Tile/Tile.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tile/index.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Tile/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tile/types.d.ts +0 -9
- package/dist/typescript/src/lib/Components/Tile/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/TileButton/TileButton.d.ts +1 -1
- package/dist/typescript/src/lib/Components/TileButton/TileButton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/TriggerButton/TriggerButton.d.ts +26 -0
- package/dist/typescript/src/lib/Components/TriggerButton/TriggerButton.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/TriggerButton/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/TriggerButton/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/TriggerButton/types.d.ts +38 -0
- package/dist/typescript/src/lib/Components/TriggerButton/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/index.d.ts +2 -0
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Symbols/Icons/NanoGen5.d.ts +35 -0
- package/dist/typescript/src/lib/Symbols/Icons/NanoGen5.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 +4 -4
- package/src/i18n/locales/de.json +3 -0
- package/src/i18n/locales/en.json +3 -0
- package/src/i18n/locales/es.json +3 -0
- package/src/i18n/locales/fr.json +3 -0
- package/src/i18n/locales/ja.json +3 -0
- package/src/i18n/locales/ko.json +3 -0
- package/src/i18n/locales/pt.json +3 -0
- package/src/i18n/locales/ru.json +3 -0
- package/src/i18n/locales/th.json +3 -0
- package/src/i18n/locales/tr.json +3 -0
- package/src/i18n/locales/zh.json +3 -0
- package/src/lib/Components/AmountDisplay/AmountDisplay.tsx +20 -20
- package/src/lib/Components/AmountInput/AmountInput.tsx +15 -7
- package/src/lib/Components/BaseInput/BaseInput.tsx +12 -7
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +9 -9
- package/src/lib/Components/Button/BaseButton.tsx +6 -1
- package/src/lib/Components/Card/Card.tsx +16 -16
- package/src/lib/Components/Card/types.ts +1 -4
- package/src/lib/Components/CardButton/CardButton.tsx +7 -1
- package/src/lib/Components/Checkbox/Checkbox.tsx +7 -1
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.tsx +34 -7
- package/src/lib/Components/InteractiveIcon/types.ts +14 -1
- package/src/lib/Components/Label/Label.tsx +7 -2
- package/src/lib/Components/Link/Link.mdx +1 -0
- package/src/lib/Components/ListItem/ListItem.tsx +15 -12
- package/src/lib/Components/MediaCard/MediaCard.mdx +111 -0
- package/src/lib/Components/MediaCard/MediaCard.stories.tsx +190 -0
- package/src/lib/Components/MediaCard/MediaCard.test.tsx +125 -0
- package/src/lib/Components/MediaCard/MediaCard.tsx +203 -0
- package/src/lib/Components/MediaCard/index.ts +2 -0
- package/src/lib/Components/MediaCard/types.ts +39 -0
- package/src/lib/Components/SegmentedControl/SegmentedControl.tsx +6 -1
- package/src/lib/Components/SegmentedControl/SegmentedControlContext.tsx +1 -1
- package/src/lib/Components/Select/Select.tsx +6 -1
- package/src/lib/Components/Spot/Spot.tsx +4 -4
- package/src/lib/Components/Stepper/Stepper.tsx +9 -2
- package/src/lib/Components/Subheader/Subheader.mdx +26 -61
- package/src/lib/Components/Subheader/Subheader.stories.tsx +16 -10
- package/src/lib/Components/Subheader/Subheader.test.tsx +0 -22
- package/src/lib/Components/Subheader/Subheader.tsx +1 -42
- package/src/lib/Components/Subheader/index.ts +0 -1
- package/src/lib/Components/Subheader/types.ts +1 -16
- package/src/lib/Components/Switch/Switch.tsx +6 -1
- package/src/lib/Components/TabBar/TabBar.tsx +5 -2
- package/src/lib/Components/Tag/Tag.tsx +7 -2
- package/src/lib/Components/ThemeProvider/ThemeProvider.test.tsx +16 -18
- package/src/lib/Components/Tile/Tile.mdx +34 -26
- package/src/lib/Components/Tile/Tile.stories.tsx +26 -26
- package/src/lib/Components/Tile/Tile.test.tsx +17 -137
- package/src/lib/Components/Tile/Tile.tsx +28 -40
- package/src/lib/Components/Tile/index.ts +0 -1
- package/src/lib/Components/Tile/types.ts +0 -11
- package/src/lib/Components/TileButton/TileButton.tsx +9 -2
- package/src/lib/Components/TriggerButton/TriggerButton.mdx +44 -0
- package/src/lib/Components/TriggerButton/TriggerButton.stories.tsx +132 -0
- package/src/lib/Components/TriggerButton/TriggerButton.test.tsx +157 -0
- package/src/lib/Components/TriggerButton/TriggerButton.tsx +228 -0
- package/src/lib/Components/TriggerButton/index.ts +2 -0
- package/src/lib/Components/TriggerButton/types.ts +38 -0
- package/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.stories.tsx +1 -1
- package/src/lib/Components/index.ts +2 -0
- package/src/lib/Symbols/Icons/NanoGen5.tsx +44 -0
- package/src/lib/Symbols/index.ts +1 -0
|
@@ -26,11 +26,11 @@ Tile components are compact, card-like interactive elements designed for horizon
|
|
|
26
26
|
|
|
27
27
|
## Anatomy
|
|
28
28
|
|
|
29
|
-
- **
|
|
30
|
-
- **TileContent**: Container for title, description
|
|
29
|
+
- **Tile**: Root container; direct children are laid out vertically (e.g. Spot, TileContent)
|
|
30
|
+
- **TileContent**: Container for title, description and trailing content
|
|
31
31
|
- **TileTitle**: The main label of the item (required)
|
|
32
32
|
- **TileDescription (optional)**: Provides additional context
|
|
33
|
-
- **TileTrailingContent (optional)**: Container for
|
|
33
|
+
- **TileTrailingContent (optional)**: Container for Tags, labels, or other supplementary content
|
|
34
34
|
|
|
35
35
|
## Properties
|
|
36
36
|
|
|
@@ -94,10 +94,10 @@ Install and set up the library with our [Setup Guide →](?path=/docs/getting-st
|
|
|
94
94
|
```tsx
|
|
95
95
|
import {
|
|
96
96
|
Tile,
|
|
97
|
-
TileSpot,
|
|
98
97
|
TileContent,
|
|
99
98
|
TileTitle,
|
|
100
99
|
TileDescription,
|
|
100
|
+
Spot,
|
|
101
101
|
} from '@ledgerhq/lumen-ui-rnative';
|
|
102
102
|
import { Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
103
103
|
|
|
@@ -108,7 +108,7 @@ function MyComponent() {
|
|
|
108
108
|
onPress={() => console.log('Primary action')}
|
|
109
109
|
onLongPress={() => console.log('Secondary action')}
|
|
110
110
|
>
|
|
111
|
-
<
|
|
111
|
+
<Spot appearance='icon' icon={Settings} />
|
|
112
112
|
<TileContent>
|
|
113
113
|
<TileTitle>Settings</TileTitle>
|
|
114
114
|
<TileDescription>Manage preferences</TileDescription>
|
|
@@ -122,20 +122,22 @@ function MyComponent() {
|
|
|
122
122
|
|
|
123
123
|
### With Trailing Content (Tags, etc.)
|
|
124
124
|
|
|
125
|
+
Use TileTrailingContent inside TileContent to wrap Tags or other supplementary content.
|
|
126
|
+
|
|
125
127
|
```tsx
|
|
126
128
|
import {
|
|
127
129
|
Tile,
|
|
128
|
-
TileSpot,
|
|
129
130
|
TileContent,
|
|
130
131
|
TileTitle,
|
|
131
132
|
TileDescription,
|
|
132
133
|
TileTrailingContent,
|
|
133
134
|
Tag,
|
|
135
|
+
Spot,
|
|
134
136
|
} from '@ledgerhq/lumen-ui-rnative';
|
|
135
137
|
import { Bitcoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
136
138
|
|
|
137
139
|
<Tile appearance='card'>
|
|
138
|
-
<
|
|
140
|
+
<Spot appearance='icon' icon={Bitcoin} />
|
|
139
141
|
<TileContent>
|
|
140
142
|
<TileTitle>Bitcoin</TileTitle>
|
|
141
143
|
<TileDescription>BTC</TileDescription>
|
|
@@ -150,7 +152,7 @@ import { Bitcoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
|
150
152
|
|
|
151
153
|
```tsx
|
|
152
154
|
<Tile disabled>
|
|
153
|
-
<
|
|
155
|
+
<Spot appearance='icon' icon={Settings} />
|
|
154
156
|
<TileContent>
|
|
155
157
|
<TileTitle>Settings</TileTitle>
|
|
156
158
|
<TileDescription>Unavailable</TileDescription>
|
|
@@ -163,13 +165,14 @@ import { Bitcoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
|
163
165
|
Use the `centered` prop to vertically center the tile content. This is useful when a tile has less content than its neighbors in a grid, like a "Show more" tile that needs to align with richer tiles.
|
|
164
166
|
|
|
165
167
|
```tsx
|
|
166
|
-
import { ChevronRight } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
168
|
+
import { ChevronRight, CryptoBitcoinCoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
169
|
+
import { Spot, Tile, TileContent, TileTitle, TileDescription, TileTrailingContent, Tag } from '@ledgerhq/lumen-ui-rnative';
|
|
167
170
|
import { View } from 'react-native';
|
|
168
171
|
|
|
169
172
|
// In a grid where other tiles have more content
|
|
170
173
|
<View style={{ flexDirection: 'row', gap: 8 }}>
|
|
171
174
|
<Tile appearance='card'>
|
|
172
|
-
<
|
|
175
|
+
<Spot appearance='icon' icon={CryptoBitcoinCoin} />
|
|
173
176
|
<TileContent>
|
|
174
177
|
<TileTitle>Title</TileTitle>
|
|
175
178
|
<TileDescription>Description</TileDescription>
|
|
@@ -181,7 +184,7 @@ import { View } from 'react-native';
|
|
|
181
184
|
|
|
182
185
|
{/* Show more tile with centered content */}
|
|
183
186
|
<Tile appearance='card' centered>
|
|
184
|
-
<
|
|
187
|
+
<Spot appearance='icon' icon={ChevronRight} />
|
|
185
188
|
<TileContent>
|
|
186
189
|
<TileTitle>Show more</TileTitle>
|
|
187
190
|
</TileContent>
|
|
@@ -194,14 +197,15 @@ import { View } from 'react-native';
|
|
|
194
197
|
```tsx
|
|
195
198
|
import {
|
|
196
199
|
Tile,
|
|
197
|
-
TileSpot,
|
|
198
200
|
TileContent,
|
|
199
201
|
TileTitle,
|
|
200
202
|
TileDescription,
|
|
203
|
+
Spot,
|
|
201
204
|
} from '@ledgerhq/lumen-ui-rnative';
|
|
205
|
+
import { CryptoBitcoinCoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
202
206
|
|
|
203
207
|
<Tile onPress={() => console.log('Clicked!')}>
|
|
204
|
-
<
|
|
208
|
+
<Spot appearance='icon' icon={CryptoBitcoinCoin} />
|
|
205
209
|
<TileContent>
|
|
206
210
|
<TileTitle>Bitcoin</TileTitle>
|
|
207
211
|
<TileDescription>BTC</TileDescription>
|
|
@@ -213,17 +217,21 @@ import {
|
|
|
213
217
|
|
|
214
218
|
```tsx
|
|
215
219
|
import { ScrollView } from 'react-native';
|
|
220
|
+
import { Tile, TileContent, TileTitle, TileDescription, Spot } from '@ledgerhq/lumen-ui-rnative';
|
|
216
221
|
|
|
217
222
|
<ScrollView horizontal>
|
|
218
|
-
{items.map((item) =>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
<
|
|
222
|
-
<
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
{items.map((item) => {
|
|
224
|
+
const Icon = item.icon;
|
|
225
|
+
return (
|
|
226
|
+
<Tile key={item.id} lx={{ width: 's128', flexShrink: 0 }}>
|
|
227
|
+
<Spot appearance='icon' icon={Icon} />
|
|
228
|
+
<TileContent>
|
|
229
|
+
<TileTitle>{item.title}</TileTitle>
|
|
230
|
+
<TileDescription>{item.description}</TileDescription>
|
|
231
|
+
</TileContent>
|
|
232
|
+
</Tile>
|
|
233
|
+
);
|
|
234
|
+
})}
|
|
227
235
|
</ScrollView>;
|
|
228
236
|
```
|
|
229
237
|
|
|
@@ -234,7 +242,7 @@ import { ScrollView } from 'react-native';
|
|
|
234
242
|
onPress={() => console.log('Primary action')}
|
|
235
243
|
onLongPress={() => console.log('Secondary action - show menu')}
|
|
236
244
|
>
|
|
237
|
-
<
|
|
245
|
+
<Spot appearance='icon' icon={Settings} />
|
|
238
246
|
<TileContent>
|
|
239
247
|
<TileTitle>Settings</TileTitle>
|
|
240
248
|
<TileDescription>Long press for options</TileDescription>
|
|
@@ -251,13 +259,13 @@ import { ScrollView } from 'react-native';
|
|
|
251
259
|
<DoVsDontRow>
|
|
252
260
|
<DoBlockItem
|
|
253
261
|
title='Use TileTrailingContent for additional elements'
|
|
254
|
-
description='Wrap Tags, labels, or supplementary content inside TileTrailingContent within TileContent for proper
|
|
262
|
+
description='Wrap Tags, labels, or supplementary content inside TileTrailingContent within TileContent for proper spacing.'
|
|
255
263
|
>
|
|
256
264
|
|
|
257
265
|
```tsx
|
|
258
266
|
{/* prettier-ignore */}
|
|
259
267
|
<Tile>
|
|
260
|
-
<
|
|
268
|
+
<Spot appearance="icon" icon={Settings} />
|
|
261
269
|
<TileContent>
|
|
262
270
|
<TileTitle>Title</TileTitle>
|
|
263
271
|
<TileDescription>Description</TileDescription>
|
|
@@ -277,7 +285,7 @@ import { ScrollView } from 'react-native';
|
|
|
277
285
|
```tsx
|
|
278
286
|
{/* prettier-ignore */}
|
|
279
287
|
<Tile>
|
|
280
|
-
<
|
|
288
|
+
<Spot appearance="icon" icon={Settings} />
|
|
281
289
|
<TileContent>
|
|
282
290
|
<TileTitle>Title</TileTitle>
|
|
283
291
|
<TileDescription>Description</TileDescription>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { Settings, Plus, User, Apps, ChevronRight } from '../../Symbols';
|
|
4
|
+
import { Spot } from '../Spot';
|
|
3
5
|
import { Tag } from '../Tag/Tag';
|
|
4
6
|
import { Box, Text } from '../Utility';
|
|
5
7
|
import {
|
|
6
8
|
Tile,
|
|
7
|
-
TileSpot,
|
|
8
9
|
TileContent,
|
|
9
10
|
TileTitle,
|
|
10
11
|
TileDescription,
|
|
@@ -14,7 +15,6 @@ import {
|
|
|
14
15
|
const meta: Meta<typeof Tile> = {
|
|
15
16
|
component: Tile,
|
|
16
17
|
subcomponents: {
|
|
17
|
-
TileSpot,
|
|
18
18
|
TileContent,
|
|
19
19
|
TileTitle,
|
|
20
20
|
TileDescription,
|
|
@@ -61,7 +61,7 @@ export const Base: Story = {
|
|
|
61
61
|
},
|
|
62
62
|
render: (args) => (
|
|
63
63
|
<Tile {...args} lx={{ maxWidth: 's112' }}>
|
|
64
|
-
<
|
|
64
|
+
<Spot appearance='icon' icon={Settings} />
|
|
65
65
|
<TileContent>
|
|
66
66
|
<TileTitle>Item with Spot and Description</TileTitle>
|
|
67
67
|
<TileDescription>Additional information</TileDescription>
|
|
@@ -73,7 +73,7 @@ export const Base: Story = {
|
|
|
73
73
|
source: {
|
|
74
74
|
code: `
|
|
75
75
|
<Tile lx={{ maxWidth: 's112' }}>
|
|
76
|
-
<
|
|
76
|
+
<Spot appearance="icon" icon={Settings} />
|
|
77
77
|
<TileContent>
|
|
78
78
|
<TileTitle>Item with Spot and Description</TileTitle>
|
|
79
79
|
<TileDescription>Additional information</TileDescription>
|
|
@@ -89,20 +89,20 @@ export const VariantsShowcase: Story = {
|
|
|
89
89
|
render: () => (
|
|
90
90
|
<Box lx={{ flexDirection: 'column', gap: 's16' }}>
|
|
91
91
|
<Tile lx={{ maxWidth: 's176' }}>
|
|
92
|
-
<
|
|
92
|
+
<Spot appearance='icon' icon={User} />
|
|
93
93
|
<TileContent>
|
|
94
94
|
<TileTitle>User</TileTitle>
|
|
95
95
|
<TileDescription>With description</TileDescription>
|
|
96
96
|
</TileContent>
|
|
97
97
|
</Tile>
|
|
98
98
|
<Tile lx={{ maxWidth: 's176' }}>
|
|
99
|
-
<
|
|
99
|
+
<Spot appearance='icon' icon={Plus} />
|
|
100
100
|
<TileContent>
|
|
101
101
|
<TileTitle>Without Description</TileTitle>
|
|
102
102
|
</TileContent>
|
|
103
103
|
</Tile>
|
|
104
104
|
<Tile lx={{ maxWidth: 's176' }}>
|
|
105
|
-
<
|
|
105
|
+
<Spot appearance='icon' icon={Settings} />
|
|
106
106
|
<TileContent>
|
|
107
107
|
<TileTitle>With Trailing Content</TileTitle>
|
|
108
108
|
<TileDescription>Additional information</TileDescription>
|
|
@@ -112,7 +112,7 @@ export const VariantsShowcase: Story = {
|
|
|
112
112
|
</TileContent>
|
|
113
113
|
</Tile>
|
|
114
114
|
<Tile lx={{ maxWidth: 's176' }}>
|
|
115
|
-
<
|
|
115
|
+
<Spot appearance='icon' icon={Settings} />
|
|
116
116
|
<TileContent>
|
|
117
117
|
<TileTitle>With Trailing Content</TileTitle>
|
|
118
118
|
<TileDescription>Additional information</TileDescription>
|
|
@@ -133,7 +133,7 @@ export const WithSecondaryAction: Story = {
|
|
|
133
133
|
onLongPress={() => alert('Long press - secondary action triggered!')}
|
|
134
134
|
lx={{ maxWidth: 's176' }}
|
|
135
135
|
>
|
|
136
|
-
<
|
|
136
|
+
<Spot appearance='icon' icon={Settings} />
|
|
137
137
|
<TileContent>
|
|
138
138
|
<TileTitle>Long Press Me</TileTitle>
|
|
139
139
|
<TileDescription>Try long pressing this tile</TileDescription>
|
|
@@ -148,7 +148,7 @@ export const WithSecondaryAction: Story = {
|
|
|
148
148
|
onLongPress={() => alert('Long press - secondary action triggered!')}
|
|
149
149
|
lx={{ maxWidth: 's160' }}
|
|
150
150
|
>
|
|
151
|
-
<
|
|
151
|
+
<Spot appearance="icon" icon={Settings} />
|
|
152
152
|
<TileContent>
|
|
153
153
|
<TileTitle>Long Press Me</TileTitle>
|
|
154
154
|
<TileDescription>Try long pressing this tile</TileDescription>
|
|
@@ -173,7 +173,7 @@ export const HorizontalList: Story = {
|
|
|
173
173
|
>
|
|
174
174
|
{Array.from({ length: 3 }).map((_, i) => (
|
|
175
175
|
<Tile key={`list-1-${i}`}>
|
|
176
|
-
<
|
|
176
|
+
<Spot appearance='icon' icon={Apps} />
|
|
177
177
|
<TileContent>
|
|
178
178
|
<TileTitle>Item {i + 1}</TileTitle>
|
|
179
179
|
<TileDescription>Description {i + 1}</TileDescription>
|
|
@@ -192,7 +192,7 @@ export const HorizontalList: Story = {
|
|
|
192
192
|
>
|
|
193
193
|
{Array.from({ length: 5 }).map((_, i) => (
|
|
194
194
|
<Tile key={`list-2-${i}`} lx={{ width: 's128', flexShrink: 0 }}>
|
|
195
|
-
<
|
|
195
|
+
<Spot appearance='icon' icon={Apps} />
|
|
196
196
|
<TileContent>
|
|
197
197
|
<TileTitle>Item {i + 1}</TileTitle>
|
|
198
198
|
<TileDescription>
|
|
@@ -211,7 +211,7 @@ export const ResponsiveLayout: Story = {
|
|
|
211
211
|
<Box lx={{ width: 'full', flexDirection: 'column', gap: 's16' }}>
|
|
212
212
|
<Box>
|
|
213
213
|
<Tile>
|
|
214
|
-
<
|
|
214
|
+
<Spot appearance='icon' icon={Apps} />
|
|
215
215
|
<TileContent>
|
|
216
216
|
<TileTitle>Item fill width</TileTitle>
|
|
217
217
|
<TileDescription>Description fill width</TileDescription>
|
|
@@ -220,7 +220,7 @@ export const ResponsiveLayout: Story = {
|
|
|
220
220
|
</Box>
|
|
221
221
|
<Box lx={{ alignItems: 'center', justifyContent: 'center' }}>
|
|
222
222
|
<Tile lx={{ width: 's224' }}>
|
|
223
|
-
<
|
|
223
|
+
<Spot appearance='icon' icon={Plus} />
|
|
224
224
|
<TileContent>
|
|
225
225
|
<TileTitle>Long Item with fixed width</TileTitle>
|
|
226
226
|
<TileDescription>
|
|
@@ -243,14 +243,14 @@ export const AppearanceShowcase: Story = {
|
|
|
243
243
|
</Box>
|
|
244
244
|
<Box lx={{ flexDirection: 'row', gap: 's16' }}>
|
|
245
245
|
<Tile appearance='no-background' lx={{ width: 's112' }}>
|
|
246
|
-
<
|
|
246
|
+
<Spot appearance='icon' icon={Settings} />
|
|
247
247
|
<TileContent>
|
|
248
248
|
<TileTitle>Press me</TileTitle>
|
|
249
249
|
<TileDescription>Press state</TileDescription>
|
|
250
250
|
</TileContent>
|
|
251
251
|
</Tile>
|
|
252
252
|
<Tile appearance='no-background' disabled lx={{ width: 's112' }}>
|
|
253
|
-
<
|
|
253
|
+
<Spot appearance='icon' icon={Settings} disabled />
|
|
254
254
|
<TileContent>
|
|
255
255
|
<TileTitle>Disabled</TileTitle>
|
|
256
256
|
<TileDescription>Disabled state</TileDescription>
|
|
@@ -264,14 +264,14 @@ export const AppearanceShowcase: Story = {
|
|
|
264
264
|
</Box>
|
|
265
265
|
<Box lx={{ flexDirection: 'row', gap: 's16' }}>
|
|
266
266
|
<Tile appearance='card' lx={{ width: 's112' }}>
|
|
267
|
-
<
|
|
267
|
+
<Spot appearance='icon' icon={User} />
|
|
268
268
|
<TileContent>
|
|
269
269
|
<TileTitle>Press me</TileTitle>
|
|
270
270
|
<TileDescription>Press state</TileDescription>
|
|
271
271
|
</TileContent>
|
|
272
272
|
</Tile>
|
|
273
273
|
<Tile appearance='card' disabled lx={{ width: 's112' }}>
|
|
274
|
-
<
|
|
274
|
+
<Spot appearance='icon' icon={User} disabled />
|
|
275
275
|
<TileContent>
|
|
276
276
|
<TileTitle>Disabled</TileTitle>
|
|
277
277
|
<TileDescription>Disabled state</TileDescription>
|
|
@@ -287,7 +287,7 @@ export const CenteredShowcase: Story = {
|
|
|
287
287
|
render: () => (
|
|
288
288
|
<Box lx={{ flexDirection: 'row', gap: 's8' }}>
|
|
289
289
|
<Tile appearance='card' lx={{ width: 's128' }}>
|
|
290
|
-
<
|
|
290
|
+
<Spot appearance='icon' icon={Apps} />
|
|
291
291
|
<TileContent>
|
|
292
292
|
<TileTitle>Title</TileTitle>
|
|
293
293
|
<TileDescription>Description</TileDescription>
|
|
@@ -297,7 +297,7 @@ export const CenteredShowcase: Story = {
|
|
|
297
297
|
</TileContent>
|
|
298
298
|
</Tile>
|
|
299
299
|
<Tile appearance='card' lx={{ width: 's128' }}>
|
|
300
|
-
<
|
|
300
|
+
<Spot appearance='icon' icon={Apps} />
|
|
301
301
|
<TileContent>
|
|
302
302
|
<TileTitle>Title</TileTitle>
|
|
303
303
|
<TileDescription>Description</TileDescription>
|
|
@@ -307,7 +307,7 @@ export const CenteredShowcase: Story = {
|
|
|
307
307
|
</TileContent>
|
|
308
308
|
</Tile>
|
|
309
309
|
<Tile appearance='card' lx={{ width: 's128' }}>
|
|
310
|
-
<
|
|
310
|
+
<Spot appearance='icon' icon={Apps} />
|
|
311
311
|
<TileContent>
|
|
312
312
|
<TileTitle>Title</TileTitle>
|
|
313
313
|
<TileDescription>Description</TileDescription>
|
|
@@ -317,7 +317,7 @@ export const CenteredShowcase: Story = {
|
|
|
317
317
|
</TileContent>
|
|
318
318
|
</Tile>
|
|
319
319
|
<Tile appearance='card' centered lx={{ width: 's128' }}>
|
|
320
|
-
<
|
|
320
|
+
<Spot appearance='icon' icon={ChevronRight} />
|
|
321
321
|
<TileContent>
|
|
322
322
|
<TileTitle>Show more</TileTitle>
|
|
323
323
|
</TileContent>
|
|
@@ -335,14 +335,14 @@ export const SizeShowcase: Story = {
|
|
|
335
335
|
</Box>
|
|
336
336
|
<Box lx={{ flexDirection: 'row', gap: 's16' }}>
|
|
337
337
|
<Tile appearance='card' lx={{ width: 's112' }}>
|
|
338
|
-
<
|
|
338
|
+
<Spot appearance='icon' icon={Settings} size={48} />
|
|
339
339
|
<TileContent>
|
|
340
340
|
<TileTitle>Settings</TileTitle>
|
|
341
341
|
<TileDescription>Size 48</TileDescription>
|
|
342
342
|
</TileContent>
|
|
343
343
|
</Tile>
|
|
344
344
|
<Tile appearance='card' lx={{ width: 's112' }}>
|
|
345
|
-
<
|
|
345
|
+
<Spot appearance='check' size={48} />
|
|
346
346
|
<TileContent>
|
|
347
347
|
<TileTitle>Check</TileTitle>
|
|
348
348
|
<TileDescription>Size 48</TileDescription>
|
|
@@ -356,14 +356,14 @@ export const SizeShowcase: Story = {
|
|
|
356
356
|
</Box>
|
|
357
357
|
<Box lx={{ flexDirection: 'row', gap: 's16' }}>
|
|
358
358
|
<Tile appearance='card' lx={{ width: 's112' }}>
|
|
359
|
-
<
|
|
359
|
+
<Spot appearance='icon' icon={Settings} size={40} />
|
|
360
360
|
<TileContent>
|
|
361
361
|
<TileTitle>Settings</TileTitle>
|
|
362
362
|
<TileDescription>Size 40</TileDescription>
|
|
363
363
|
</TileContent>
|
|
364
364
|
</Tile>
|
|
365
365
|
<Tile appearance='card' lx={{ width: 's112' }}>
|
|
366
|
-
<
|
|
366
|
+
<Spot appearance='check' size={40} />
|
|
367
367
|
<TileContent>
|
|
368
368
|
<TileTitle>Check</TileTitle>
|
|
369
369
|
<TileDescription>Size 40</TileDescription>
|
|
@@ -8,7 +8,6 @@ import { Tag } from '../Tag';
|
|
|
8
8
|
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
9
9
|
import {
|
|
10
10
|
Tile,
|
|
11
|
-
TileSpot,
|
|
12
11
|
TileContent,
|
|
13
12
|
TileTitle,
|
|
14
13
|
TileDescription,
|
|
@@ -27,7 +26,7 @@ describe('Tile Component', () => {
|
|
|
27
26
|
const { getByText, getByTestId } = render(
|
|
28
27
|
<TestWrapper>
|
|
29
28
|
<Tile testID='tile'>
|
|
30
|
-
<
|
|
29
|
+
<Settings size={24} />
|
|
31
30
|
<TileContent>
|
|
32
31
|
<TileTitle>Test Title</TileTitle>
|
|
33
32
|
</TileContent>
|
|
@@ -44,11 +43,13 @@ describe('Tile Component', () => {
|
|
|
44
43
|
const { getByText } = render(
|
|
45
44
|
<TestWrapper>
|
|
46
45
|
<Tile testID='tile'>
|
|
47
|
-
<
|
|
46
|
+
<Settings size={24} />
|
|
48
47
|
<TileContent>
|
|
49
48
|
<TileTitle>Test Title</TileTitle>
|
|
49
|
+
<TileTrailingContent>
|
|
50
|
+
<Tag label={tagText} />
|
|
51
|
+
</TileTrailingContent>
|
|
50
52
|
</TileContent>
|
|
51
|
-
<Tag label={tagText} />
|
|
52
53
|
</Tile>
|
|
53
54
|
</TestWrapper>,
|
|
54
55
|
);
|
|
@@ -64,7 +65,7 @@ describe('Tile Component', () => {
|
|
|
64
65
|
const { getByTestId } = render(
|
|
65
66
|
<TestWrapper>
|
|
66
67
|
<Tile onPress={handlePress} testID='tile'>
|
|
67
|
-
<
|
|
68
|
+
<Settings size={24} />
|
|
68
69
|
<TileContent>
|
|
69
70
|
<TileTitle>Test Title</TileTitle>
|
|
70
71
|
</TileContent>
|
|
@@ -82,7 +83,7 @@ describe('Tile Component', () => {
|
|
|
82
83
|
const { getByTestId } = render(
|
|
83
84
|
<TestWrapper>
|
|
84
85
|
<Tile onLongPress={handleLongPress} testID='tile'>
|
|
85
|
-
<
|
|
86
|
+
<Settings size={24} />
|
|
86
87
|
<TileContent>
|
|
87
88
|
<TileTitle>Test Title</TileTitle>
|
|
88
89
|
</TileContent>
|
|
@@ -105,7 +106,7 @@ describe('Tile Component', () => {
|
|
|
105
106
|
onLongPress={handleLongPress}
|
|
106
107
|
testID='tile'
|
|
107
108
|
>
|
|
108
|
-
<
|
|
109
|
+
<Settings size={24} />
|
|
109
110
|
<TileContent>
|
|
110
111
|
<TileTitle>Test Title</TileTitle>
|
|
111
112
|
</TileContent>
|
|
@@ -124,11 +125,11 @@ describe('Tile Component', () => {
|
|
|
124
125
|
});
|
|
125
126
|
|
|
126
127
|
describe('Context Propagation', () => {
|
|
127
|
-
it('should propagate disabled state to
|
|
128
|
+
it('should propagate disabled state to pressable', () => {
|
|
128
129
|
const { getByTestId } = render(
|
|
129
130
|
<TestWrapper>
|
|
130
131
|
<Tile disabled testID='tile'>
|
|
131
|
-
<
|
|
132
|
+
<Settings size={24} />
|
|
132
133
|
<TileContent>
|
|
133
134
|
<TileTitle>Test Title</TileTitle>
|
|
134
135
|
</TileContent>
|
|
@@ -144,7 +145,7 @@ describe('Tile Component', () => {
|
|
|
144
145
|
const { getByText } = render(
|
|
145
146
|
<TestWrapper>
|
|
146
147
|
<Tile disabled testID='tile'>
|
|
147
|
-
<
|
|
148
|
+
<Settings size={24} />
|
|
148
149
|
<TileContent>
|
|
149
150
|
<TileTitle>Test Title</TileTitle>
|
|
150
151
|
<TileDescription>Test Description</TileDescription>
|
|
@@ -164,7 +165,7 @@ describe('Tile Component', () => {
|
|
|
164
165
|
const { getByTestId } = render(
|
|
165
166
|
<TestWrapper>
|
|
166
167
|
<Tile testID='tile' accessibilityLabel={customLabel}>
|
|
167
|
-
<
|
|
168
|
+
<Settings size={24} />
|
|
168
169
|
<TileContent>
|
|
169
170
|
<TileTitle>Test Title</TileTitle>
|
|
170
171
|
</TileContent>
|
|
@@ -180,7 +181,7 @@ describe('Tile Component', () => {
|
|
|
180
181
|
const { getByTestId } = render(
|
|
181
182
|
<TestWrapper>
|
|
182
183
|
<Tile testID='tile'>
|
|
183
|
-
<
|
|
184
|
+
<Settings size={24} />
|
|
184
185
|
<TileContent>
|
|
185
186
|
<TileTitle>Test Title</TileTitle>
|
|
186
187
|
</TileContent>
|
|
@@ -206,12 +207,14 @@ describe('Tile Component', () => {
|
|
|
206
207
|
onLongPress={jest.fn()}
|
|
207
208
|
testID='tile'
|
|
208
209
|
>
|
|
209
|
-
<
|
|
210
|
+
<Settings size={24} />
|
|
210
211
|
<TileContent>
|
|
211
212
|
<TileTitle>Test Title</TileTitle>
|
|
212
213
|
<TileDescription>{description}</TileDescription>
|
|
214
|
+
<TileTrailingContent>
|
|
215
|
+
<Tag label={tagText} />
|
|
216
|
+
</TileTrailingContent>
|
|
213
217
|
</TileContent>
|
|
214
|
-
<Tag label={tagText} />
|
|
215
218
|
</Tile>
|
|
216
219
|
</TestWrapper>,
|
|
217
220
|
);
|
|
@@ -222,127 +225,4 @@ describe('Tile Component', () => {
|
|
|
222
225
|
expect(getByText(tagText)).toBeTruthy();
|
|
223
226
|
});
|
|
224
227
|
});
|
|
225
|
-
|
|
226
|
-
describe('TileTrailingContent', () => {
|
|
227
|
-
it('should render children correctly', () => {
|
|
228
|
-
const { getByText } = render(
|
|
229
|
-
<TestWrapper>
|
|
230
|
-
<Tile testID='tile'>
|
|
231
|
-
<TileSpot appearance='icon' icon={Settings} />
|
|
232
|
-
<TileContent>
|
|
233
|
-
<TileTitle>Test Title</TileTitle>
|
|
234
|
-
<TileTrailingContent>
|
|
235
|
-
<Tag label='Active' />
|
|
236
|
-
</TileTrailingContent>
|
|
237
|
-
</TileContent>
|
|
238
|
-
</Tile>
|
|
239
|
-
</TestWrapper>,
|
|
240
|
-
);
|
|
241
|
-
|
|
242
|
-
expect(getByText('Active')).toBeTruthy();
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
it('should render with testID', () => {
|
|
246
|
-
const { getByTestId } = render(
|
|
247
|
-
<TestWrapper>
|
|
248
|
-
<Tile testID='tile'>
|
|
249
|
-
<TileSpot appearance='icon' icon={Settings} />
|
|
250
|
-
<TileContent>
|
|
251
|
-
<TileTitle>Test Title</TileTitle>
|
|
252
|
-
<TileTrailingContent>
|
|
253
|
-
<Tag label='Active' />
|
|
254
|
-
</TileTrailingContent>
|
|
255
|
-
</TileContent>
|
|
256
|
-
</Tile>
|
|
257
|
-
</TestWrapper>,
|
|
258
|
-
);
|
|
259
|
-
|
|
260
|
-
expect(getByTestId('tile-trailing-content')).toBeTruthy();
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
it('should have correct styling (4px margin-top and 8px gap)', () => {
|
|
264
|
-
const { getByTestId } = render(
|
|
265
|
-
<TestWrapper>
|
|
266
|
-
<Tile testID='tile'>
|
|
267
|
-
<TileSpot appearance='icon' icon={Settings} />
|
|
268
|
-
<TileContent>
|
|
269
|
-
<TileTitle>Test Title</TileTitle>
|
|
270
|
-
<TileTrailingContent>
|
|
271
|
-
<Tag label='First' />
|
|
272
|
-
<Tag label='Second' />
|
|
273
|
-
</TileTrailingContent>
|
|
274
|
-
</TileContent>
|
|
275
|
-
</Tile>
|
|
276
|
-
</TestWrapper>,
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
const trailingContent = getByTestId('tile-trailing-content');
|
|
280
|
-
expect(trailingContent.props.style).toMatchObject({
|
|
281
|
-
marginTop: 4,
|
|
282
|
-
gap: 8,
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
it('should render multiple children', () => {
|
|
287
|
-
const { getByText } = render(
|
|
288
|
-
<TestWrapper>
|
|
289
|
-
<Tile testID='tile'>
|
|
290
|
-
<TileSpot appearance='icon' icon={Settings} />
|
|
291
|
-
<TileContent>
|
|
292
|
-
<TileTitle>Test Title</TileTitle>
|
|
293
|
-
<TileTrailingContent>
|
|
294
|
-
<Tag label='First' />
|
|
295
|
-
<Tag label='Second' />
|
|
296
|
-
</TileTrailingContent>
|
|
297
|
-
</TileContent>
|
|
298
|
-
</Tile>
|
|
299
|
-
</TestWrapper>,
|
|
300
|
-
);
|
|
301
|
-
|
|
302
|
-
expect(getByText('First')).toBeTruthy();
|
|
303
|
-
expect(getByText('Second')).toBeTruthy();
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
it('should have full width', () => {
|
|
307
|
-
const { getByTestId } = render(
|
|
308
|
-
<TestWrapper>
|
|
309
|
-
<Tile testID='tile'>
|
|
310
|
-
<TileSpot appearance='icon' icon={Settings} />
|
|
311
|
-
<TileContent>
|
|
312
|
-
<TileTitle>Test Title</TileTitle>
|
|
313
|
-
<TileTrailingContent>
|
|
314
|
-
<Tag label='Active' />
|
|
315
|
-
</TileTrailingContent>
|
|
316
|
-
</TileContent>
|
|
317
|
-
</Tile>
|
|
318
|
-
</TestWrapper>,
|
|
319
|
-
);
|
|
320
|
-
|
|
321
|
-
const trailingContent = getByTestId('tile-trailing-content');
|
|
322
|
-
expect(trailingContent.props.style).toMatchObject({
|
|
323
|
-
width: '100%',
|
|
324
|
-
});
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
it('should center items horizontally', () => {
|
|
328
|
-
const { getByTestId } = render(
|
|
329
|
-
<TestWrapper>
|
|
330
|
-
<Tile testID='tile'>
|
|
331
|
-
<TileSpot appearance='icon' icon={Settings} />
|
|
332
|
-
<TileContent>
|
|
333
|
-
<TileTitle>Test Title</TileTitle>
|
|
334
|
-
<TileTrailingContent>
|
|
335
|
-
<Tag label='Active' />
|
|
336
|
-
</TileTrailingContent>
|
|
337
|
-
</TileContent>
|
|
338
|
-
</Tile>
|
|
339
|
-
</TestWrapper>,
|
|
340
|
-
);
|
|
341
|
-
|
|
342
|
-
const trailingContent = getByTestId('tile-trailing-content');
|
|
343
|
-
expect(trailingContent.props.style).toMatchObject({
|
|
344
|
-
alignItems: 'center',
|
|
345
|
-
});
|
|
346
|
-
});
|
|
347
|
-
});
|
|
348
228
|
});
|