@ledgerhq/lumen-ui-rnative 0.1.37 → 0.1.39
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/Components/AmountInput/AmountInput.js +109 -72
- package/dist/module/lib/Components/AmountInput/AmountInput.js.map +1 -1
- package/dist/module/lib/Components/AmountInput/AmountInput.mdx +12 -0
- package/dist/module/lib/Components/AmountInput/AmountInput.stories.js +53 -0
- package/dist/module/lib/Components/AmountInput/AmountInput.stories.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.js +6 -5
- package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.mdx +2 -0
- package/dist/module/lib/Components/Avatar/Avatar.test.js +10 -13
- package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js +3 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js +1 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js +33 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheetHeader.js +7 -3
- package/dist/module/lib/Components/BottomSheet/BottomSheetHeader.js.map +1 -1
- package/dist/module/lib/Components/DotIcon/DotIcon.js +7 -4
- package/dist/module/lib/Components/DotIcon/DotIcon.js.map +1 -1
- package/dist/module/lib/Components/DotIcon/DotIcon.stories.js +10 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.stories.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/DotIndicator.js +5 -5
- package/dist/module/lib/Components/DotIndicator/DotIndicator.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/DotIndicator.mdx +4 -4
- package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js +3 -3
- package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js +12 -2
- package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js.map +1 -1
- package/dist/module/lib/Components/DotSymbol/DotSymbol.js +7 -4
- package/dist/module/lib/Components/DotSymbol/DotSymbol.js.map +1 -1
- package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js +19 -0
- package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js.map +1 -1
- package/dist/module/lib/Components/Label/Label.js +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.js +2 -2
- package/dist/module/lib/Components/MediaButton/MediaButton.mdx +2 -2
- package/dist/module/lib/Components/MediaImage/MediaImage.js +4 -2
- package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.mdx +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js +12 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.mdx +1 -1
- package/dist/module/lib/Components/ThemeProvider/ThemeProvider.js +2 -5
- package/dist/module/lib/Components/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/module/lib/Components/index.js +0 -1
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/module/lib/Symbols/Icons/Lightbulb.js +3 -3
- package/dist/module/lib/Symbols/Icons/Lightbulb.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/AmountInput/types.d.ts +12 -0
- package/dist/typescript/src/lib/Components/AmountInput/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts +2 -2
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetHeader.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts +9 -0
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts +2 -1
- package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIndicator/types.d.ts +2 -2
- package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Label/Label.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts +2 -2
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/index.d.ts +0 -1
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/lib/Components/AmountInput/AmountInput.mdx +12 -0
- package/src/lib/Components/AmountInput/AmountInput.stories.tsx +68 -1
- package/src/lib/Components/AmountInput/AmountInput.tsx +118 -75
- package/src/lib/Components/AmountInput/types.ts +14 -0
- package/src/lib/Components/Avatar/Avatar.mdx +2 -0
- package/src/lib/Components/Avatar/Avatar.test.tsx +16 -18
- package/src/lib/Components/Avatar/Avatar.tsx +9 -8
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +1 -0
- package/src/lib/Components/BottomSheet/BottomSheet.test.tsx +32 -1
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +10 -4
- package/src/lib/Components/BottomSheet/BottomSheetHeader.tsx +10 -6
- package/src/lib/Components/BottomSheet/types.ts +9 -0
- package/src/lib/Components/DotIcon/DotIcon.stories.tsx +8 -0
- package/src/lib/Components/DotIcon/DotIcon.tsx +4 -1
- package/src/lib/Components/DotIcon/types.ts +1 -1
- package/src/lib/Components/DotIndicator/DotIndicator.mdx +4 -4
- package/src/lib/Components/DotIndicator/DotIndicator.stories.tsx +2 -2
- package/src/lib/Components/DotIndicator/DotIndicator.test.tsx +12 -2
- package/src/lib/Components/DotIndicator/DotIndicator.tsx +5 -5
- package/src/lib/Components/DotIndicator/types.ts +2 -2
- package/src/lib/Components/DotSymbol/DotSymbol.stories.tsx +15 -0
- package/src/lib/Components/DotSymbol/DotSymbol.tsx +4 -1
- package/src/lib/Components/DotSymbol/types.ts +1 -1
- package/src/lib/Components/Label/Label.tsx +1 -1
- package/src/lib/Components/MediaButton/MediaButton.mdx +2 -2
- package/src/lib/Components/MediaButton/MediaButton.tsx +2 -2
- package/src/lib/Components/MediaImage/MediaImage.mdx +1 -1
- package/src/lib/Components/MediaImage/MediaImage.stories.tsx +3 -0
- package/src/lib/Components/MediaImage/MediaImage.tsx +2 -0
- package/src/lib/Components/MediaImage/types.ts +1 -1
- package/src/lib/Components/OptionList/OptionList.mdx +1 -1
- package/src/lib/Components/ThemeProvider/ThemeProvider.tsx +1 -4
- package/src/lib/Components/index.ts +0 -1
- package/src/lib/Symbols/Icons/Lightbulb.tsx +3 -3
- package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js +0 -155
- package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js.map +0 -1
- package/dist/module/lib/Components/Select/GlobalSelectContext.js +0 -78
- package/dist/module/lib/Components/Select/GlobalSelectContext.js.map +0 -1
- package/dist/module/lib/Components/Select/Select.js +0 -366
- package/dist/module/lib/Components/Select/Select.js.map +0 -1
- package/dist/module/lib/Components/Select/Select.mdx +0 -596
- package/dist/module/lib/Components/Select/Select.stories.js +0 -304
- package/dist/module/lib/Components/Select/Select.stories.js.map +0 -1
- package/dist/module/lib/Components/Select/Select.test.js +0 -123
- package/dist/module/lib/Components/Select/Select.test.js.map +0 -1
- package/dist/module/lib/Components/Select/SelectContext.js +0 -38
- package/dist/module/lib/Components/Select/SelectContext.js.map +0 -1
- package/dist/module/lib/Components/Select/index.js +0 -6
- package/dist/module/lib/Components/Select/index.js.map +0 -1
- package/dist/module/lib/Components/Select/types.js +0 -4
- package/dist/module/lib/Components/Select/types.js.map +0 -1
- package/dist/typescript/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts +0 -20
- package/dist/typescript/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/GlobalSelectContext.d.ts +0 -44
- package/dist/typescript/src/lib/Components/Select/GlobalSelectContext.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/Select.d.ts +0 -52
- package/dist/typescript/src/lib/Components/Select/Select.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/SelectContext.d.ts +0 -36
- package/dist/typescript/src/lib/Components/Select/SelectContext.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/index.d.ts +0 -4
- package/dist/typescript/src/lib/Components/Select/index.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/types.d.ts +0 -130
- package/dist/typescript/src/lib/Components/Select/types.d.ts.map +0 -1
- package/src/lib/Components/Select/GlobalSelectBottomSheet.tsx +0 -180
- package/src/lib/Components/Select/GlobalSelectContext.tsx +0 -103
- package/src/lib/Components/Select/Select.mdx +0 -596
- package/src/lib/Components/Select/Select.stories.tsx +0 -266
- package/src/lib/Components/Select/Select.test.tsx +0 -117
- package/src/lib/Components/Select/Select.tsx +0 -469
- package/src/lib/Components/Select/SelectContext.tsx +0 -68
- package/src/lib/Components/Select/index.ts +0 -3
- package/src/lib/Components/Select/types.ts +0 -149
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { Box } from '../Utility';
|
|
4
|
-
import { GlobalSelectBottomSheet } from './GlobalSelectBottomSheet';
|
|
5
|
-
import {
|
|
6
|
-
Select,
|
|
7
|
-
SelectTrigger,
|
|
8
|
-
SelectValue,
|
|
9
|
-
SelectContent,
|
|
10
|
-
SelectItem,
|
|
11
|
-
SelectItemText,
|
|
12
|
-
SelectGroup,
|
|
13
|
-
SelectLabel,
|
|
14
|
-
SelectSeparator,
|
|
15
|
-
} from './Select';
|
|
16
|
-
|
|
17
|
-
const meta: Meta<typeof Select> = {
|
|
18
|
-
component: Select,
|
|
19
|
-
tags: ['deprecated'],
|
|
20
|
-
subcomponents: {
|
|
21
|
-
SelectTrigger,
|
|
22
|
-
SelectValue,
|
|
23
|
-
SelectContent,
|
|
24
|
-
SelectItem,
|
|
25
|
-
SelectItemText,
|
|
26
|
-
SelectGroup,
|
|
27
|
-
SelectLabel,
|
|
28
|
-
SelectSeparator,
|
|
29
|
-
},
|
|
30
|
-
title: 'Selection/Select',
|
|
31
|
-
parameters: {
|
|
32
|
-
layout: 'fullscreen',
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default meta;
|
|
37
|
-
type Story = StoryObj<typeof Select>;
|
|
38
|
-
|
|
39
|
-
export const Base: Story = {
|
|
40
|
-
render: () => {
|
|
41
|
-
const [value, setValue] = useState<string>('apple');
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<>
|
|
45
|
-
<Box
|
|
46
|
-
style={{
|
|
47
|
-
flex: 1,
|
|
48
|
-
minHeight: 400,
|
|
49
|
-
padding: 24,
|
|
50
|
-
width: '100%',
|
|
51
|
-
}}
|
|
52
|
-
>
|
|
53
|
-
<Box style={{ width: '100%', maxWidth: 400 }}>
|
|
54
|
-
<Select value={value} onValueChange={setValue}>
|
|
55
|
-
<SelectTrigger label='Choose a fruit'>
|
|
56
|
-
<SelectValue />
|
|
57
|
-
</SelectTrigger>
|
|
58
|
-
<SelectContent>
|
|
59
|
-
<SelectItem value='apple'>
|
|
60
|
-
<SelectItemText>Apple</SelectItemText>
|
|
61
|
-
</SelectItem>
|
|
62
|
-
<SelectItem value='banana'>
|
|
63
|
-
<SelectItemText>Banana</SelectItemText>
|
|
64
|
-
</SelectItem>
|
|
65
|
-
<SelectItem value='orange'>
|
|
66
|
-
<SelectItemText>Orange</SelectItemText>
|
|
67
|
-
</SelectItem>
|
|
68
|
-
<SelectItem value='grape'>
|
|
69
|
-
<SelectItemText>Grape</SelectItemText>
|
|
70
|
-
</SelectItem>
|
|
71
|
-
<SelectItem value='mango'>
|
|
72
|
-
<SelectItemText>Mango</SelectItemText>
|
|
73
|
-
</SelectItem>
|
|
74
|
-
</SelectContent>
|
|
75
|
-
</Select>
|
|
76
|
-
</Box>
|
|
77
|
-
</Box>
|
|
78
|
-
<GlobalSelectBottomSheet />
|
|
79
|
-
</>
|
|
80
|
-
);
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const WithGroups: Story = {
|
|
85
|
-
render: () => {
|
|
86
|
-
const [value, setValue] = useState<string>('btc');
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<>
|
|
90
|
-
<Box
|
|
91
|
-
style={{
|
|
92
|
-
flex: 1,
|
|
93
|
-
minHeight: 400,
|
|
94
|
-
padding: 24,
|
|
95
|
-
width: '100%',
|
|
96
|
-
}}
|
|
97
|
-
>
|
|
98
|
-
<Box style={{ width: '100%', maxWidth: 400 }}>
|
|
99
|
-
<Select value={value} onValueChange={setValue}>
|
|
100
|
-
<SelectTrigger label='Select cryptocurrency'>
|
|
101
|
-
<SelectValue />
|
|
102
|
-
</SelectTrigger>
|
|
103
|
-
<SelectContent>
|
|
104
|
-
<SelectGroup>
|
|
105
|
-
<SelectLabel>Popular</SelectLabel>
|
|
106
|
-
<SelectItem value='btc'>
|
|
107
|
-
<SelectItemText>Bitcoin</SelectItemText>
|
|
108
|
-
</SelectItem>
|
|
109
|
-
<SelectItem value='eth'>
|
|
110
|
-
<SelectItemText>Ethereum</SelectItemText>
|
|
111
|
-
</SelectItem>
|
|
112
|
-
</SelectGroup>
|
|
113
|
-
<SelectSeparator />
|
|
114
|
-
<SelectGroup>
|
|
115
|
-
<SelectLabel>Altcoins</SelectLabel>
|
|
116
|
-
<SelectItem value='ada'>
|
|
117
|
-
<SelectItemText>Cardano</SelectItemText>
|
|
118
|
-
</SelectItem>
|
|
119
|
-
<SelectItem value='dot'>
|
|
120
|
-
<SelectItemText>Polkadot</SelectItemText>
|
|
121
|
-
</SelectItem>
|
|
122
|
-
<SelectItem value='sol'>
|
|
123
|
-
<SelectItemText>Solana</SelectItemText>
|
|
124
|
-
</SelectItem>
|
|
125
|
-
</SelectGroup>
|
|
126
|
-
</SelectContent>
|
|
127
|
-
</Select>
|
|
128
|
-
</Box>
|
|
129
|
-
</Box>
|
|
130
|
-
<GlobalSelectBottomSheet />
|
|
131
|
-
</>
|
|
132
|
-
);
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export const WithDisabledItems: Story = {
|
|
137
|
-
render: () => {
|
|
138
|
-
const [value, setValue] = useState<string>('option1');
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<>
|
|
142
|
-
<Box
|
|
143
|
-
style={{
|
|
144
|
-
flex: 1,
|
|
145
|
-
minHeight: 400,
|
|
146
|
-
padding: 24,
|
|
147
|
-
width: '100%',
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
150
|
-
<Box style={{ width: '100%', maxWidth: 400 }}>
|
|
151
|
-
<Select value={value} onValueChange={setValue}>
|
|
152
|
-
<SelectTrigger label='Select option'>
|
|
153
|
-
<SelectValue />
|
|
154
|
-
</SelectTrigger>
|
|
155
|
-
<SelectContent>
|
|
156
|
-
<SelectItem value='option1'>
|
|
157
|
-
<SelectItemText>Option 1</SelectItemText>
|
|
158
|
-
</SelectItem>
|
|
159
|
-
<SelectItem value='option2' disabled>
|
|
160
|
-
<SelectItemText>Option 2 (Disabled)</SelectItemText>
|
|
161
|
-
</SelectItem>
|
|
162
|
-
<SelectItem value='option3'>
|
|
163
|
-
<SelectItemText>Option 3</SelectItemText>
|
|
164
|
-
</SelectItem>
|
|
165
|
-
<SelectItem value='option4' disabled>
|
|
166
|
-
<SelectItemText>Option 4 (Disabled)</SelectItemText>
|
|
167
|
-
</SelectItem>
|
|
168
|
-
<SelectItem value='option5'>
|
|
169
|
-
<SelectItemText>Option 5</SelectItemText>
|
|
170
|
-
</SelectItem>
|
|
171
|
-
</SelectContent>
|
|
172
|
-
</Select>
|
|
173
|
-
</Box>
|
|
174
|
-
</Box>
|
|
175
|
-
<GlobalSelectBottomSheet />
|
|
176
|
-
</>
|
|
177
|
-
);
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
export const DisabledSelect: Story = {
|
|
182
|
-
render: () => {
|
|
183
|
-
const [value, setValue] = useState<string>('apple');
|
|
184
|
-
|
|
185
|
-
return (
|
|
186
|
-
<>
|
|
187
|
-
<Box
|
|
188
|
-
style={{
|
|
189
|
-
flex: 1,
|
|
190
|
-
minHeight: 400,
|
|
191
|
-
padding: 24,
|
|
192
|
-
width: '100%',
|
|
193
|
-
}}
|
|
194
|
-
>
|
|
195
|
-
<Box style={{ width: '100%', maxWidth: 400 }}>
|
|
196
|
-
<Select value={value} onValueChange={setValue} disabled>
|
|
197
|
-
<SelectTrigger label='Disabled select'>
|
|
198
|
-
<SelectValue />
|
|
199
|
-
</SelectTrigger>
|
|
200
|
-
<SelectContent>
|
|
201
|
-
<SelectItem value='apple'>
|
|
202
|
-
<SelectItemText>Apple</SelectItemText>
|
|
203
|
-
</SelectItem>
|
|
204
|
-
<SelectItem value='banana'>
|
|
205
|
-
<SelectItemText>Banana</SelectItemText>
|
|
206
|
-
</SelectItem>
|
|
207
|
-
<SelectItem value='orange'>
|
|
208
|
-
<SelectItemText>Orange</SelectItemText>
|
|
209
|
-
</SelectItem>
|
|
210
|
-
</SelectContent>
|
|
211
|
-
</Select>
|
|
212
|
-
</Box>
|
|
213
|
-
</Box>
|
|
214
|
-
<GlobalSelectBottomSheet />
|
|
215
|
-
</>
|
|
216
|
-
);
|
|
217
|
-
},
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
export const WithChangeCallback: Story = {
|
|
221
|
-
render: () => {
|
|
222
|
-
const [value, setValue] = useState<string>('option1');
|
|
223
|
-
|
|
224
|
-
return (
|
|
225
|
-
<>
|
|
226
|
-
<Box
|
|
227
|
-
style={{
|
|
228
|
-
flex: 1,
|
|
229
|
-
minHeight: 400,
|
|
230
|
-
padding: 24,
|
|
231
|
-
width: '100%',
|
|
232
|
-
}}
|
|
233
|
-
>
|
|
234
|
-
<Box style={{ width: '100%', maxWidth: 400 }}>
|
|
235
|
-
<Select
|
|
236
|
-
value={value}
|
|
237
|
-
onValueChange={(newValue) => {
|
|
238
|
-
setValue(newValue);
|
|
239
|
-
alert(`Selected: ${newValue}`);
|
|
240
|
-
}}
|
|
241
|
-
onOpenChange={(open) => {
|
|
242
|
-
alert(`Select ${open ? 'opened' : 'closed'}`);
|
|
243
|
-
}}
|
|
244
|
-
>
|
|
245
|
-
<SelectTrigger label='Select with callbacks'>
|
|
246
|
-
<SelectValue />
|
|
247
|
-
</SelectTrigger>
|
|
248
|
-
<SelectContent>
|
|
249
|
-
<SelectItem value='option1'>
|
|
250
|
-
<SelectItemText>Option 1</SelectItemText>
|
|
251
|
-
</SelectItem>
|
|
252
|
-
<SelectItem value='option2'>
|
|
253
|
-
<SelectItemText>Option 2</SelectItemText>
|
|
254
|
-
</SelectItem>
|
|
255
|
-
<SelectItem value='option3'>
|
|
256
|
-
<SelectItemText>Option 3</SelectItemText>
|
|
257
|
-
</SelectItem>
|
|
258
|
-
</SelectContent>
|
|
259
|
-
</Select>
|
|
260
|
-
</Box>
|
|
261
|
-
</Box>
|
|
262
|
-
<GlobalSelectBottomSheet />
|
|
263
|
-
</>
|
|
264
|
-
);
|
|
265
|
-
},
|
|
266
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, jest } from '@jest/globals';
|
|
2
|
-
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
|
-
import { render, fireEvent } from '@testing-library/react-native';
|
|
4
|
-
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
5
|
-
import { GlobalSelectBottomSheet } from './GlobalSelectBottomSheet';
|
|
6
|
-
import { GlobalSelectProvider } from './GlobalSelectContext';
|
|
7
|
-
import {
|
|
8
|
-
Select,
|
|
9
|
-
SelectTrigger,
|
|
10
|
-
SelectValue,
|
|
11
|
-
SelectContent,
|
|
12
|
-
SelectItem,
|
|
13
|
-
SelectItemText,
|
|
14
|
-
} from './Select';
|
|
15
|
-
|
|
16
|
-
const TestWrapper = ({ children }: { children: React.ReactNode }) => (
|
|
17
|
-
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
18
|
-
<GlobalSelectProvider>
|
|
19
|
-
{children}
|
|
20
|
-
<GlobalSelectBottomSheet />
|
|
21
|
-
</GlobalSelectProvider>
|
|
22
|
-
</ThemeProvider>
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
describe('Select', () => {
|
|
26
|
-
it('renders and displays selected value', () => {
|
|
27
|
-
const { getByText } = render(
|
|
28
|
-
<TestWrapper>
|
|
29
|
-
<Select value='option1'>
|
|
30
|
-
<SelectTrigger label='Choose option'>
|
|
31
|
-
<SelectValue />
|
|
32
|
-
</SelectTrigger>
|
|
33
|
-
<SelectContent>
|
|
34
|
-
<SelectItem value='option1'>
|
|
35
|
-
<SelectItemText>Option 1</SelectItemText>
|
|
36
|
-
</SelectItem>
|
|
37
|
-
<SelectItem value='option2'>
|
|
38
|
-
<SelectItemText>Option 2</SelectItemText>
|
|
39
|
-
</SelectItem>
|
|
40
|
-
</SelectContent>
|
|
41
|
-
</Select>
|
|
42
|
-
</TestWrapper>,
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
expect(getByText('Choose option')).toBeTruthy();
|
|
46
|
-
expect(getByText('Option 1')).toBeTruthy();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('opens and selects item on press', () => {
|
|
50
|
-
const onValueChange = jest.fn();
|
|
51
|
-
const { getByText, getByTestId } = render(
|
|
52
|
-
<TestWrapper>
|
|
53
|
-
<Select onValueChange={onValueChange}>
|
|
54
|
-
<SelectTrigger testID='select-trigger'>
|
|
55
|
-
<SelectValue />
|
|
56
|
-
</SelectTrigger>
|
|
57
|
-
<SelectContent>
|
|
58
|
-
<SelectItem value='option1'>
|
|
59
|
-
<SelectItemText>Option 1</SelectItemText>
|
|
60
|
-
</SelectItem>
|
|
61
|
-
<SelectItem value='option2'>
|
|
62
|
-
<SelectItemText>Option 2</SelectItemText>
|
|
63
|
-
</SelectItem>
|
|
64
|
-
</SelectContent>
|
|
65
|
-
</Select>
|
|
66
|
-
</TestWrapper>,
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
fireEvent.press(getByTestId('select-trigger'));
|
|
70
|
-
fireEvent.press(getByText('Option 2'));
|
|
71
|
-
|
|
72
|
-
expect(onValueChange).toHaveBeenCalledWith('option2');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('respects disabled state', () => {
|
|
76
|
-
const onOpenChange = jest.fn();
|
|
77
|
-
const { getByTestId } = render(
|
|
78
|
-
<TestWrapper>
|
|
79
|
-
<Select disabled onOpenChange={onOpenChange}>
|
|
80
|
-
<SelectTrigger testID='select-trigger'>
|
|
81
|
-
<SelectValue />
|
|
82
|
-
</SelectTrigger>
|
|
83
|
-
<SelectContent>
|
|
84
|
-
<SelectItem value='option1'>
|
|
85
|
-
<SelectItemText>Option 1</SelectItemText>
|
|
86
|
-
</SelectItem>
|
|
87
|
-
</SelectContent>
|
|
88
|
-
</Select>
|
|
89
|
-
</TestWrapper>,
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
fireEvent.press(getByTestId('select-trigger'));
|
|
93
|
-
expect(onOpenChange).not.toHaveBeenCalled();
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('requires GlobalSelectProvider', () => {
|
|
97
|
-
const originalError = console.error;
|
|
98
|
-
console.error = jest.fn();
|
|
99
|
-
|
|
100
|
-
expect(() => {
|
|
101
|
-
render(
|
|
102
|
-
<Select>
|
|
103
|
-
<SelectTrigger>
|
|
104
|
-
<SelectValue />
|
|
105
|
-
</SelectTrigger>
|
|
106
|
-
<SelectContent>
|
|
107
|
-
<SelectItem value='option1'>
|
|
108
|
-
<SelectItemText>Option 1</SelectItemText>
|
|
109
|
-
</SelectItem>
|
|
110
|
-
</SelectContent>
|
|
111
|
-
</Select>,
|
|
112
|
-
);
|
|
113
|
-
}).toThrow();
|
|
114
|
-
|
|
115
|
-
console.error = originalError;
|
|
116
|
-
});
|
|
117
|
-
});
|