@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
|
@@ -13,29 +13,29 @@ import { Divider } from '../Divider';
|
|
|
13
13
|
import { SearchInput } from '../SearchInput';
|
|
14
14
|
import type {
|
|
15
15
|
MetaShape,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
SelectListContextValue,
|
|
17
|
+
SelectListItemData,
|
|
18
|
+
SelectListProps,
|
|
19
|
+
SelectListContentProps,
|
|
20
|
+
SelectListItemProps,
|
|
21
|
+
SelectListItemLeadingProps,
|
|
22
|
+
SelectListItemTextProps,
|
|
23
|
+
SelectListItemDescriptionProps,
|
|
24
|
+
SelectListItemContentProps,
|
|
25
|
+
SelectListItemContentRowProps,
|
|
26
|
+
SelectListEmptyStateProps,
|
|
27
|
+
SelectListSearchProps,
|
|
28
|
+
SelectListTriggerProps,
|
|
29
|
+
SelectListLabelProps,
|
|
30
|
+
SelectListValue,
|
|
31
31
|
} from './types';
|
|
32
|
-
import {
|
|
32
|
+
import { useSelectListItems } from './useSelectList/useSelectListItems';
|
|
33
33
|
|
|
34
|
-
const [
|
|
35
|
-
createSafeContext<
|
|
34
|
+
const [SelectListProvider, useSelectListContext] =
|
|
35
|
+
createSafeContext<SelectListContextValue>('SelectList');
|
|
36
36
|
|
|
37
|
-
export const
|
|
38
|
-
T extends
|
|
37
|
+
export const SelectList = <
|
|
38
|
+
T extends SelectListValue = SelectListValue,
|
|
39
39
|
TMeta extends MetaShape = MetaShape,
|
|
40
40
|
>({
|
|
41
41
|
items,
|
|
@@ -49,9 +49,9 @@ export const OptionList = <
|
|
|
49
49
|
defaultSearchValue,
|
|
50
50
|
onSearchValueChange,
|
|
51
51
|
children,
|
|
52
|
-
}:
|
|
52
|
+
}: SelectListProps<T, TMeta>) => {
|
|
53
53
|
const disabled = useDisabledContext({
|
|
54
|
-
consumerName: '
|
|
54
|
+
consumerName: 'SelectList',
|
|
55
55
|
mergeWith: { disabled: disabledProp },
|
|
56
56
|
});
|
|
57
57
|
|
|
@@ -69,7 +69,7 @@ export const OptionList = <
|
|
|
69
69
|
flatItems,
|
|
70
70
|
resolvedSearchValue,
|
|
71
71
|
handleSearchValueChange,
|
|
72
|
-
} =
|
|
72
|
+
} = useSelectListItems<T, TMeta>({
|
|
73
73
|
items,
|
|
74
74
|
filter,
|
|
75
75
|
filteredItems,
|
|
@@ -80,7 +80,7 @@ export const OptionList = <
|
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
82
|
<DisabledProvider value={{ disabled }}>
|
|
83
|
-
<
|
|
83
|
+
<SelectListProvider
|
|
84
84
|
value={{
|
|
85
85
|
selectedValue,
|
|
86
86
|
onValueChange: setSelectedValue,
|
|
@@ -92,13 +92,13 @@ export const OptionList = <
|
|
|
92
92
|
}}
|
|
93
93
|
>
|
|
94
94
|
{children}
|
|
95
|
-
</
|
|
95
|
+
</SelectListProvider>
|
|
96
96
|
</DisabledProvider>
|
|
97
97
|
);
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
-
export const
|
|
101
|
-
T extends
|
|
100
|
+
export const SelectListContent = <
|
|
101
|
+
T extends SelectListValue = SelectListValue,
|
|
102
102
|
TMeta extends MetaShape = MetaShape,
|
|
103
103
|
>({
|
|
104
104
|
renderItem,
|
|
@@ -106,15 +106,15 @@ export const OptionListContent = <
|
|
|
106
106
|
style,
|
|
107
107
|
ref,
|
|
108
108
|
...props
|
|
109
|
-
}:
|
|
110
|
-
const { selectedValue, isGrouped, groups, flatItems } =
|
|
111
|
-
consumerName: '
|
|
109
|
+
}: SelectListContentProps<T, TMeta>) => {
|
|
110
|
+
const { selectedValue, isGrouped, groups, flatItems } = useSelectListContext({
|
|
111
|
+
consumerName: 'SelectListContent',
|
|
112
112
|
contextRequired: true,
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
const renderItemWithState = (item:
|
|
115
|
+
const renderItemWithState = (item: SelectListItemData) =>
|
|
116
116
|
renderItem(
|
|
117
|
-
item as
|
|
117
|
+
item as SelectListItemData<T, TMeta>,
|
|
118
118
|
selectedValue === item.value,
|
|
119
119
|
);
|
|
120
120
|
|
|
@@ -126,7 +126,7 @@ export const OptionListContent = <
|
|
|
126
126
|
{groupIndex > 0 && (
|
|
127
127
|
<Divider lx={{ marginVertical: 's4', marginHorizontal: 's8' }} />
|
|
128
128
|
)}
|
|
129
|
-
{group.label && <
|
|
129
|
+
{group.label && <SelectListLabel>{group.label}</SelectListLabel>}
|
|
130
130
|
{group.items.map((item) => (
|
|
131
131
|
<Fragment key={item.value}>{renderItemWithState(item)}</Fragment>
|
|
132
132
|
))}
|
|
@@ -171,7 +171,7 @@ const useItemStyles = ({
|
|
|
171
171
|
);
|
|
172
172
|
};
|
|
173
173
|
|
|
174
|
-
export const
|
|
174
|
+
export const SelectListItem = <T extends SelectListValue = SelectListValue>({
|
|
175
175
|
value,
|
|
176
176
|
disabled: disabledProp = false,
|
|
177
177
|
children,
|
|
@@ -179,13 +179,13 @@ export const OptionListItem = <T extends OptionListValue = OptionListValue>({
|
|
|
179
179
|
style,
|
|
180
180
|
ref,
|
|
181
181
|
...props
|
|
182
|
-
}:
|
|
183
|
-
const { selectedValue, onValueChange } =
|
|
184
|
-
consumerName: '
|
|
182
|
+
}: SelectListItemProps<T>) => {
|
|
183
|
+
const { selectedValue, onValueChange } = useSelectListContext({
|
|
184
|
+
consumerName: 'SelectListItem',
|
|
185
185
|
contextRequired: true,
|
|
186
186
|
});
|
|
187
187
|
const disabled = useDisabledContext({
|
|
188
|
-
consumerName: '
|
|
188
|
+
consumerName: 'SelectListItem',
|
|
189
189
|
mergeWith: { disabled: disabledProp },
|
|
190
190
|
});
|
|
191
191
|
const selected = selectedValue === value;
|
|
@@ -203,16 +203,16 @@ export const OptionListItem = <T extends OptionListValue = OptionListValue>({
|
|
|
203
203
|
{...props}
|
|
204
204
|
>
|
|
205
205
|
{({ pressed }) => (
|
|
206
|
-
<
|
|
206
|
+
<SelectListItemInner pressed={pressed} selected={selected}>
|
|
207
207
|
{children}
|
|
208
|
-
</
|
|
208
|
+
</SelectListItemInner>
|
|
209
209
|
)}
|
|
210
210
|
</Pressable>
|
|
211
211
|
</DisabledProvider>
|
|
212
212
|
);
|
|
213
213
|
};
|
|
214
214
|
|
|
215
|
-
const
|
|
215
|
+
const SelectListItemInner = ({
|
|
216
216
|
pressed,
|
|
217
217
|
selected,
|
|
218
218
|
children,
|
|
@@ -222,7 +222,7 @@ const OptionListItemInner = ({
|
|
|
222
222
|
children: ReactNode;
|
|
223
223
|
}) => {
|
|
224
224
|
const disabled = useDisabledContext({
|
|
225
|
-
consumerName: '
|
|
225
|
+
consumerName: 'SelectListItemInner',
|
|
226
226
|
contextRequired: false,
|
|
227
227
|
});
|
|
228
228
|
const styles = useItemStyles({ disabled, pressed });
|
|
@@ -235,15 +235,15 @@ const OptionListItemInner = ({
|
|
|
235
235
|
);
|
|
236
236
|
};
|
|
237
237
|
|
|
238
|
-
export const
|
|
238
|
+
export const SelectListItemText = ({
|
|
239
239
|
children,
|
|
240
240
|
lx,
|
|
241
241
|
style,
|
|
242
242
|
ref,
|
|
243
243
|
...props
|
|
244
|
-
}:
|
|
244
|
+
}: SelectListItemTextProps) => {
|
|
245
245
|
const disabled = useDisabledContext({
|
|
246
|
-
consumerName: '
|
|
246
|
+
consumerName: 'SelectListItemText',
|
|
247
247
|
contextRequired: false,
|
|
248
248
|
});
|
|
249
249
|
|
|
@@ -272,15 +272,15 @@ export const OptionListItemText = ({
|
|
|
272
272
|
);
|
|
273
273
|
};
|
|
274
274
|
|
|
275
|
-
export const
|
|
275
|
+
export const SelectListItemDescription = ({
|
|
276
276
|
children,
|
|
277
277
|
lx,
|
|
278
278
|
style,
|
|
279
279
|
ref,
|
|
280
280
|
...props
|
|
281
|
-
}:
|
|
281
|
+
}: SelectListItemDescriptionProps) => {
|
|
282
282
|
const disabled = useDisabledContext({
|
|
283
|
-
consumerName: '
|
|
283
|
+
consumerName: 'SelectListItemDescription',
|
|
284
284
|
contextRequired: false,
|
|
285
285
|
});
|
|
286
286
|
|
|
@@ -309,13 +309,13 @@ export const OptionListItemDescription = ({
|
|
|
309
309
|
);
|
|
310
310
|
};
|
|
311
311
|
|
|
312
|
-
export const
|
|
312
|
+
export const SelectListItemContent = ({
|
|
313
313
|
children,
|
|
314
314
|
lx,
|
|
315
315
|
style,
|
|
316
316
|
ref,
|
|
317
317
|
...props
|
|
318
|
-
}:
|
|
318
|
+
}: SelectListItemContentProps) => {
|
|
319
319
|
const styles = useStyleSheet(
|
|
320
320
|
(t) => ({
|
|
321
321
|
content: {
|
|
@@ -339,13 +339,13 @@ export const OptionListItemContent = ({
|
|
|
339
339
|
);
|
|
340
340
|
};
|
|
341
341
|
|
|
342
|
-
export const
|
|
342
|
+
export const SelectListItemContentRow = ({
|
|
343
343
|
children,
|
|
344
344
|
lx,
|
|
345
345
|
style,
|
|
346
346
|
ref,
|
|
347
347
|
...props
|
|
348
|
-
}:
|
|
348
|
+
}: SelectListItemContentRowProps) => {
|
|
349
349
|
const styles = useStyleSheet(
|
|
350
350
|
(t) => ({
|
|
351
351
|
row: {
|
|
@@ -370,13 +370,13 @@ export const OptionListItemContentRow = ({
|
|
|
370
370
|
);
|
|
371
371
|
};
|
|
372
372
|
|
|
373
|
-
export const
|
|
373
|
+
export const SelectListItemLeading = ({
|
|
374
374
|
children,
|
|
375
375
|
lx,
|
|
376
376
|
style,
|
|
377
377
|
ref,
|
|
378
378
|
...props
|
|
379
|
-
}:
|
|
379
|
+
}: SelectListItemLeadingProps) => {
|
|
380
380
|
const styles = useStyleSheet(
|
|
381
381
|
() => ({
|
|
382
382
|
leading: {
|
|
@@ -400,7 +400,7 @@ export const OptionListItemLeading = ({
|
|
|
400
400
|
);
|
|
401
401
|
};
|
|
402
402
|
|
|
403
|
-
const
|
|
403
|
+
const SelectListLabel = ({ children }: SelectListLabelProps) => (
|
|
404
404
|
<Text
|
|
405
405
|
lx={{
|
|
406
406
|
color: 'muted',
|
|
@@ -413,10 +413,10 @@ const OptionListLabel = ({ children }: OptionListLabelProps) => (
|
|
|
413
413
|
</Text>
|
|
414
414
|
);
|
|
415
415
|
|
|
416
|
-
export const
|
|
417
|
-
const { resolvedSearchValue, handleSearchValueChange } =
|
|
416
|
+
export const SelectListSearch = ({ ref, ...props }: SelectListSearchProps) => {
|
|
417
|
+
const { resolvedSearchValue, handleSearchValueChange } = useSelectListContext(
|
|
418
418
|
{
|
|
419
|
-
consumerName: '
|
|
419
|
+
consumerName: 'SelectListSearch',
|
|
420
420
|
contextRequired: true,
|
|
421
421
|
},
|
|
422
422
|
);
|
|
@@ -432,16 +432,16 @@ export const OptionListSearch = ({ ref, ...props }: OptionListSearchProps) => {
|
|
|
432
432
|
);
|
|
433
433
|
};
|
|
434
434
|
|
|
435
|
-
export const
|
|
435
|
+
export const SelectListEmptyState = ({
|
|
436
436
|
title,
|
|
437
437
|
description,
|
|
438
438
|
lx,
|
|
439
439
|
style,
|
|
440
440
|
ref,
|
|
441
441
|
...props
|
|
442
|
-
}:
|
|
443
|
-
const { isGrouped, groups, flatItems } =
|
|
444
|
-
consumerName: '
|
|
442
|
+
}: SelectListEmptyStateProps) => {
|
|
443
|
+
const { isGrouped, groups, flatItems } = useSelectListContext({
|
|
444
|
+
consumerName: 'SelectListEmptyState',
|
|
445
445
|
contextRequired: true,
|
|
446
446
|
});
|
|
447
447
|
const visibleCount = isGrouped
|
|
@@ -544,7 +544,7 @@ const useTriggerStyles = ({
|
|
|
544
544
|
[disabled, hasValue, hasLabel],
|
|
545
545
|
);
|
|
546
546
|
|
|
547
|
-
export const
|
|
547
|
+
export const SelectListTrigger = ({
|
|
548
548
|
label,
|
|
549
549
|
onPress,
|
|
550
550
|
disabled: disabledProp,
|
|
@@ -553,9 +553,9 @@ export const OptionListTrigger = ({
|
|
|
553
553
|
style,
|
|
554
554
|
ref,
|
|
555
555
|
...props
|
|
556
|
-
}:
|
|
556
|
+
}: SelectListTriggerProps) => {
|
|
557
557
|
const disabled = useDisabledContext({
|
|
558
|
-
consumerName: '
|
|
558
|
+
consumerName: 'SelectListTrigger',
|
|
559
559
|
mergeWith: { disabled: disabledProp },
|
|
560
560
|
});
|
|
561
561
|
|
|
@@ -587,39 +587,39 @@ export const OptionListTrigger = ({
|
|
|
587
587
|
);
|
|
588
588
|
};
|
|
589
589
|
|
|
590
|
-
export function
|
|
591
|
-
T extends
|
|
590
|
+
export function createSelectList<
|
|
591
|
+
T extends SelectListValue = never,
|
|
592
592
|
TMeta extends MetaShape = MetaShape,
|
|
593
593
|
>(): {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
props:
|
|
594
|
+
SelectList: (props: SelectListProps<T, TMeta>) => ReactElement;
|
|
595
|
+
SelectListContent: (props: SelectListContentProps<T, TMeta>) => ReactElement;
|
|
596
|
+
SelectListItem: (props: SelectListItemProps<T>) => ReactElement;
|
|
597
|
+
SelectListItemText: (props: SelectListItemTextProps) => ReactElement;
|
|
598
|
+
SelectListItemDescription: (
|
|
599
|
+
props: SelectListItemDescriptionProps,
|
|
600
600
|
) => ReactElement;
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
props:
|
|
601
|
+
SelectListItemContent: (props: SelectListItemContentProps) => ReactElement;
|
|
602
|
+
SelectListItemContentRow: (
|
|
603
|
+
props: SelectListItemContentRowProps,
|
|
604
604
|
) => ReactElement;
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
props:
|
|
605
|
+
SelectListItemLeading: (props: SelectListItemLeadingProps) => ReactElement;
|
|
606
|
+
SelectListSearch: (props: SelectListSearchProps) => ReactElement;
|
|
607
|
+
SelectListEmptyState: (
|
|
608
|
+
props: SelectListEmptyStateProps,
|
|
609
609
|
) => ReactElement | null;
|
|
610
|
-
|
|
610
|
+
SelectListTrigger: (props: SelectListTriggerProps) => ReactElement;
|
|
611
611
|
} {
|
|
612
612
|
return {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
613
|
+
SelectList,
|
|
614
|
+
SelectListContent,
|
|
615
|
+
SelectListItem,
|
|
616
|
+
SelectListItemText,
|
|
617
|
+
SelectListItemDescription,
|
|
618
|
+
SelectListItemContent,
|
|
619
|
+
SelectListItemContentRow,
|
|
620
|
+
SelectListItemLeading,
|
|
621
|
+
SelectListSearch,
|
|
622
|
+
SelectListEmptyState,
|
|
623
|
+
SelectListTrigger,
|
|
624
624
|
};
|
|
625
625
|
}
|
|
@@ -8,10 +8,10 @@ import type { SearchInputProps } from '../SearchInput';
|
|
|
8
8
|
|
|
9
9
|
export type MetaShape = Record<string, unknown>;
|
|
10
10
|
|
|
11
|
-
export type
|
|
11
|
+
export type SelectListValue = string;
|
|
12
12
|
|
|
13
|
-
export type
|
|
14
|
-
T extends
|
|
13
|
+
export type SelectListItemData<
|
|
14
|
+
T extends SelectListValue = SelectListValue,
|
|
15
15
|
TMeta extends MetaShape = MetaShape,
|
|
16
16
|
> = {
|
|
17
17
|
/** Unique string identifier for this item, used for selection tracking. */
|
|
@@ -37,34 +37,34 @@ export type OptionListItemData<
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
/** Internal type -- used by sub-components to read shared state from context. */
|
|
40
|
-
export type
|
|
40
|
+
export type SelectListContextValue = {
|
|
41
41
|
selectedValue: string | null;
|
|
42
42
|
onValueChange: (value: string | null) => void;
|
|
43
43
|
isGrouped: boolean;
|
|
44
|
-
groups:
|
|
45
|
-
flatItems:
|
|
44
|
+
groups: SelectListItemGroup[];
|
|
45
|
+
flatItems: SelectListItemData[];
|
|
46
46
|
resolvedSearchValue: string;
|
|
47
47
|
handleSearchValueChange: (value: string) => void;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
/** Internal type -- consumers never construct this directly. */
|
|
51
|
-
export type
|
|
52
|
-
T extends
|
|
51
|
+
export type SelectListItemGroup<
|
|
52
|
+
T extends SelectListValue = SelectListValue,
|
|
53
53
|
TMeta extends MetaShape = MetaShape,
|
|
54
54
|
> = {
|
|
55
55
|
label: string;
|
|
56
|
-
items:
|
|
56
|
+
items: SelectListItemData<T, TMeta>[];
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
export type
|
|
60
|
-
T extends
|
|
59
|
+
export type SelectListProps<
|
|
60
|
+
T extends SelectListValue = SelectListValue,
|
|
61
61
|
TMeta extends MetaShape = MetaShape,
|
|
62
62
|
> = {
|
|
63
63
|
/**
|
|
64
64
|
* Flat array of items.
|
|
65
65
|
* Use the `group` field on each item for automatic grouping.
|
|
66
66
|
*/
|
|
67
|
-
items:
|
|
67
|
+
items: SelectListItemData<T, TMeta>[];
|
|
68
68
|
/**
|
|
69
69
|
* The controlled selected value.
|
|
70
70
|
*/
|
|
@@ -87,12 +87,12 @@ export type OptionListProps<
|
|
|
87
87
|
*/
|
|
88
88
|
filter?:
|
|
89
89
|
| null
|
|
90
|
-
| ((item:
|
|
90
|
+
| ((item: SelectListItemData<T, TMeta>, query: string) => boolean);
|
|
91
91
|
/**
|
|
92
92
|
* Pre-filtered items for async/remote search.
|
|
93
93
|
* Bypasses internal filtering.
|
|
94
94
|
*/
|
|
95
|
-
filteredItems?:
|
|
95
|
+
filteredItems?: SelectListItemData<T, TMeta>[];
|
|
96
96
|
/**
|
|
97
97
|
* Controlled search input value.
|
|
98
98
|
*/
|
|
@@ -108,18 +108,18 @@ export type OptionListProps<
|
|
|
108
108
|
children: ReactNode;
|
|
109
109
|
};
|
|
110
110
|
|
|
111
|
-
export type
|
|
112
|
-
T extends
|
|
111
|
+
export type SelectListContentProps<
|
|
112
|
+
T extends SelectListValue = SelectListValue,
|
|
113
113
|
TMeta extends MetaShape = MetaShape,
|
|
114
114
|
> = {
|
|
115
115
|
/** Render function called for each item. Receives the item data and selection/disabled state. */
|
|
116
116
|
renderItem: (
|
|
117
|
-
item:
|
|
117
|
+
item: SelectListItemData<T, TMeta>,
|
|
118
118
|
selected: boolean,
|
|
119
119
|
) => ReactNode;
|
|
120
120
|
} & Omit<StyledViewProps, 'children'>;
|
|
121
121
|
|
|
122
|
-
export type
|
|
122
|
+
export type SelectListItemProps<T extends SelectListValue = SelectListValue> = {
|
|
123
123
|
/** The value associated with this item, used for selection matching. */
|
|
124
124
|
value: T;
|
|
125
125
|
/** Whether the item is disabled. */
|
|
@@ -127,49 +127,49 @@ export type OptionListItemProps<T extends OptionListValue = OptionListValue> = {
|
|
|
127
127
|
children: ReactNode;
|
|
128
128
|
} & Omit<StyledPressableProps, 'children' | 'disabled'>;
|
|
129
129
|
|
|
130
|
-
export type
|
|
130
|
+
export type SelectListItemTextProps = {
|
|
131
131
|
children: ReactNode;
|
|
132
132
|
} & Omit<StyledTextProps, 'children'>;
|
|
133
133
|
|
|
134
|
-
export type
|
|
134
|
+
export type SelectListItemDescriptionProps = {
|
|
135
135
|
children: ReactNode;
|
|
136
136
|
} & Omit<StyledTextProps, 'children'>;
|
|
137
137
|
|
|
138
|
-
export type
|
|
138
|
+
export type SelectListItemContentRowProps = {
|
|
139
139
|
children: ReactNode;
|
|
140
140
|
} & Omit<StyledViewProps, 'children'>;
|
|
141
141
|
|
|
142
|
-
export type
|
|
142
|
+
export type SelectListItemContentProps = {
|
|
143
143
|
children: ReactNode;
|
|
144
144
|
} & Omit<StyledViewProps, 'children'>;
|
|
145
145
|
|
|
146
|
-
export type
|
|
146
|
+
export type SelectListItemLeadingProps = {
|
|
147
147
|
children: ReactNode;
|
|
148
148
|
} & Omit<StyledViewProps, 'children'>;
|
|
149
149
|
|
|
150
|
-
export type
|
|
150
|
+
export type SelectListLabelProps = {
|
|
151
151
|
children: ReactNode;
|
|
152
152
|
} & Omit<StyledTextProps, 'children'>;
|
|
153
153
|
|
|
154
|
-
export type
|
|
154
|
+
export type SelectListEmptyStateProps = {
|
|
155
155
|
/** Heading displayed when the list is empty. */
|
|
156
156
|
title: string;
|
|
157
157
|
/** Optional secondary text displayed below the title. */
|
|
158
158
|
description?: string;
|
|
159
159
|
} & Omit<StyledViewProps, 'children'>;
|
|
160
160
|
|
|
161
|
-
export type
|
|
161
|
+
export type SelectListSearchProps = Omit<
|
|
162
162
|
SearchInputProps,
|
|
163
163
|
'value' | 'onChangeText' | 'defaultValue'
|
|
164
164
|
>;
|
|
165
165
|
|
|
166
|
-
export type
|
|
166
|
+
export type SelectListTriggerProps = {
|
|
167
167
|
/** Floating label shown above the selected value. */
|
|
168
168
|
label?: string;
|
|
169
169
|
/** Called when the trigger is pressed. Use to open a BottomSheet or navigate. */
|
|
170
170
|
onPress: () => void;
|
|
171
171
|
/** Content to display as the selected value. */
|
|
172
172
|
children?: ReactNode;
|
|
173
|
-
/** Whether the trigger is disabled. Merges with
|
|
173
|
+
/** Whether the trigger is disabled. Merges with SelectList disabled context. */
|
|
174
174
|
disabled?: boolean;
|
|
175
175
|
} & Omit<StyledPressableProps, 'children' | 'disabled' | 'onPress'>;
|