@ledgerhq/lumen-ui-rnative 0.1.60 → 0.1.62
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/core/Avatar/Avatar.js +17 -6
- package/dist/module/lib/Components/core/Avatar/Avatar.js.map +1 -1
- package/dist/module/lib/Components/core/Avatar/Avatar.mdx +10 -6
- package/dist/module/lib/Components/core/Avatar/Avatar.stories.js +15 -6
- package/dist/module/lib/Components/core/Avatar/Avatar.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Avatar/Avatar.test.js +56 -0
- package/dist/module/lib/Components/core/Avatar/Avatar.test.js.map +1 -1
- package/dist/module/lib/Components/core/Avatar/index.js +1 -1
- package/dist/module/lib/Components/core/Avatar/index.js.map +1 -1
- package/dist/module/lib/Components/core/Avatar/useResolveAvatarColor.js +21 -0
- package/dist/module/lib/Components/core/Avatar/useResolveAvatarColor.js.map +1 -0
- package/dist/module/lib/Components/core/Avatar/useResolveAvatarColor.test.js +88 -0
- package/dist/module/lib/Components/core/Avatar/useResolveAvatarColor.test.js.map +1 -0
- package/dist/module/lib/Components/core/Banner/Banner.js +3 -3
- package/dist/module/lib/Components/core/Banner/Banner.js.map +1 -1
- package/dist/module/lib/Components/core/Banner/Banner.test.js +3 -3
- package/dist/module/lib/Components/core/Banner/Banner.test.js.map +1 -1
- package/dist/module/lib/Components/core/DotIcon/DotIcon.js +0 -13
- package/dist/module/lib/Components/core/DotIcon/DotIcon.js.map +1 -1
- package/dist/module/lib/Components/core/DotIcon/DotIcon.mdx +3 -3
- package/dist/module/lib/Components/core/DotIcon/DotIcon.stories.js +14 -13
- package/dist/module/lib/Components/core/DotIcon/DotIcon.stories.js.map +1 -1
- package/dist/module/lib/Components/core/DotIcon/DotIcon.test.js +22 -0
- package/dist/module/lib/Components/core/DotIcon/DotIcon.test.js.map +1 -1
- package/dist/module/lib/Components/core/DotIcon/getDotIconProps.js +37 -0
- package/dist/module/lib/Components/core/DotIcon/getDotIconProps.js.map +1 -0
- package/dist/module/lib/Components/core/DotIcon/getDotIconProps.test.js +38 -0
- package/dist/module/lib/Components/core/DotIcon/getDotIconProps.test.js.map +1 -0
- package/dist/module/lib/Components/core/DotIcon/index.js +2 -1
- package/dist/module/lib/Components/core/DotIcon/index.js.map +1 -1
- package/dist/module/lib/Components/core/DotSymbol/DotSymbol.js +0 -19
- package/dist/module/lib/Components/core/DotSymbol/DotSymbol.js.map +1 -1
- package/dist/module/lib/Components/core/DotSymbol/DotSymbol.mdx +3 -3
- package/dist/module/lib/Components/core/DotSymbol/DotSymbol.stories.js +18 -17
- package/dist/module/lib/Components/core/DotSymbol/DotSymbol.stories.js.map +1 -1
- package/dist/module/lib/Components/core/DotSymbol/getDotSymbolProps.js +55 -0
- package/dist/module/lib/Components/core/DotSymbol/getDotSymbolProps.js.map +1 -0
- package/dist/module/lib/Components/core/DotSymbol/getDotSymbolProps.test.js +56 -0
- package/dist/module/lib/Components/core/DotSymbol/getDotSymbolProps.test.js.map +1 -0
- package/dist/module/lib/Components/core/DotSymbol/index.js +2 -1
- package/dist/module/lib/Components/core/DotSymbol/index.js.map +1 -1
- package/dist/module/lib/Components/core/MediaButton/MediaButton.js +2 -2
- package/dist/module/lib/Components/core/MediaButton/MediaButton.mdx +2 -2
- package/dist/module/lib/Components/core/MenuList/MenuList.figma.js +21 -0
- package/dist/module/lib/Components/core/MenuList/MenuList.figma.js.map +1 -0
- package/dist/module/lib/Components/core/MenuList/MenuList.js +143 -0
- package/dist/module/lib/Components/core/MenuList/MenuList.js.map +1 -0
- package/dist/module/lib/Components/core/MenuList/MenuList.mdx +66 -0
- package/dist/module/lib/Components/core/MenuList/MenuList.stories.js +139 -0
- package/dist/module/lib/Components/core/MenuList/MenuList.stories.js.map +1 -0
- package/dist/module/lib/Components/core/MenuList/MenuList.test.js +146 -0
- package/dist/module/lib/Components/core/MenuList/MenuList.test.js.map +1 -0
- package/dist/module/lib/Components/core/MenuList/index.js +5 -0
- package/dist/module/lib/Components/core/MenuList/index.js.map +1 -0
- package/dist/module/lib/Components/core/MenuList/types.js.map +1 -0
- package/dist/module/lib/Components/core/SelectList/SelectList.figma.js +28 -0
- package/dist/module/lib/Components/core/{OptionList/OptionList.figma.js.map → SelectList/SelectList.figma.js.map} +1 -1
- package/dist/module/lib/Components/core/{OptionList/OptionList.js → SelectList/SelectList.js} +46 -46
- package/dist/module/lib/Components/core/{OptionList/OptionList.js.map → SelectList/SelectList.js.map} +1 -1
- package/dist/module/lib/Components/core/{OptionList/OptionList.mdx → SelectList/SelectList.mdx} +81 -81
- package/dist/module/lib/Components/core/{OptionList/OptionList.stories.js → SelectList/SelectList.stories.js} +130 -130
- package/dist/module/lib/Components/core/{OptionList/OptionList.stories.js.map → SelectList/SelectList.stories.js.map} +1 -1
- package/dist/module/lib/Components/core/{OptionList/OptionList.test.js → SelectList/SelectList.test.js} +83 -83
- package/dist/module/lib/Components/core/{OptionList/OptionList.test.js.map → SelectList/SelectList.test.js.map} +1 -1
- package/dist/module/lib/Components/core/SelectList/index.js +5 -0
- package/dist/module/lib/Components/core/{OptionList → SelectList}/index.js.map +1 -1
- package/dist/module/lib/Components/core/SelectList/types.js +4 -0
- package/dist/module/lib/Components/core/{OptionList → SelectList}/types.js.map +1 -1
- package/dist/module/lib/Components/core/{OptionList/useOptionList/useOptionListItems.js → SelectList/useSelectList/useSelectListItems.js} +2 -2
- package/dist/module/lib/Components/core/{OptionList/useOptionList/useOptionListItems.js.map → SelectList/useSelectList/useSelectListItems.js.map} +1 -1
- package/dist/module/lib/Components/core/{OptionList/useOptionList/useOptionListItems.test.js → SelectList/useSelectList/useSelectListItems.test.js} +17 -17
- package/dist/module/lib/Components/core/{OptionList/useOptionList/useOptionListItems.test.js.map → SelectList/useSelectList/useSelectListItems.test.js.map} +1 -1
- package/dist/module/lib/Components/core/index.js +2 -1
- package/dist/module/lib/Components/core/index.js.map +1 -1
- package/dist/module/lib/Components/internal/BaseButton/BaseButton.js +2 -2
- package/dist/module/lib/Components/internal/BaseButton/BaseButton.js.map +1 -1
- package/dist/module/lib/Components/internal/BaseInput/BaseInputLabel.js +2 -2
- package/dist/module/lib/Components/internal/BaseInput/BaseInputLabel.js.map +1 -1
- package/dist/module/lib/Components/internal/BaseTag/BaseTag.js +3 -3
- package/dist/module/lib/Components/internal/BaseTag/BaseTag.js.map +1 -1
- package/dist/module/lib/Components/internal/BaseTag/BaseTag.test.js +1 -1
- package/dist/module/lib/Components/internal/BaseTag/BaseTag.test.js.map +1 -1
- package/dist/module/lib/Components/symbols/Icon/Icon.test.js +1 -1
- package/dist/module/lib/Components/symbols/icons/CloudSync.js +50 -0
- package/dist/module/lib/Components/symbols/icons/CloudSync.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Dollar.js +11 -5
- package/dist/module/lib/Components/symbols/icons/Dollar.js.map +1 -1
- package/dist/module/lib/Components/symbols/icons/DollarConvert.js +1 -1
- package/dist/module/lib/Components/symbols/icons/DollarConvert.js.map +1 -1
- package/dist/module/lib/Components/symbols/icons/DollarFill.js +47 -0
- package/dist/module/lib/Components/symbols/icons/DollarFill.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/FaceId.js +50 -0
- package/dist/module/lib/Components/symbols/icons/FaceId.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Fingerprint.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Fingerprint.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Pause.js +2 -1
- package/dist/module/lib/Components/symbols/icons/Pause.js.map +1 -1
- package/dist/module/lib/Components/symbols/icons/Range.js +2 -5
- package/dist/module/lib/Components/symbols/icons/Range.js.map +1 -1
- package/dist/module/lib/Components/symbols/icons/Telegram.js +20 -9
- package/dist/module/lib/Components/symbols/icons/Telegram.js.map +1 -1
- package/dist/module/lib/Components/symbols/icons/Usb.js +1 -1
- package/dist/module/lib/Components/symbols/index.js +4 -0
- package/dist/module/lib/Components/symbols/index.js.map +1 -1
- package/dist/typescript/src/lib/Components/core/Avatar/Avatar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Avatar/index.d.ts +1 -1
- package/dist/typescript/src/lib/Components/core/Avatar/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Avatar/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/core/Avatar/useResolveAvatarColor.d.ts +10 -0
- package/dist/typescript/src/lib/Components/core/Avatar/useResolveAvatarColor.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/DotIcon/DotIcon.d.ts +0 -13
- package/dist/typescript/src/lib/Components/core/DotIcon/DotIcon.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/DotIcon/getDotIconProps.d.ts +66 -0
- package/dist/typescript/src/lib/Components/core/DotIcon/getDotIconProps.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/DotIcon/index.d.ts +2 -1
- package/dist/typescript/src/lib/Components/core/DotIcon/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/DotSymbol/DotSymbol.d.ts +1 -5
- package/dist/typescript/src/lib/Components/core/DotSymbol/DotSymbol.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/DotSymbol/getDotSymbolProps.d.ts +102 -0
- package/dist/typescript/src/lib/Components/core/DotSymbol/getDotSymbolProps.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/DotSymbol/index.d.ts +2 -1
- package/dist/typescript/src/lib/Components/core/DotSymbol/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/MediaButton/MediaButton.d.ts +2 -2
- package/dist/typescript/src/lib/Components/core/MenuList/MenuList.d.ts +29 -0
- package/dist/typescript/src/lib/Components/core/MenuList/MenuList.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/MenuList/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/core/MenuList/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/MenuList/types.d.ts +42 -0
- package/dist/typescript/src/lib/Components/core/MenuList/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/core/SelectList/SelectList.d.ts +27 -0
- package/dist/typescript/src/lib/Components/core/{OptionList/OptionList.d.ts.map → SelectList/SelectList.d.ts.map} +1 -1
- package/dist/typescript/src/lib/Components/core/SelectList/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/core/{OptionList → SelectList}/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/{OptionList → SelectList}/types.d.ts +24 -24
- package/dist/typescript/src/lib/Components/core/{OptionList → SelectList}/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/SelectList/useSelectList/useSelectListItems.d.ts +20 -0
- package/dist/typescript/src/lib/Components/core/{OptionList/useOptionList/useOptionListItems.d.ts.map → SelectList/useSelectList/useSelectListItems.d.ts.map} +1 -1
- package/dist/typescript/src/lib/Components/core/index.d.ts +2 -1
- package/dist/typescript/src/lib/Components/core/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/internal/BaseInput/BaseInputLabel.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/symbols/icons/CloudSync.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CloudSync.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Dollar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/symbols/icons/DollarFill.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/DollarFill.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/FaceId.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/FaceId.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Fingerprint.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Fingerprint.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Pause.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/symbols/icons/Range.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/symbols/icons/Telegram.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/symbols/index.d.ts +4 -0
- package/dist/typescript/src/lib/Components/symbols/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/lib/Components/core/Avatar/Avatar.mdx +10 -6
- package/src/lib/Components/core/Avatar/Avatar.stories.tsx +16 -9
- package/src/lib/Components/core/Avatar/Avatar.test.tsx +64 -0
- package/src/lib/Components/core/Avatar/Avatar.tsx +41 -8
- package/src/lib/Components/core/Avatar/index.ts +1 -1
- package/src/lib/Components/core/Avatar/types.ts +1 -1
- package/src/lib/Components/core/Avatar/useResolveAvatarColor.test.tsx +106 -0
- package/src/lib/Components/core/Avatar/useResolveAvatarColor.ts +25 -0
- package/src/lib/Components/core/Banner/Banner.test.tsx +3 -3
- package/src/lib/Components/core/Banner/Banner.tsx +3 -3
- package/src/lib/Components/core/DotIcon/DotIcon.mdx +3 -3
- package/src/lib/Components/core/DotIcon/DotIcon.stories.tsx +14 -13
- package/src/lib/Components/core/DotIcon/DotIcon.test.tsx +20 -0
- package/src/lib/Components/core/DotIcon/DotIcon.tsx +0 -15
- package/src/lib/Components/core/DotIcon/getDotIconProps.test.ts +19 -0
- package/src/lib/Components/core/DotIcon/getDotIconProps.ts +20 -0
- package/src/lib/Components/core/DotIcon/index.ts +2 -5
- package/src/lib/Components/core/DotSymbol/DotSymbol.mdx +3 -3
- package/src/lib/Components/core/DotSymbol/DotSymbol.stories.tsx +18 -17
- package/src/lib/Components/core/DotSymbol/DotSymbol.tsx +0 -23
- package/src/lib/Components/core/DotSymbol/getDotSymbolProps.test.ts +25 -0
- package/src/lib/Components/core/DotSymbol/getDotSymbolProps.ts +26 -0
- package/src/lib/Components/core/DotSymbol/index.ts +2 -1
- package/src/lib/Components/core/MediaButton/MediaButton.mdx +2 -2
- package/src/lib/Components/core/MediaButton/MediaButton.tsx +2 -2
- package/src/lib/Components/core/MenuList/MenuList.figma.tsx +23 -0
- package/src/lib/Components/core/MenuList/MenuList.mdx +66 -0
- package/src/lib/Components/core/MenuList/MenuList.stories.tsx +114 -0
- package/src/lib/Components/core/MenuList/MenuList.test.tsx +135 -0
- package/src/lib/Components/core/MenuList/MenuList.tsx +162 -0
- package/src/lib/Components/core/MenuList/index.ts +2 -0
- package/src/lib/Components/core/MenuList/types.ts +49 -0
- package/src/lib/Components/core/SelectList/SelectList.figma.tsx +37 -0
- package/src/lib/Components/core/{OptionList/OptionList.mdx → SelectList/SelectList.mdx} +81 -81
- package/src/lib/Components/core/{OptionList/OptionList.stories.tsx → SelectList/SelectList.stories.tsx} +227 -227
- package/src/lib/Components/core/{OptionList/OptionList.test.tsx → SelectList/SelectList.test.tsx} +138 -138
- package/src/lib/Components/core/{OptionList/OptionList.tsx → SelectList/SelectList.tsx} +92 -92
- package/src/lib/Components/core/SelectList/index.ts +2 -0
- package/src/lib/Components/core/{OptionList → SelectList}/types.ts +28 -28
- package/src/lib/Components/core/{OptionList/useOptionList/useOptionListItems.test.ts → SelectList/useSelectList/useSelectListItems.test.ts} +24 -24
- package/src/lib/Components/core/{OptionList/useOptionList/useOptionListItems.ts → SelectList/useSelectList/useSelectListItems.ts} +21 -21
- package/src/lib/Components/core/Spot/Spot.tsx +1 -1
- package/src/lib/Components/core/index.ts +2 -1
- package/src/lib/Components/internal/BaseButton/BaseButton.tsx +2 -2
- package/src/lib/Components/internal/BaseInput/BaseInputLabel.tsx +5 -2
- package/src/lib/Components/internal/BaseTag/BaseTag.test.tsx +3 -3
- package/src/lib/Components/internal/BaseTag/BaseTag.tsx +3 -3
- package/src/lib/Components/symbols/Icon/Icon.test.tsx +1 -1
- package/src/lib/Components/symbols/icons/CloudSync.tsx +45 -0
- package/src/lib/Components/symbols/icons/Dollar.tsx +8 -1
- package/src/lib/Components/symbols/icons/DollarConvert.tsx +1 -1
- package/src/lib/Components/symbols/icons/DollarFill.tsx +42 -0
- package/src/lib/Components/symbols/icons/FaceId.tsx +45 -0
- package/src/lib/Components/symbols/icons/Fingerprint.tsx +45 -0
- package/src/lib/Components/symbols/icons/Pause.tsx +2 -1
- package/src/lib/Components/symbols/icons/Range.tsx +2 -5
- package/src/lib/Components/symbols/icons/Telegram.tsx +14 -7
- package/src/lib/Components/symbols/icons/Usb.tsx +1 -1
- package/src/lib/Components/symbols/index.ts +4 -0
- package/dist/module/lib/Components/core/Avatar/resolveAvatarColor.js +0 -18
- package/dist/module/lib/Components/core/Avatar/resolveAvatarColor.js.map +0 -1
- package/dist/module/lib/Components/core/OptionList/OptionList.figma.js +0 -28
- package/dist/module/lib/Components/core/OptionList/index.js +0 -5
- package/dist/typescript/src/lib/Components/core/Avatar/resolveAvatarColor.d.ts +0 -8
- package/dist/typescript/src/lib/Components/core/Avatar/resolveAvatarColor.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/core/OptionList/OptionList.d.ts +0 -27
- package/dist/typescript/src/lib/Components/core/OptionList/index.d.ts +0 -3
- package/dist/typescript/src/lib/Components/core/OptionList/useOptionList/useOptionListItems.d.ts +0 -20
- package/src/lib/Components/core/Avatar/resolveAvatarColor.ts +0 -19
- package/src/lib/Components/core/OptionList/OptionList.figma.tsx +0 -37
- package/src/lib/Components/core/OptionList/index.ts +0 -2
- /package/dist/module/lib/Components/core/{OptionList → MenuList}/types.js +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls, Source } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as MenuListStories from './MenuList.stories';
|
|
3
|
+
import {
|
|
4
|
+
CustomTabs,
|
|
5
|
+
Tab,
|
|
6
|
+
SetupNote,
|
|
7
|
+
} from '../../../../../.storybook/components';
|
|
8
|
+
|
|
9
|
+
<Meta title='Core/MenuList' of={MenuListStories} />
|
|
10
|
+
|
|
11
|
+
# MenuList
|
|
12
|
+
|
|
13
|
+
<CustomTabs>
|
|
14
|
+
<Tab label='Overview'>
|
|
15
|
+
|
|
16
|
+
## Introduction
|
|
17
|
+
|
|
18
|
+
`MenuList` is a container for a set of tappable actions. Each `MenuListItem` displays a label, an optional leading icon, and supports `base` and `red` appearances.
|
|
19
|
+
|
|
20
|
+
> View in [Figma](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=7897-7037&m=dev).
|
|
21
|
+
|
|
22
|
+
## Anatomy
|
|
23
|
+
|
|
24
|
+
<Canvas of={MenuListStories.Base} />
|
|
25
|
+
<Controls of={MenuListStories.ItemShowcase} />
|
|
26
|
+
|
|
27
|
+
## Properties
|
|
28
|
+
|
|
29
|
+
### Appearance
|
|
30
|
+
|
|
31
|
+
`MenuListItem` supports two appearances: `base` (default) for standard actions and `red` for irreversible or dangerous operations such as deleting or unlinking. The red appearance renders the label and icon in the error colour.
|
|
32
|
+
|
|
33
|
+
Place `red` items **last** in the list. Both the Apple HIG and Material guidelines put destructive actions at the bottom, away from the items a user reaches for by habit. `MenuList` does not enforce the order.
|
|
34
|
+
|
|
35
|
+
<Canvas of={MenuListStories.AppearanceShowcase} />
|
|
36
|
+
|
|
37
|
+
### Disabled
|
|
38
|
+
|
|
39
|
+
Set `disabled` on individual `MenuListItem`s to prevent interaction. The label and icon are rendered in the disabled colour and the press handler is suppressed.
|
|
40
|
+
|
|
41
|
+
<Canvas of={MenuListStories.DisabledShowcase} />
|
|
42
|
+
|
|
43
|
+
## Accessibility
|
|
44
|
+
|
|
45
|
+
Each `MenuListItem` has `accessibilityRole='button'` and sets `accessibilityState={{ disabled }}` to reflect its interaction state to assistive technologies.
|
|
46
|
+
|
|
47
|
+
</Tab>
|
|
48
|
+
|
|
49
|
+
<Tab label='Implementation'>
|
|
50
|
+
|
|
51
|
+
<SetupNote />
|
|
52
|
+
|
|
53
|
+
### Basic Usage
|
|
54
|
+
|
|
55
|
+
<Source of={MenuListStories.Base} />
|
|
56
|
+
|
|
57
|
+
### Appearances
|
|
58
|
+
|
|
59
|
+
<Source of={MenuListStories.AppearanceShowcase} />
|
|
60
|
+
|
|
61
|
+
### Disabled Items
|
|
62
|
+
|
|
63
|
+
<Source of={MenuListStories.DisabledShowcase} />
|
|
64
|
+
|
|
65
|
+
</Tab>
|
|
66
|
+
</CustomTabs>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
+
import { Box } from '../../primitives';
|
|
3
|
+
import { Settings, Trash, Unlink } from '../../symbols';
|
|
4
|
+
import { MenuList, MenuListItem } from './MenuList';
|
|
5
|
+
|
|
6
|
+
const iconMap = {
|
|
7
|
+
None: undefined,
|
|
8
|
+
Settings,
|
|
9
|
+
Unlink,
|
|
10
|
+
Trash,
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
const meta = {
|
|
14
|
+
id: 'rnative-menulist',
|
|
15
|
+
title: 'Core/MenuList',
|
|
16
|
+
component: MenuList,
|
|
17
|
+
subcomponents: { MenuListItem },
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
source: { language: 'tsx', format: true, type: 'dynamic' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
} satisfies Meta<typeof MenuList>;
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
type Story = StoryObj<typeof MenuList>;
|
|
27
|
+
|
|
28
|
+
export const Base: Story = {
|
|
29
|
+
parameters: {
|
|
30
|
+
layout: 'centered',
|
|
31
|
+
backgrounds: { default: 'light' },
|
|
32
|
+
},
|
|
33
|
+
render: () => (
|
|
34
|
+
<Box lx={{ width: 's320' }}>
|
|
35
|
+
<MenuList>
|
|
36
|
+
<MenuListItem label='Unlink device' appearance='base' icon={Unlink} />
|
|
37
|
+
</MenuList>
|
|
38
|
+
</Box>
|
|
39
|
+
),
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const ItemShowcase: StoryObj<typeof MenuListItem> = {
|
|
43
|
+
parameters: {
|
|
44
|
+
layout: 'centered',
|
|
45
|
+
backgrounds: { default: 'light' },
|
|
46
|
+
},
|
|
47
|
+
argTypes: {
|
|
48
|
+
icon: {
|
|
49
|
+
options: Object.keys(iconMap),
|
|
50
|
+
mapping: iconMap,
|
|
51
|
+
control: { type: 'select' },
|
|
52
|
+
},
|
|
53
|
+
onPress: { action: 'pressed' },
|
|
54
|
+
},
|
|
55
|
+
args: {
|
|
56
|
+
label: 'Unlink device',
|
|
57
|
+
appearance: 'base',
|
|
58
|
+
disabled: false,
|
|
59
|
+
icon: Unlink,
|
|
60
|
+
},
|
|
61
|
+
render: (args) => (
|
|
62
|
+
<Box lx={{ width: 's320' }}>
|
|
63
|
+
<MenuList>
|
|
64
|
+
<MenuListItem {...args} />
|
|
65
|
+
</MenuList>
|
|
66
|
+
</Box>
|
|
67
|
+
),
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const AppearanceShowcase: Story = {
|
|
71
|
+
parameters: {
|
|
72
|
+
layout: 'centered',
|
|
73
|
+
backgrounds: { default: 'light' },
|
|
74
|
+
},
|
|
75
|
+
render: () => (
|
|
76
|
+
<Box lx={{ width: 's320' }}>
|
|
77
|
+
<MenuList>
|
|
78
|
+
<MenuListItem label='Unlink device' icon={Unlink} onPress={() => {}} />
|
|
79
|
+
<MenuListItem
|
|
80
|
+
label='Remove device'
|
|
81
|
+
icon={Trash}
|
|
82
|
+
appearance='red'
|
|
83
|
+
onPress={() => {}}
|
|
84
|
+
/>
|
|
85
|
+
</MenuList>
|
|
86
|
+
</Box>
|
|
87
|
+
),
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const DisabledShowcase: Story = {
|
|
91
|
+
parameters: {
|
|
92
|
+
layout: 'centered',
|
|
93
|
+
backgrounds: { default: 'light' },
|
|
94
|
+
},
|
|
95
|
+
render: () => (
|
|
96
|
+
<Box lx={{ width: 's320' }}>
|
|
97
|
+
<MenuList>
|
|
98
|
+
<MenuListItem
|
|
99
|
+
label='Unlink device'
|
|
100
|
+
icon={Unlink}
|
|
101
|
+
disabled
|
|
102
|
+
onPress={() => {}}
|
|
103
|
+
/>
|
|
104
|
+
<MenuListItem
|
|
105
|
+
label='Remove device'
|
|
106
|
+
icon={Trash}
|
|
107
|
+
appearance='red'
|
|
108
|
+
disabled
|
|
109
|
+
onPress={() => {}}
|
|
110
|
+
/>
|
|
111
|
+
</MenuList>
|
|
112
|
+
</Box>
|
|
113
|
+
),
|
|
114
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
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 { View } from 'react-native';
|
|
5
|
+
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
6
|
+
import { MenuList, MenuListItem } from './MenuList';
|
|
7
|
+
import type { IconComponent } from './types';
|
|
8
|
+
|
|
9
|
+
const TestIcon: IconComponent = ({ size, color }) => (
|
|
10
|
+
<View
|
|
11
|
+
testID='icon'
|
|
12
|
+
style={{ width: size, height: size }}
|
|
13
|
+
accessibilityLabel={String(color)}
|
|
14
|
+
/>
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const TestWrapper = ({ children }: { children: React.ReactNode }) => (
|
|
18
|
+
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
19
|
+
{children}
|
|
20
|
+
</ThemeProvider>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
describe('MenuList', () => {
|
|
24
|
+
it('renders children', () => {
|
|
25
|
+
const { getByText } = render(
|
|
26
|
+
<TestWrapper>
|
|
27
|
+
<MenuList>
|
|
28
|
+
<MenuListItem label='Item A' onPress={jest.fn()} />
|
|
29
|
+
</MenuList>
|
|
30
|
+
</TestWrapper>,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
expect(getByText('Item A')).toBeTruthy();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe('MenuListItem', () => {
|
|
38
|
+
it('renders the label', () => {
|
|
39
|
+
const { getByText } = render(
|
|
40
|
+
<TestWrapper>
|
|
41
|
+
<MenuListItem label='Settings' onPress={jest.fn()} />
|
|
42
|
+
</TestWrapper>,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
expect(getByText('Settings')).toBeTruthy();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('calls onPress when pressed', () => {
|
|
49
|
+
const onPress = jest.fn();
|
|
50
|
+
const { getByRole } = render(
|
|
51
|
+
<TestWrapper>
|
|
52
|
+
<MenuListItem label='Action' onPress={onPress} />
|
|
53
|
+
</TestWrapper>,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
fireEvent.press(getByRole('button'));
|
|
57
|
+
|
|
58
|
+
expect(onPress).toHaveBeenCalledTimes(1);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('does not call onPress when disabled', () => {
|
|
62
|
+
const onPress = jest.fn();
|
|
63
|
+
const { getByRole } = render(
|
|
64
|
+
<TestWrapper>
|
|
65
|
+
<MenuListItem label='Disabled action' onPress={onPress} disabled />
|
|
66
|
+
</TestWrapper>,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
fireEvent.press(getByRole('button'));
|
|
70
|
+
|
|
71
|
+
expect(onPress).not.toHaveBeenCalled();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('sets accessibilityState disabled when disabled', () => {
|
|
75
|
+
const { getByRole } = render(
|
|
76
|
+
<TestWrapper>
|
|
77
|
+
<MenuListItem label='Disabled' onPress={jest.fn()} disabled />
|
|
78
|
+
</TestWrapper>,
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
expect(getByRole('button').props.accessibilityState?.disabled).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('renders with red appearance', () => {
|
|
85
|
+
const { getByText } = render(
|
|
86
|
+
<TestWrapper>
|
|
87
|
+
<MenuListItem label='Delete' appearance='red' onPress={jest.fn()} />
|
|
88
|
+
</TestWrapper>,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
expect(getByText('Delete').props.style.color).toBe(
|
|
92
|
+
ledgerLiveThemes.dark.colors.text.error,
|
|
93
|
+
);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('renders the icon with base color by default', () => {
|
|
97
|
+
const { getByTestId } = render(
|
|
98
|
+
<TestWrapper>
|
|
99
|
+
<MenuListItem label='With Icon' icon={TestIcon} onPress={jest.fn()} />
|
|
100
|
+
</TestWrapper>,
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
expect(getByTestId('icon').props.accessibilityLabel).toBe('base');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('renders icon with disabled color when disabled', () => {
|
|
107
|
+
const { getByTestId } = render(
|
|
108
|
+
<TestWrapper>
|
|
109
|
+
<MenuListItem
|
|
110
|
+
label='With Icon'
|
|
111
|
+
icon={TestIcon}
|
|
112
|
+
onPress={jest.fn()}
|
|
113
|
+
disabled
|
|
114
|
+
/>
|
|
115
|
+
</TestWrapper>,
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
expect(getByTestId('icon').props.accessibilityLabel).toBe('disabled');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('renders icon with error color when appearance is red', () => {
|
|
122
|
+
const { getByTestId } = render(
|
|
123
|
+
<TestWrapper>
|
|
124
|
+
<MenuListItem
|
|
125
|
+
label='Delete'
|
|
126
|
+
icon={TestIcon}
|
|
127
|
+
appearance='red'
|
|
128
|
+
onPress={jest.fn()}
|
|
129
|
+
/>
|
|
130
|
+
</TestWrapper>,
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
expect(getByTestId('icon').props.accessibilityLabel).toBe('error');
|
|
134
|
+
});
|
|
135
|
+
});
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import type { LumenTextStyle } from '../../../../styles';
|
|
4
|
+
import { useStyleSheet } from '../../../../styles';
|
|
5
|
+
import { Box, Pressable, Text } from '../../primitives';
|
|
6
|
+
import type {
|
|
7
|
+
MenuListItemAppearance,
|
|
8
|
+
MenuListItemProps,
|
|
9
|
+
MenuListProps,
|
|
10
|
+
} from './types';
|
|
11
|
+
|
|
12
|
+
const resolveContentColor = (
|
|
13
|
+
disabled: boolean,
|
|
14
|
+
appearance: MenuListItemAppearance,
|
|
15
|
+
): NonNullable<LumenTextStyle['color']> => {
|
|
16
|
+
if (disabled) {
|
|
17
|
+
return 'disabled';
|
|
18
|
+
}
|
|
19
|
+
if (appearance === 'red') {
|
|
20
|
+
return 'error';
|
|
21
|
+
}
|
|
22
|
+
return 'base';
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const useItemStyles = ({
|
|
26
|
+
pressed,
|
|
27
|
+
disabled,
|
|
28
|
+
appearance,
|
|
29
|
+
}: {
|
|
30
|
+
pressed: boolean;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
appearance: MenuListItemAppearance;
|
|
33
|
+
}) =>
|
|
34
|
+
useStyleSheet(
|
|
35
|
+
(t) => ({
|
|
36
|
+
container: StyleSheet.flatten([
|
|
37
|
+
{
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
paddingVertical: t.spacings.s12,
|
|
41
|
+
paddingHorizontal: t.spacings.s8,
|
|
42
|
+
gap: t.spacings.s12,
|
|
43
|
+
borderRadius: t.borderRadius.sm,
|
|
44
|
+
backgroundColor: t.colors.bg.baseTransparent,
|
|
45
|
+
},
|
|
46
|
+
pressed && { backgroundColor: t.colors.bg.baseTransparentPressed },
|
|
47
|
+
]),
|
|
48
|
+
label: StyleSheet.flatten([
|
|
49
|
+
t.typographies.body2SemiBold,
|
|
50
|
+
{
|
|
51
|
+
flex: 1,
|
|
52
|
+
color: t.colors.text[resolveContentColor(disabled, appearance)],
|
|
53
|
+
},
|
|
54
|
+
]),
|
|
55
|
+
}),
|
|
56
|
+
[pressed, disabled, appearance],
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A container for a set of tappable actions, rendered as `MenuListItem`s.
|
|
61
|
+
*
|
|
62
|
+
* `MenuList` is a content primitive: it owns no open/close state, so compose it
|
|
63
|
+
* inside a `BottomSheet` (or any other surface) to build a menu experience.
|
|
64
|
+
*
|
|
65
|
+
* @see {@link https://ldls-react-native.vercel.app/?path=/docs/rnative-menulist--docs Storybook}
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* <MenuList>
|
|
69
|
+
* <MenuListItem icon={Unlink} label="Unlink" onPress={handleUnlink} />
|
|
70
|
+
* <MenuListItem icon={Trash} label="Remove" appearance="red" onPress={handleRemove} />
|
|
71
|
+
* </MenuList>
|
|
72
|
+
*/
|
|
73
|
+
export const MenuList = ({
|
|
74
|
+
children,
|
|
75
|
+
lx,
|
|
76
|
+
style,
|
|
77
|
+
ref,
|
|
78
|
+
...props
|
|
79
|
+
}: MenuListProps) => (
|
|
80
|
+
<Box lx={lx} style={style} ref={ref} {...props}>
|
|
81
|
+
{children}
|
|
82
|
+
</Box>
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* A single action inside a `MenuList`: a label, an optional leading icon and a
|
|
87
|
+
* press handler.
|
|
88
|
+
*
|
|
89
|
+
* Place destructive (`appearance="red"`) items last, per platform convention.
|
|
90
|
+
*
|
|
91
|
+
* @see {@link https://ldls-react-native.vercel.app/?path=/docs/rnative-menulist--docs Storybook}
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* <MenuListItem icon={Trash} label="Remove" appearance="red" onPress={handleRemove} />
|
|
95
|
+
*/
|
|
96
|
+
export const MenuListItem = ({
|
|
97
|
+
label,
|
|
98
|
+
icon: Icon,
|
|
99
|
+
appearance = 'base',
|
|
100
|
+
disabled: disabledProp = false,
|
|
101
|
+
onPress,
|
|
102
|
+
accessibilityState,
|
|
103
|
+
lx,
|
|
104
|
+
style,
|
|
105
|
+
ref,
|
|
106
|
+
...props
|
|
107
|
+
}: MenuListItemProps) => {
|
|
108
|
+
const disabled = useDisabledContext({
|
|
109
|
+
consumerName: 'MenuListItem',
|
|
110
|
+
mergeWith: { disabled: disabledProp },
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Pressable
|
|
115
|
+
ref={ref}
|
|
116
|
+
lx={lx}
|
|
117
|
+
style={style}
|
|
118
|
+
onPress={onPress}
|
|
119
|
+
disabled={disabled}
|
|
120
|
+
accessibilityRole='button'
|
|
121
|
+
accessibilityState={{ ...accessibilityState, disabled }}
|
|
122
|
+
{...props}
|
|
123
|
+
>
|
|
124
|
+
{({ pressed }) => (
|
|
125
|
+
<MenuListItemInner
|
|
126
|
+
label={label}
|
|
127
|
+
icon={Icon}
|
|
128
|
+
appearance={appearance}
|
|
129
|
+
pressed={pressed}
|
|
130
|
+
disabled={disabled}
|
|
131
|
+
/>
|
|
132
|
+
)}
|
|
133
|
+
</Pressable>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const MenuListItemInner = ({
|
|
138
|
+
label,
|
|
139
|
+
icon: Icon,
|
|
140
|
+
appearance,
|
|
141
|
+
pressed,
|
|
142
|
+
disabled,
|
|
143
|
+
}: {
|
|
144
|
+
label: string;
|
|
145
|
+
icon: MenuListItemProps['icon'];
|
|
146
|
+
appearance: MenuListItemAppearance;
|
|
147
|
+
pressed: boolean;
|
|
148
|
+
disabled: boolean;
|
|
149
|
+
}) => {
|
|
150
|
+
const styles = useItemStyles({ pressed, disabled, appearance });
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<Box style={styles.container}>
|
|
154
|
+
{Icon && (
|
|
155
|
+
<Icon size={24} color={resolveContentColor(disabled, appearance)} />
|
|
156
|
+
)}
|
|
157
|
+
<Text style={styles.label} numberOfLines={1}>
|
|
158
|
+
{label}
|
|
159
|
+
</Text>
|
|
160
|
+
</Box>
|
|
161
|
+
);
|
|
162
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
LumenTextStyle,
|
|
4
|
+
StyledPressableProps,
|
|
5
|
+
StyledViewProps,
|
|
6
|
+
} from '../../../../styles';
|
|
7
|
+
import type { IconSize } from '../../symbols/Icon';
|
|
8
|
+
|
|
9
|
+
export type IconComponent = ComponentType<{
|
|
10
|
+
size?: IconSize;
|
|
11
|
+
color?: LumenTextStyle['color'];
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export type MenuListItemAppearance = 'base' | 'red';
|
|
15
|
+
|
|
16
|
+
export type MenuListProps = {
|
|
17
|
+
/**
|
|
18
|
+
* The `MenuListItem`s that make up the menu.
|
|
19
|
+
*/
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
22
|
+
|
|
23
|
+
export type MenuListItemProps = {
|
|
24
|
+
/**
|
|
25
|
+
* Text describing the action, truncated to a single line.
|
|
26
|
+
*/
|
|
27
|
+
label: string;
|
|
28
|
+
/**
|
|
29
|
+
* Icon rendered before the label.
|
|
30
|
+
*/
|
|
31
|
+
icon?: IconComponent;
|
|
32
|
+
/**
|
|
33
|
+
* Visual treatment of the label and icon. Use `red` for irreversible or
|
|
34
|
+
* dangerous actions.
|
|
35
|
+
*
|
|
36
|
+
* @default 'base'
|
|
37
|
+
*/
|
|
38
|
+
appearance?: MenuListItemAppearance;
|
|
39
|
+
/**
|
|
40
|
+
* Prevents interaction and dims the content.
|
|
41
|
+
*
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Action to run when the item is pressed.
|
|
47
|
+
*/
|
|
48
|
+
onPress?: StyledPressableProps['onPress'];
|
|
49
|
+
} & Omit<StyledPressableProps, 'children' | 'onPress'>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import figma from '@figma/code-connect';
|
|
2
|
+
import {
|
|
3
|
+
SelectList,
|
|
4
|
+
SelectListContent,
|
|
5
|
+
SelectListEmptyState,
|
|
6
|
+
SelectListItem,
|
|
7
|
+
SelectListItemContent,
|
|
8
|
+
SelectListItemDescription,
|
|
9
|
+
SelectListItemText,
|
|
10
|
+
} from './SelectList';
|
|
11
|
+
|
|
12
|
+
figma.connect(
|
|
13
|
+
SelectList,
|
|
14
|
+
'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=15941-6709',
|
|
15
|
+
{
|
|
16
|
+
imports: [
|
|
17
|
+
"import { SelectList, SelectListContent, SelectListItem, SelectListItemContent, SelectListItemText, SelectListItemDescription, SelectListEmptyState } from '@ledgerhq/lumen-ui-rnative'",
|
|
18
|
+
],
|
|
19
|
+
example: () => (
|
|
20
|
+
<SelectList items={[]} value={''} onValueChange={() => {}}>
|
|
21
|
+
<SelectListContent
|
|
22
|
+
renderItem={(item) => (
|
|
23
|
+
<SelectListItem value={item.value}>
|
|
24
|
+
<SelectListItemContent>
|
|
25
|
+
<SelectListItemText>{item.label}</SelectListItemText>
|
|
26
|
+
<SelectListItemDescription>
|
|
27
|
+
{item.description}
|
|
28
|
+
</SelectListItemDescription>
|
|
29
|
+
</SelectListItemContent>
|
|
30
|
+
</SelectListItem>
|
|
31
|
+
)}
|
|
32
|
+
/>
|
|
33
|
+
<SelectListEmptyState title='No options available' />
|
|
34
|
+
</SelectList>
|
|
35
|
+
),
|
|
36
|
+
},
|
|
37
|
+
);
|