@ledgerhq/lumen-ui-rnative 0.1.34 → 0.1.35
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/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/Animations/Pulse/Pulse.js +17 -7
- package/dist/module/lib/Animations/Pulse/Pulse.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js +12 -7
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js +220 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js +73 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheetHeader.js +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheetHeader.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/CustomHandle.js +15 -2
- package/dist/module/lib/Components/BottomSheet/CustomHandle.js.map +1 -1
- package/dist/module/lib/Components/Card/Card.js.map +1 -1
- package/dist/module/lib/Components/ListItem/ListItem.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.js +5 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.js +45 -4
- package/dist/module/lib/Components/OptionList/OptionList.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.mdx +19 -0
- package/dist/module/lib/Components/OptionList/OptionList.stories.js +254 -1
- package/dist/module/lib/Components/OptionList/OptionList.stories.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.test.js +136 -1
- package/dist/module/lib/Components/OptionList/OptionList.test.js.map +1 -1
- package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.js +39 -13
- package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.js.map +1 -1
- package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.test.js +117 -2
- package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.test.js.map +1 -1
- package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js.map +1 -1
- package/dist/module/lib/Components/Skeleton/Skeleton.js +10 -3
- package/dist/module/lib/Components/Skeleton/Skeleton.js.map +1 -1
- package/dist/module/lib/Components/TabBar/TabBar.js +7 -6
- package/dist/module/lib/Components/TabBar/TabBar.js.map +1 -1
- package/dist/module/styles/lx/resolveStyle.js.map +1 -1
- package/dist/typescript/src/index.d.ts +1 -0
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Animations/Pulse/Pulse.d.ts +1 -1
- package/dist/typescript/src/lib/Animations/Pulse/Pulse.d.ts.map +1 -1
- package/dist/typescript/src/lib/Animations/Pulse/types.d.ts +2 -1
- package/dist/typescript/src/lib/Animations/Pulse/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/CustomHandle.d.ts +5 -2
- package/dist/typescript/src/lib/Components/BottomSheet/CustomHandle.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts +16 -3
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Card/Card.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts +3 -3
- package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/OptionList/OptionList.d.ts +3 -2
- package/dist/typescript/src/lib/Components/OptionList/OptionList.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/OptionList/types.d.ts +42 -5
- package/dist/typescript/src/lib/Components/OptionList/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/OptionList/useOptionList/useOptionListItems.d.ts +9 -1
- package/dist/typescript/src/lib/Components/OptionList/useOptionList/useOptionListItems.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/TabBar/TabBar.d.ts.map +1 -1
- package/dist/typescript/src/lib/types/index.d.ts +3 -3
- package/dist/typescript/src/lib/types/index.d.ts.map +1 -1
- package/dist/typescript/src/styles/lx/resolveStyle.d.ts +3 -3
- package/dist/typescript/src/styles/lx/resolveStyle.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/lib/Animations/Pulse/Pulse.tsx +34 -29
- package/src/lib/Animations/Pulse/types.ts +2 -1
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +174 -1
- package/src/lib/Components/BottomSheet/BottomSheet.test.tsx +59 -0
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +19 -7
- package/src/lib/Components/BottomSheet/BottomSheetHeader.tsx +1 -1
- package/src/lib/Components/BottomSheet/CustomHandle.tsx +26 -5
- package/src/lib/Components/BottomSheet/types.ts +24 -3
- package/src/lib/Components/Card/Card.tsx +3 -3
- package/src/lib/Components/ListItem/ListItem.tsx +3 -3
- package/src/lib/Components/MediaImage/MediaImage.tsx +5 -1
- package/src/lib/Components/OptionList/OptionList.mdx +19 -0
- package/src/lib/Components/OptionList/OptionList.stories.tsx +254 -0
- package/src/lib/Components/OptionList/OptionList.test.tsx +143 -0
- package/src/lib/Components/OptionList/OptionList.tsx +49 -3
- package/src/lib/Components/OptionList/types.ts +46 -5
- package/src/lib/Components/OptionList/useOptionList/useOptionListItems.test.ts +124 -2
- package/src/lib/Components/OptionList/useOptionList/useOptionListItems.ts +53 -10
- package/src/lib/Components/PageIndicator/PageIndicator.test.tsx +2 -1
- package/src/lib/Components/Skeleton/Skeleton.tsx +9 -5
- package/src/lib/Components/TabBar/TabBar.tsx +3 -2
- package/src/lib/types/index.ts +3 -3
- package/src/styles/lx/resolveStyle.ts +4 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentRef, Ref } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { Text } from '../Utility';
|
|
4
4
|
import type { ListItemContentProps, ListItemContentRowProps, ListItemDescriptionProps, ListItemLeadingProps, ListItemProps, ListItemTitleProps, ListItemTrailingProps } from './types';
|
|
@@ -62,14 +62,14 @@ export declare const ListItemContentRow: ({ children, lx, style, ref, ...props }
|
|
|
62
62
|
* The main title of the list item.
|
|
63
63
|
*/
|
|
64
64
|
export declare const ListItemTitle: ({ children, lx, style, ref, ...props }: ListItemTitleProps & {
|
|
65
|
-
ref?: Ref<
|
|
65
|
+
ref?: Ref<ComponentRef<typeof Text>>;
|
|
66
66
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
67
67
|
/**
|
|
68
68
|
* Optional description text below the title.
|
|
69
69
|
* Automatically applies disabled styling when the parent ListItem is disabled.
|
|
70
70
|
*/
|
|
71
71
|
export declare const ListItemDescription: ({ children, lx, style, ref, ...props }: ListItemDescriptionProps & {
|
|
72
|
-
ref?: Ref<
|
|
72
|
+
ref?: Ref<ComponentRef<typeof Text>>;
|
|
73
73
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
74
74
|
/**
|
|
75
75
|
* Container for the trailing (right) content of the list item.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/ListItem/ListItem.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/ListItem/ListItem.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAa,G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AAE,GAAG,CAAC,IAAI,CAAC,CAAA;CAAE,4CAuB7C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaImage.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaImage/MediaImage.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAC;AAgBhF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAUtD,CAAC;
|
|
1
|
+
{"version":3,"file":"MediaImage.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaImage/MediaImage.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAC;AAgBhF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAUtD,CAAC;AA6CF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,GAAI,wEAWxB,eAAe,4CA0CjB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MetaShape, OptionListProps, OptionListContentProps, OptionListItemProps, OptionListItemLeadingProps, OptionListItemTextProps, OptionListItemDescriptionProps, OptionListItemContentProps, OptionListItemContentRowProps, OptionListEmptyStateProps, OptionListTriggerProps } from './types';
|
|
2
|
-
export declare const OptionList: <TMeta extends MetaShape = MetaShape>({ items, value, defaultValue, onValueChange, disabled: disabledProp, children, }: OptionListProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
import type { MetaShape, OptionListProps, OptionListContentProps, OptionListItemProps, OptionListItemLeadingProps, OptionListItemTextProps, OptionListItemDescriptionProps, OptionListItemContentProps, OptionListItemContentRowProps, OptionListEmptyStateProps, OptionListSearchProps, OptionListTriggerProps } from './types';
|
|
2
|
+
export declare const OptionList: <TMeta extends MetaShape = MetaShape>({ items, value, defaultValue, onValueChange, disabled: disabledProp, filter, filteredItems, searchValue, defaultSearchValue, onSearchValueChange, children, }: OptionListProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare const OptionListContent: <TMeta extends MetaShape = MetaShape>({ renderItem, lx, style, ref, ...props }: OptionListContentProps<TMeta>) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare const OptionListItem: ({ value, disabled: disabledProp, children, lx, style, ref, ...props }: OptionListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare const OptionListItemText: ({ children, lx, style, ref, ...props }: OptionListItemTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,6 +7,7 @@ export declare const OptionListItemDescription: ({ children, lx, style, ref, ...
|
|
|
7
7
|
export declare const OptionListItemContent: ({ children, lx, style, ref, ...props }: OptionListItemContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export declare const OptionListItemContentRow: ({ children, lx, style, ref, ...props }: OptionListItemContentRowProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export declare const OptionListItemLeading: ({ children, lx, style, ref, ...props }: OptionListItemLeadingProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const OptionListSearch: ({ ref, ...props }: OptionListSearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export declare const OptionListEmptyState: ({ title, description, lx, style, ref, ...props }: OptionListEmptyStateProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
11
12
|
export declare const OptionListTrigger: ({ label, onPress, disabled: disabledProp, children, lx, style, ref, ...props }: OptionListTriggerProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
//# sourceMappingURL=OptionList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionList.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/OptionList/OptionList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OptionList.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/OptionList/OptionList.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,SAAS,EAGT,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,EACvB,8BAA8B,EAC9B,0BAA0B,EAC1B,6BAA6B,EAC7B,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAMjB,eAAO,MAAM,UAAU,GAAI,KAAK,SAAS,SAAS,GAAG,SAAS,EAAE,+JAY7D,eAAe,CAAC,KAAK,CAAC,4CA8CxB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,KAAK,SAAS,SAAS,GAAG,SAAS,EAAE,0CAMpE,sBAAsB,CAAC,KAAK,CAAC,4CAkC/B,CAAC;AA4BF,eAAO,MAAM,cAAc,GAAI,uEAQ5B,mBAAmB,4CA+BrB,CAAC;AAyBF,eAAO,MAAM,kBAAkB,GAAI,wCAMhC,uBAAuB,4CA6BzB,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,wCAMvC,8BAA8B,4CA6BhC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,wCAMnC,0BAA0B,4CAsB5B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,wCAMtC,6BAA6B,4CAuB/B,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,wCAMnC,0BAA0B,4CAsB5B,CAAC;AAeF,eAAO,MAAM,gBAAgB,GAAI,mBAAmB,qBAAqB,4CAiBxE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,kDAOlC,yBAAyB,mDA4C3B,CAAC;AA6DF,eAAO,MAAM,iBAAiB,GAAI,gFAS/B,sBAAsB,4CAgCxB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StyledPressableProps, StyledTextProps, StyledViewProps } from '../../../styles';
|
|
3
|
+
import type { SearchInputProps } from '../SearchInput';
|
|
3
4
|
export type MetaShape = Record<string, unknown>;
|
|
4
5
|
export type OptionListItemData<TMeta extends MetaShape = MetaShape> = {
|
|
5
6
|
/** Unique string identifier for this item, used for selection tracking. */
|
|
@@ -30,6 +31,8 @@ export type OptionListContextValue = {
|
|
|
30
31
|
isGrouped: boolean;
|
|
31
32
|
groups: OptionListItemGroup[];
|
|
32
33
|
flatItems: OptionListItemData[];
|
|
34
|
+
resolvedSearchValue: string;
|
|
35
|
+
handleSearchValueChange: (value: string) => void;
|
|
33
36
|
};
|
|
34
37
|
/** Internal type -- consumers never construct this directly. */
|
|
35
38
|
export type OptionListItemGroup<TMeta extends MetaShape = MetaShape> = {
|
|
@@ -37,16 +40,49 @@ export type OptionListItemGroup<TMeta extends MetaShape = MetaShape> = {
|
|
|
37
40
|
items: OptionListItemData<TMeta>[];
|
|
38
41
|
};
|
|
39
42
|
export type OptionListProps<TMeta extends MetaShape = MetaShape> = {
|
|
40
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Flat array of items.
|
|
45
|
+
* Use the `group` field on each item for automatic grouping.
|
|
46
|
+
*/
|
|
41
47
|
items: OptionListItemData<TMeta>[];
|
|
42
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* The controlled selected value.
|
|
50
|
+
*/
|
|
43
51
|
value?: string | null;
|
|
44
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* The default selected value (uncontrolled)
|
|
54
|
+
*/
|
|
45
55
|
defaultValue?: string | null;
|
|
46
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Called when the selected value changes.
|
|
58
|
+
*/
|
|
47
59
|
onValueChange?: (value: string | null) => void;
|
|
48
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* When true, prevents interaction with the entire list.
|
|
62
|
+
*/
|
|
49
63
|
disabled?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Custom item/query matcher.
|
|
66
|
+
* Defaults to case-insensitive label match; `null` disables filtering.
|
|
67
|
+
*/
|
|
68
|
+
filter?: null | ((item: OptionListItemData<TMeta>, query: string) => boolean);
|
|
69
|
+
/**
|
|
70
|
+
* Pre-filtered items for async/remote search.
|
|
71
|
+
* Bypasses internal filtering.
|
|
72
|
+
*/
|
|
73
|
+
filteredItems?: OptionListItemData<TMeta>[];
|
|
74
|
+
/**
|
|
75
|
+
* Controlled search input value.
|
|
76
|
+
*/
|
|
77
|
+
searchValue?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Initial uncontrolled search value.
|
|
80
|
+
*/
|
|
81
|
+
defaultSearchValue?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Fired when search input changes.
|
|
84
|
+
*/
|
|
85
|
+
onSearchValueChange?: (value: string) => void;
|
|
50
86
|
children: ReactNode;
|
|
51
87
|
};
|
|
52
88
|
export type OptionListContentProps<TMeta extends MetaShape = MetaShape> = {
|
|
@@ -84,6 +120,7 @@ export type OptionListEmptyStateProps = {
|
|
|
84
120
|
/** Optional secondary text displayed below the title. */
|
|
85
121
|
description?: string;
|
|
86
122
|
} & Omit<StyledViewProps, 'children'>;
|
|
123
|
+
export type OptionListSearchProps = Omit<SearchInputProps, 'value' | 'onChangeText' | 'defaultValue'>;
|
|
87
124
|
export type OptionListTriggerProps = {
|
|
88
125
|
/** Floating label shown above the selected value. */
|
|
89
126
|
label?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/OptionList/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EACf,eAAe,EAChB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/OptionList/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,oBAAoB,EACpB,e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,EAAE,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC,CAAC"}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import type { MetaShape, OptionListItemData, OptionListItemGroup } from '../types';
|
|
2
|
+
export declare const defaultLabelFilter: (item: OptionListItemData, query: string) => boolean;
|
|
2
3
|
type UseOptionListItemsParams<TMeta extends MetaShape = MetaShape> = {
|
|
3
4
|
items: OptionListItemData<TMeta>[];
|
|
5
|
+
filter?: null | ((item: OptionListItemData<TMeta>, query: string) => boolean);
|
|
6
|
+
filteredItems?: OptionListItemData<TMeta>[];
|
|
7
|
+
searchValue?: string;
|
|
8
|
+
defaultSearchValue?: string;
|
|
9
|
+
onSearchValueChange?: (value: string) => void;
|
|
4
10
|
};
|
|
5
11
|
type UseOptionListItemsResult<TMeta extends MetaShape = MetaShape> = {
|
|
6
12
|
isGrouped: boolean;
|
|
7
13
|
groups: OptionListItemGroup<TMeta>[];
|
|
8
14
|
flatItems: OptionListItemData<TMeta>[];
|
|
15
|
+
resolvedSearchValue: string;
|
|
16
|
+
handleSearchValueChange: (val: string) => void;
|
|
9
17
|
};
|
|
10
|
-
export declare const useOptionListItems: <TMeta extends MetaShape = MetaShape>({ items, }: UseOptionListItemsParams<TMeta>) => UseOptionListItemsResult<TMeta>;
|
|
18
|
+
export declare const useOptionListItems: <TMeta extends MetaShape = MetaShape>({ items, filter, filteredItems, searchValue: searchValueProp, defaultSearchValue, onSearchValueChange, }: UseOptionListItemsParams<TMeta>) => UseOptionListItemsResult<TMeta>;
|
|
11
19
|
export {};
|
|
12
20
|
//# sourceMappingURL=useOptionListItems.d.ts.map
|
package/dist/typescript/src/lib/Components/OptionList/useOptionList/useOptionListItems.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOptionListItems.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/OptionList/useOptionList/useOptionListItems.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOptionListItems.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/OptionList/useOptionList/useOptionListItems.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EACT,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAqBlB,eAAO,MAAM,kBAAkB,GAC7B,MAAM,kBAAkB,EACxB,OAAO,MAAM,KACZ,OAAiE,CAAC;AAErE,KAAK,wBAAwB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS,IAAI;IACnE,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAC9E,aAAa,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF,KAAK,wBAAwB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS,IAAI;IACnE,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;IACrC,SAAS,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;IACvC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,KAAK,SAAS,SAAS,GAAG,SAAS,EAAE,0GAOrE,wBAAwB,CAAC,KAAK,CAAC,KAAG,wBAAwB,CAAC,KAAK,CAmClE,CAAC"}
|
|
@@ -13,6 +13,6 @@ import type { SkeletonProps } from './types';
|
|
|
13
13
|
* // Tile variant
|
|
14
14
|
* <Skeleton component='tile' />
|
|
15
15
|
*/
|
|
16
|
-
declare const Skeleton: ({ lx, component, ...props }: SkeletonProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const Skeleton: ({ lx, component, style, ...props }: SkeletonProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
export { Skeleton };
|
|
18
18
|
//# sourceMappingURL=Skeleton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Skeleton/Skeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgG7C;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,QAAQ,GAAI,
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Skeleton/Skeleton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgG7C;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,QAAQ,GAAI,oCAAoC,aAAa,4CAsBlE,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/TabBar/TabBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/TabBar/TabBar.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE5D,eAAO,MAAM,cAAc,KAAK,CAAC;AA+IjC,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,IAAI,EACJ,UAAU,EACV,KAAK,EACL,GAAG,KAAK,EACT,EAAE,eAAe,2CAmDjB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,MAAM,CAAC,EACrB,MAAM,EACN,UAAU,EACV,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,WAAW,2CA2Cb"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ElementType, ComponentPropsWithRef,
|
|
1
|
+
import type { ElementType, ComponentPropsWithRef, ComponentRef } from 'react';
|
|
2
2
|
import type { Pressable, View } from 'react-native';
|
|
3
3
|
type ComponentPropsWithAsChild<T extends ElementType<any>> = ComponentPropsWithRef<T> & {
|
|
4
4
|
asChild?: boolean;
|
|
5
5
|
};
|
|
6
6
|
type SlottableViewProps = ComponentPropsWithAsChild<typeof View>;
|
|
7
|
-
type ViewRef =
|
|
8
|
-
type PressableRef =
|
|
7
|
+
type ViewRef = ComponentRef<typeof View>;
|
|
8
|
+
type PressableRef = ComponentRef<typeof Pressable>;
|
|
9
9
|
type SlottablePressableProps = ComponentPropsWithAsChild<typeof Pressable> & {
|
|
10
10
|
/**
|
|
11
11
|
* Platform: WEB ONLY
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpD,KAAK,yBAAyB,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,CAAC,IACvD,qBAAqB,CAAC,CAAC,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEnD,KAAK,kBAAkB,GAAG,yBAAyB,CAAC,OAAO,IAAI,CAAC,CAAC;AACjE,KAAK,OAAO,GAAG,YAAY,CAAC,OAAO,IAAI,CAAC,CAAC;AACzC,KAAK,YAAY,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,CAAC;AAEnD,KAAK,uBAAuB,GAAG,yBAAyB,CAAC,OAAO,SAAS,CAAC,GAAG;IAC3E;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,UAAU,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,YAAY,EACV,cAAc,EACd,YAAY,EACZ,uBAAuB,EACvB,kBAAkB,EAClB,OAAO,GACR,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
2
2
|
import type { LumenTextStyle, LumenViewStyle } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Transform lx props to StyleSheet style object for View
|
|
5
5
|
*/
|
|
6
|
-
export declare const useResolveViewStyle: (lx: LumenViewStyle, bareStyle?: ViewStyle) => ViewStyle;
|
|
6
|
+
export declare const useResolveViewStyle: (lx: LumenViewStyle, bareStyle?: StyleProp<ViewStyle>) => ViewStyle;
|
|
7
7
|
/**
|
|
8
8
|
* Transform lx props to StyleSheet style object for Text
|
|
9
9
|
*/
|
|
10
|
-
export declare const useResolveTextStyle: (lx: LumenTextStyle, bareStyle?: TextStyle) => TextStyle;
|
|
10
|
+
export declare const useResolveTextStyle: (lx: LumenTextStyle, bareStyle?: StyleProp<TextStyle>) => TextStyle;
|
|
11
11
|
//# sourceMappingURL=resolveStyle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveStyle.d.ts","sourceRoot":"","sources":["../../../../../src/styles/lx/resolveStyle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolveStyle.d.ts","sourceRoot":"","sources":["../../../../../src/styles/lx/resolveStyle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,EACf,MAAM,UAAU,CAAC;AAoClB;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,IAAI,cAAc,EAClB,YAAY,SAAS,CAAC,SAAS,CAAC,KAC/B,SAIF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,IAAI,cAAc,EAClB,YAAY,SAAS,CAAC,SAAS,CAAC,KAC/B,SAIF,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -4,9 +4,9 @@ import Animated, {
|
|
|
4
4
|
useAnimatedStyle,
|
|
5
5
|
useSharedValue,
|
|
6
6
|
withRepeat,
|
|
7
|
-
withSequence,
|
|
8
7
|
withTiming,
|
|
9
8
|
} from 'react-native-reanimated';
|
|
9
|
+
import { useResolveViewStyle } from '../../../styles';
|
|
10
10
|
import type { TimingTokens } from '../types';
|
|
11
11
|
import { useTimingConfig } from '../useTimingConfig';
|
|
12
12
|
import type { PulseProps } from './types';
|
|
@@ -17,38 +17,43 @@ const TIMING_DEFAULTS: TimingTokens = {
|
|
|
17
17
|
duration: 1000,
|
|
18
18
|
easing: 'linear',
|
|
19
19
|
};
|
|
20
|
-
export const Pulse = memo(
|
|
21
|
-
|
|
20
|
+
export const Pulse = memo(
|
|
21
|
+
({ children, timing, animate, style, lx = {}, ...props }: PulseProps) => {
|
|
22
|
+
const sv = useSharedValue<number>(1);
|
|
23
|
+
const resolvedLxStyle = useResolveViewStyle(lx, style);
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const timingConfig = useTimingConfig({
|
|
26
|
+
duration: timing?.duration ?? TIMING_DEFAULTS.duration,
|
|
27
|
+
easing: timing?.easing ?? TIMING_DEFAULTS.easing,
|
|
28
|
+
});
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-1,
|
|
36
|
-
);
|
|
37
|
-
} else {
|
|
38
|
-
cancelAnimation(sv);
|
|
39
|
-
sv.value = withTiming(1, timingConfig);
|
|
40
|
-
}
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (animate) {
|
|
32
|
+
sv.value = withRepeat(withTiming(MIN_OPACITY, timingConfig), -1, true);
|
|
33
|
+
} else {
|
|
34
|
+
cancelAnimation(sv);
|
|
35
|
+
sv.value = withTiming(1, timingConfig);
|
|
36
|
+
}
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
return () => {
|
|
39
|
+
cancelAnimation(sv);
|
|
40
|
+
sv.value = 1;
|
|
41
|
+
};
|
|
42
|
+
}, [sv, animate, timingConfig]);
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
() => ({
|
|
44
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
47
45
|
opacity: sv.value,
|
|
48
|
-
})
|
|
49
|
-
[sv],
|
|
50
|
-
);
|
|
46
|
+
}));
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
return (
|
|
49
|
+
<Animated.View
|
|
50
|
+
{...props}
|
|
51
|
+
collapsable={false}
|
|
52
|
+
style={[resolvedLxStyle, animatedStyle]}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</Animated.View>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
);
|
|
54
59
|
Pulse.displayName = 'Pulse';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import type { StyledViewProps } from '../../../styles';
|
|
2
3
|
import type { TimingTokens } from '../types';
|
|
3
4
|
|
|
4
5
|
export type PulseProps = {
|
|
@@ -15,4 +16,4 @@ export type PulseProps = {
|
|
|
15
16
|
* Whether the pulse animation should play
|
|
16
17
|
*/
|
|
17
18
|
animate?: boolean;
|
|
18
|
-
};
|
|
19
|
+
} & StyledViewProps;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import type { FC } from 'react';
|
|
2
3
|
import { useState } from 'react';
|
|
3
4
|
import { Button } from '../Button';
|
|
4
5
|
import { SearchInput } from '../SearchInput';
|
|
5
|
-
import {
|
|
6
|
+
import { Spot } from '../Spot';
|
|
7
|
+
import { Box, RadialGradient, Text } from '../Utility';
|
|
6
8
|
import { BottomSheet } from './BottomSheet';
|
|
7
9
|
import { BottomSheetHeader } from './BottomSheetHeader';
|
|
8
10
|
import {
|
|
@@ -11,6 +13,7 @@ import {
|
|
|
11
13
|
BottomSheetView,
|
|
12
14
|
BottomSheetVirtualizedList,
|
|
13
15
|
} from './Scrollables';
|
|
16
|
+
import type { BottomSheetBackgroundProps } from './types';
|
|
14
17
|
import { useBottomSheetRef } from './useBottomSheetRef';
|
|
15
18
|
|
|
16
19
|
const meta = {
|
|
@@ -654,3 +657,173 @@ export const VirtualizedList: Story = {
|
|
|
654
657
|
);
|
|
655
658
|
},
|
|
656
659
|
};
|
|
660
|
+
|
|
661
|
+
type StrongBackgroundColor = 'errorStrong' | 'successStrong' | 'mutedStrong';
|
|
662
|
+
|
|
663
|
+
const createGradientBackground =
|
|
664
|
+
(color: StrongBackgroundColor): FC<BottomSheetBackgroundProps> =>
|
|
665
|
+
({ style }) => (
|
|
666
|
+
<Box
|
|
667
|
+
style={style}
|
|
668
|
+
lx={{ backgroundColor: 'canvasSheet', overflow: 'hidden' }}
|
|
669
|
+
>
|
|
670
|
+
<RadialGradient
|
|
671
|
+
center={{ x: 0.5, y: 0 }}
|
|
672
|
+
stops={[
|
|
673
|
+
{ color, offset: 0, opacity: 0.3 },
|
|
674
|
+
{ color, offset: 1, opacity: 0 },
|
|
675
|
+
]}
|
|
676
|
+
lx={{
|
|
677
|
+
position: 'absolute',
|
|
678
|
+
top: 's0',
|
|
679
|
+
left: 's0',
|
|
680
|
+
right: 's0',
|
|
681
|
+
height: 's320',
|
|
682
|
+
}}
|
|
683
|
+
/>
|
|
684
|
+
</Box>
|
|
685
|
+
);
|
|
686
|
+
|
|
687
|
+
const ErrorBackground = createGradientBackground('errorStrong');
|
|
688
|
+
const SuccessBackground = createGradientBackground('successStrong');
|
|
689
|
+
const MutedBackground = createGradientBackground('mutedStrong');
|
|
690
|
+
|
|
691
|
+
export const InfoStateVariants: Story = {
|
|
692
|
+
args: {
|
|
693
|
+
snapPoints: 'full',
|
|
694
|
+
hideCloseButton: false,
|
|
695
|
+
onBack: undefined,
|
|
696
|
+
onClose: undefined,
|
|
697
|
+
enableHandlePanningGesture: true,
|
|
698
|
+
enablePanDownToClose: true,
|
|
699
|
+
enableBlurKeyboardOnGesture: true,
|
|
700
|
+
enableDynamicSizing: false,
|
|
701
|
+
detached: false,
|
|
702
|
+
backdropPressBehavior: 'close',
|
|
703
|
+
hideHandle: true,
|
|
704
|
+
},
|
|
705
|
+
render: (args) => {
|
|
706
|
+
const errorBottomSheetRef = useBottomSheetRef();
|
|
707
|
+
const successBottomSheetRef = useBottomSheetRef();
|
|
708
|
+
const mutedBottomSheetRef = useBottomSheetRef();
|
|
709
|
+
|
|
710
|
+
return (
|
|
711
|
+
<Box
|
|
712
|
+
lx={{
|
|
713
|
+
height: 's320',
|
|
714
|
+
width: 'full',
|
|
715
|
+
alignItems: 'center',
|
|
716
|
+
justifyContent: 'center',
|
|
717
|
+
paddingTop: 's32',
|
|
718
|
+
gap: 's12',
|
|
719
|
+
}}
|
|
720
|
+
>
|
|
721
|
+
<Button
|
|
722
|
+
size='sm'
|
|
723
|
+
onPress={() => errorBottomSheetRef.current?.present()}
|
|
724
|
+
>
|
|
725
|
+
Error
|
|
726
|
+
</Button>
|
|
727
|
+
<Button
|
|
728
|
+
size='sm'
|
|
729
|
+
onPress={() => successBottomSheetRef.current?.present()}
|
|
730
|
+
>
|
|
731
|
+
Success
|
|
732
|
+
</Button>
|
|
733
|
+
<Button
|
|
734
|
+
size='sm'
|
|
735
|
+
onPress={() => mutedBottomSheetRef.current?.present()}
|
|
736
|
+
>
|
|
737
|
+
Muted
|
|
738
|
+
</Button>
|
|
739
|
+
|
|
740
|
+
<BottomSheet
|
|
741
|
+
{...args}
|
|
742
|
+
ref={errorBottomSheetRef}
|
|
743
|
+
backgroundComponent={ErrorBackground}
|
|
744
|
+
>
|
|
745
|
+
<BottomSheetView>
|
|
746
|
+
<BottomSheetHeader density='compact' />
|
|
747
|
+
<Box lx={{ alignItems: 'center', gap: 's24' }}>
|
|
748
|
+
<Spot appearance='error' size={72} />
|
|
749
|
+
<Box lx={{ alignItems: 'center', gap: 's12' }}>
|
|
750
|
+
<Text typography='heading4SemiBold' lx={{ color: 'base' }}>
|
|
751
|
+
Title
|
|
752
|
+
</Text>
|
|
753
|
+
<Text
|
|
754
|
+
typography='body2'
|
|
755
|
+
lx={{ color: 'muted', textAlign: 'center' }}
|
|
756
|
+
>
|
|
757
|
+
Description
|
|
758
|
+
</Text>
|
|
759
|
+
</Box>
|
|
760
|
+
</Box>
|
|
761
|
+
<Box lx={{ marginTop: 's24' }}>
|
|
762
|
+
<Button appearance='base' size='lg' isFull>
|
|
763
|
+
Label
|
|
764
|
+
</Button>
|
|
765
|
+
</Box>
|
|
766
|
+
</BottomSheetView>
|
|
767
|
+
</BottomSheet>
|
|
768
|
+
|
|
769
|
+
<BottomSheet
|
|
770
|
+
{...args}
|
|
771
|
+
ref={successBottomSheetRef}
|
|
772
|
+
backgroundComponent={SuccessBackground}
|
|
773
|
+
>
|
|
774
|
+
<BottomSheetView>
|
|
775
|
+
<BottomSheetHeader density='compact' />
|
|
776
|
+
<Box lx={{ alignItems: 'center', gap: 's24' }}>
|
|
777
|
+
<Spot appearance='check' size={72} />
|
|
778
|
+
<Box lx={{ alignItems: 'center', gap: 's12' }}>
|
|
779
|
+
<Text typography='heading4SemiBold' lx={{ color: 'base' }}>
|
|
780
|
+
Title
|
|
781
|
+
</Text>
|
|
782
|
+
<Text
|
|
783
|
+
typography='body2'
|
|
784
|
+
lx={{ color: 'muted', textAlign: 'center' }}
|
|
785
|
+
>
|
|
786
|
+
Description
|
|
787
|
+
</Text>
|
|
788
|
+
</Box>
|
|
789
|
+
</Box>
|
|
790
|
+
<Box lx={{ marginTop: 's24' }}>
|
|
791
|
+
<Button appearance='base' size='lg' isFull>
|
|
792
|
+
Label
|
|
793
|
+
</Button>
|
|
794
|
+
</Box>
|
|
795
|
+
</BottomSheetView>
|
|
796
|
+
</BottomSheet>
|
|
797
|
+
|
|
798
|
+
<BottomSheet
|
|
799
|
+
{...args}
|
|
800
|
+
ref={mutedBottomSheetRef}
|
|
801
|
+
backgroundComponent={MutedBackground}
|
|
802
|
+
>
|
|
803
|
+
<BottomSheetView>
|
|
804
|
+
<BottomSheetHeader density='compact' />
|
|
805
|
+
<Box lx={{ alignItems: 'center', gap: 's24' }}>
|
|
806
|
+
<Spot appearance='info' size={72} />
|
|
807
|
+
<Box lx={{ alignItems: 'center', gap: 's12' }}>
|
|
808
|
+
<Text typography='heading4SemiBold' lx={{ color: 'base' }}>
|
|
809
|
+
Title
|
|
810
|
+
</Text>
|
|
811
|
+
<Text
|
|
812
|
+
typography='body2'
|
|
813
|
+
lx={{ color: 'muted', textAlign: 'center' }}
|
|
814
|
+
>
|
|
815
|
+
Description
|
|
816
|
+
</Text>
|
|
817
|
+
</Box>
|
|
818
|
+
</Box>
|
|
819
|
+
<Box lx={{ marginTop: 's24' }}>
|
|
820
|
+
<Button appearance='base' size='lg' isFull>
|
|
821
|
+
Label
|
|
822
|
+
</Button>
|
|
823
|
+
</Box>
|
|
824
|
+
</BottomSheetView>
|
|
825
|
+
</BottomSheet>
|
|
826
|
+
</Box>
|
|
827
|
+
);
|
|
828
|
+
},
|
|
829
|
+
};
|
|
@@ -184,6 +184,65 @@ describe('BottomSheet', () => {
|
|
|
184
184
|
expect(element.props['data-detached']).toBe('true');
|
|
185
185
|
});
|
|
186
186
|
|
|
187
|
+
it('uses default background style when no backgroundComponent is provided', () => {
|
|
188
|
+
const { BottomSheet } = require('./BottomSheet');
|
|
189
|
+
const { getByTestId } = renderWithTheme(
|
|
190
|
+
<BottomSheet testID='bottom-sheet'>
|
|
191
|
+
<Text>Content</Text>
|
|
192
|
+
</BottomSheet>,
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const element = getByTestId('bottom-sheet');
|
|
196
|
+
expect(element.props['data-has-background-component']).toBe('false');
|
|
197
|
+
expect(element.props['data-has-background-style']).toBe('true');
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('renders the default handle when hideHandle is not set', () => {
|
|
201
|
+
const { BottomSheet } = require('./BottomSheet');
|
|
202
|
+
const { getByTestId, queryByTestId } = renderWithTheme(
|
|
203
|
+
<BottomSheet testID='bottom-sheet'>
|
|
204
|
+
<Text>Content</Text>
|
|
205
|
+
</BottomSheet>,
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
expect(getByTestId('bottom-sheet-handle')).toBeTruthy();
|
|
209
|
+
expect(queryByTestId('bottom-sheet-handle-hidden')).toBeNull();
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it('renders the hidden handle placeholder when hideHandle is true', () => {
|
|
213
|
+
const { BottomSheet } = require('./BottomSheet');
|
|
214
|
+
const { getByTestId, queryByTestId } = renderWithTheme(
|
|
215
|
+
<BottomSheet hideHandle testID='bottom-sheet'>
|
|
216
|
+
<Text>Content</Text>
|
|
217
|
+
</BottomSheet>,
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
expect(getByTestId('bottom-sheet-handle-hidden')).toBeTruthy();
|
|
221
|
+
expect(queryByTestId('bottom-sheet-handle')).toBeNull();
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('forwards backgroundComponent and skips default background style', () => {
|
|
225
|
+
const { BottomSheet } = require('./BottomSheet');
|
|
226
|
+
const CustomBackground = () => (
|
|
227
|
+
<View testID='custom-bg'>
|
|
228
|
+
<Text>BG</Text>
|
|
229
|
+
</View>
|
|
230
|
+
);
|
|
231
|
+
const { getByTestId } = renderWithTheme(
|
|
232
|
+
<BottomSheet
|
|
233
|
+
backgroundComponent={CustomBackground}
|
|
234
|
+
testID='bottom-sheet'
|
|
235
|
+
>
|
|
236
|
+
<Text>Content</Text>
|
|
237
|
+
</BottomSheet>,
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
const element = getByTestId('bottom-sheet');
|
|
241
|
+
expect(element.props['data-has-background-component']).toBe('true');
|
|
242
|
+
expect(element.props['data-has-background-style']).toBe('false');
|
|
243
|
+
expect(getByTestId('custom-bg')).toBeTruthy();
|
|
244
|
+
});
|
|
245
|
+
|
|
187
246
|
it('respects enableHandlePanningGesture prop', () => {
|
|
188
247
|
const { BottomSheet } = require('./BottomSheet');
|
|
189
248
|
const { getByTestId } = renderWithTheme(
|