@ledgerhq/lumen-ui-rnative 0.1.51 → 0.1.53
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 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.figma.js +3 -6
- package/dist/module/lib/Components/Avatar/Avatar.figma.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.js +92 -39
- package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.mdx +36 -191
- package/dist/module/lib/Components/Avatar/Avatar.stories.js +80 -125
- package/dist/module/lib/Components/Avatar/Avatar.stories.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.test.js +56 -45
- package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
- package/dist/module/lib/Components/Avatar/index.js +1 -0
- package/dist/module/lib/Components/Avatar/index.js.map +1 -1
- package/dist/module/lib/Components/Avatar/resolveAvatarColor.js +18 -0
- package/dist/module/lib/Components/Avatar/resolveAvatarColor.js.map +1 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.js +77 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.js.map +1 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.mdx +62 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.stories.js +59 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.stories.js.map +1 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.test.js +100 -0
- package/dist/module/lib/Components/AvatarButton/AvatarButton.test.js.map +1 -0
- package/dist/module/lib/Components/AvatarButton/index.js +5 -0
- package/dist/module/lib/Components/AvatarButton/index.js.map +1 -0
- package/dist/module/lib/Components/AvatarButton/types.js +4 -0
- package/dist/module/lib/Components/AvatarButton/types.js.map +1 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js +4 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +133 -2
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js +114 -7
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js +150 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheetContent.js +35 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheetContent.js.map +1 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheetFooter.js +43 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheetFooter.js.map +1 -0
- package/dist/module/lib/Components/BottomSheet/Scrollables.js +18 -3
- package/dist/module/lib/Components/BottomSheet/Scrollables.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/index.js +2 -0
- package/dist/module/lib/Components/BottomSheet/index.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.js +16 -1
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.test.js +16 -0
- package/dist/module/lib/Components/DotIndicator/getDotIndicatorProps.test.js.map +1 -1
- package/dist/module/lib/Components/MediaBanner/MediaBanner.js +55 -37
- package/dist/module/lib/Components/MediaBanner/MediaBanner.js.map +1 -1
- package/dist/module/lib/Components/MediaBanner/MediaBanner.mdx +25 -3
- package/dist/module/lib/Components/MediaBanner/MediaBanner.stories.js +23 -0
- package/dist/module/lib/Components/MediaBanner/MediaBanner.stories.js.map +1 -1
- package/dist/module/lib/Components/MediaBanner/MediaBanner.test.js +17 -0
- package/dist/module/lib/Components/MediaBanner/MediaBanner.test.js.map +1 -1
- package/dist/module/lib/Components/index.js +1 -0
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/typescript/src/index.d.ts +1 -1
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts +3 -3
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/index.d.ts +1 -0
- package/dist/typescript/src/lib/Components/Avatar/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/resolveAvatarColor.d.ts +8 -0
- package/dist/typescript/src/lib/Components/Avatar/resolveAvatarColor.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Avatar/types.d.ts +22 -7
- package/dist/typescript/src/lib/Components/Avatar/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AvatarButton/AvatarButton.d.ts +13 -0
- package/dist/typescript/src/lib/Components/AvatarButton/AvatarButton.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/AvatarButton/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/AvatarButton/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/AvatarButton/types.d.ts +11 -0
- package/dist/typescript/src/lib/Components/AvatarButton/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts +8 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetContent.d.ts +3 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetContent.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetFooter.d.ts +3 -0
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetFooter.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/Scrollables.d.ts +1 -0
- package/dist/typescript/src/lib/Components/BottomSheet/Scrollables.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/index.d.ts +2 -0
- package/dist/typescript/src/lib/Components/BottomSheet/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts +2 -0
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIndicator/getDotIndicatorProps.d.ts +32 -0
- package/dist/typescript/src/lib/Components/DotIndicator/getDotIndicatorProps.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaBanner/MediaBanner.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaBanner/MediaBanner.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaBanner/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaBanner/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/index.d.ts +1 -0
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/lib/Components/Avatar/Avatar.figma.tsx +2 -5
- package/src/lib/Components/Avatar/Avatar.mdx +36 -191
- package/src/lib/Components/Avatar/Avatar.stories.tsx +58 -83
- package/src/lib/Components/Avatar/Avatar.test.tsx +58 -58
- package/src/lib/Components/Avatar/Avatar.tsx +100 -32
- package/src/lib/Components/Avatar/index.ts +1 -0
- package/src/lib/Components/Avatar/resolveAvatarColor.ts +19 -0
- package/src/lib/Components/Avatar/types.ts +23 -7
- package/src/lib/Components/AvatarButton/AvatarButton.mdx +62 -0
- package/src/lib/Components/AvatarButton/AvatarButton.stories.tsx +58 -0
- package/src/lib/Components/AvatarButton/AvatarButton.test.tsx +92 -0
- package/src/lib/Components/AvatarButton/AvatarButton.tsx +77 -0
- package/src/lib/Components/AvatarButton/index.ts +2 -0
- package/src/lib/Components/AvatarButton/types.ts +15 -0
- package/src/lib/Components/BottomSheet/BottomSheet.mdx +133 -2
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +111 -5
- package/src/lib/Components/BottomSheet/BottomSheet.test.tsx +140 -0
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +25 -9
- package/src/lib/Components/BottomSheet/BottomSheetContent.tsx +44 -0
- package/src/lib/Components/BottomSheet/BottomSheetFooter.tsx +47 -0
- package/src/lib/Components/BottomSheet/Scrollables.tsx +25 -12
- package/src/lib/Components/BottomSheet/index.ts +2 -0
- package/src/lib/Components/BottomSheet/types.ts +2 -1
- package/src/lib/Components/DotIndicator/getDotIndicatorProps.test.ts +16 -0
- package/src/lib/Components/DotIndicator/getDotIndicatorProps.ts +6 -2
- package/src/lib/Components/MediaBanner/MediaBanner.mdx +25 -3
- package/src/lib/Components/MediaBanner/MediaBanner.stories.tsx +25 -0
- package/src/lib/Components/MediaBanner/MediaBanner.test.tsx +18 -0
- package/src/lib/Components/MediaBanner/MediaBanner.tsx +54 -32
- package/src/lib/Components/MediaBanner/types.ts +1 -1
- package/src/lib/Components/index.ts +1 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as AvatarButtonStories from './AvatarButton.stories';
|
|
3
|
+
import { CustomTabs, Tab } from '../../../../.storybook/components';
|
|
4
|
+
|
|
5
|
+
<Meta title='Core/AvatarButton' of={AvatarButtonStories} />
|
|
6
|
+
|
|
7
|
+
# AvatarButton
|
|
8
|
+
|
|
9
|
+
<CustomTabs>
|
|
10
|
+
<Tab label="Overview">
|
|
11
|
+
|
|
12
|
+
## Introduction
|
|
13
|
+
|
|
14
|
+
`AvatarButton` wraps an [`Avatar`](/docs/rnative-avatar--docs) in a `Pressable`, for use as an interactive trigger such as opening a user menu or navigating to a profile. It accepts every `Avatar` prop plus `onPress` and `onLongPress`.
|
|
15
|
+
|
|
16
|
+
## Anatomy
|
|
17
|
+
|
|
18
|
+
<Canvas of={AvatarButtonStories.Base} />
|
|
19
|
+
<Controls of={AvatarButtonStories.Base} />
|
|
20
|
+
|
|
21
|
+
## Fallback
|
|
22
|
+
|
|
23
|
+
Like `Avatar`, it falls back to a User icon when no image is available.
|
|
24
|
+
|
|
25
|
+
<Canvas of={AvatarButtonStories.Fallback} />
|
|
26
|
+
|
|
27
|
+
## Disabled
|
|
28
|
+
|
|
29
|
+
Pass `disabled` to prevent interaction. The pressable is not activatable, and the avatar renders at reduced opacity.
|
|
30
|
+
|
|
31
|
+
<Canvas of={AvatarButtonStories.Disabled} />
|
|
32
|
+
|
|
33
|
+
## Accessibility
|
|
34
|
+
|
|
35
|
+
- Renders with `accessibilityRole="button"` so it is announced as a button by screen readers.
|
|
36
|
+
- Provide a meaningful `alt` describing the action (e.g. `"Open user menu"`); it is exposed as the avatar's accessible label.
|
|
37
|
+
|
|
38
|
+
</Tab>
|
|
39
|
+
<Tab label="Implementation">
|
|
40
|
+
|
|
41
|
+
## Setup
|
|
42
|
+
|
|
43
|
+
Install and set up the library with our [Setup Guide →](?path=/docs/getting-started-setup--docs).
|
|
44
|
+
|
|
45
|
+
## Basic Usage
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { AvatarButton } from '@ledgerhq/lumen-ui-rnative';
|
|
49
|
+
|
|
50
|
+
function MyComponent() {
|
|
51
|
+
return (
|
|
52
|
+
<AvatarButton
|
|
53
|
+
src="https://example.com/photo.jpg"
|
|
54
|
+
alt="Open user menu"
|
|
55
|
+
onPress={openMenu}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
</Tab>
|
|
62
|
+
</CustomTabs>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { AvatarButton } from "./AvatarButton.js";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const meta = {
|
|
6
|
+
component: AvatarButton,
|
|
7
|
+
id: 'rnative-avatar-button',
|
|
8
|
+
title: 'Core/AvatarButton',
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
source: {
|
|
12
|
+
language: 'tsx',
|
|
13
|
+
format: true,
|
|
14
|
+
type: 'code'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
const exampleSrc = 'https://plus.unsplash.com/premium_photo-1689551670902-19b441a6afde?q=80&w=774&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D';
|
|
21
|
+
export const Base = {
|
|
22
|
+
args: {
|
|
23
|
+
src: exampleSrc,
|
|
24
|
+
size: 'md',
|
|
25
|
+
alt: 'Open user menu',
|
|
26
|
+
onPress: () => ({})
|
|
27
|
+
},
|
|
28
|
+
render: args => /*#__PURE__*/_jsx(AvatarButton, {
|
|
29
|
+
...args
|
|
30
|
+
}),
|
|
31
|
+
parameters: {
|
|
32
|
+
docs: {
|
|
33
|
+
source: {
|
|
34
|
+
code: `<AvatarButton src="https://example.com" alt="Open user menu" onPress={openMenu} />`
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export const Fallback = {
|
|
40
|
+
args: {
|
|
41
|
+
alt: 'Open user menu'
|
|
42
|
+
},
|
|
43
|
+
render: args => /*#__PURE__*/_jsx(AvatarButton, {
|
|
44
|
+
...args
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
export const Disabled = {
|
|
48
|
+
args: {
|
|
49
|
+
src: exampleSrc,
|
|
50
|
+
size: 'md',
|
|
51
|
+
alt: 'Open user menu',
|
|
52
|
+
disabled: true,
|
|
53
|
+
onPress: () => ({})
|
|
54
|
+
},
|
|
55
|
+
render: args => /*#__PURE__*/_jsx(AvatarButton, {
|
|
56
|
+
...args
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=AvatarButton.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AvatarButton","jsx","_jsx","meta","component","id","title","parameters","docs","source","language","format","type","exampleSrc","Base","args","src","size","alt","onPress","render","code","Fallback","Disabled","disabled"],"sourceRoot":"../../../../../src","sources":["lib/Components/AvatarButton/AvatarButton.stories.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reList":[]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { describe, it, expect, jest } from '@jest/globals';
|
|
4
|
+
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
5
|
+
import { render, fireEvent } from '@testing-library/react-native';
|
|
6
|
+
import { createRef } from 'react';
|
|
7
|
+
import { ThemeProvider } from "../ThemeProvider/ThemeProvider.js";
|
|
8
|
+
import { AvatarButton } from "./AvatarButton.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
const TestWrapper = ({
|
|
11
|
+
children
|
|
12
|
+
}) => /*#__PURE__*/_jsx(ThemeProvider, {
|
|
13
|
+
themes: ledgerLiveThemes,
|
|
14
|
+
colorScheme: "dark",
|
|
15
|
+
locale: "en",
|
|
16
|
+
children: children
|
|
17
|
+
});
|
|
18
|
+
describe('AvatarButton Component', () => {
|
|
19
|
+
const validSrc = 'https://example.com/photo.jpg';
|
|
20
|
+
it('should render a pressable wrapping the avatar', () => {
|
|
21
|
+
const {
|
|
22
|
+
getByRole,
|
|
23
|
+
getByLabelText
|
|
24
|
+
} = render(/*#__PURE__*/_jsx(TestWrapper, {
|
|
25
|
+
children: /*#__PURE__*/_jsx(AvatarButton, {
|
|
26
|
+
src: validSrc,
|
|
27
|
+
alt: "Open menu"
|
|
28
|
+
})
|
|
29
|
+
}));
|
|
30
|
+
expect(getByRole('button')).toBeTruthy();
|
|
31
|
+
expect(getByLabelText('Open menu')).toBeTruthy();
|
|
32
|
+
});
|
|
33
|
+
it('should call onPress when pressed', () => {
|
|
34
|
+
const onPress = jest.fn();
|
|
35
|
+
const {
|
|
36
|
+
getByRole
|
|
37
|
+
} = render(/*#__PURE__*/_jsx(TestWrapper, {
|
|
38
|
+
children: /*#__PURE__*/_jsx(AvatarButton, {
|
|
39
|
+
src: validSrc,
|
|
40
|
+
onPress: onPress
|
|
41
|
+
})
|
|
42
|
+
}));
|
|
43
|
+
fireEvent.press(getByRole('button'));
|
|
44
|
+
expect(onPress).toHaveBeenCalledTimes(1);
|
|
45
|
+
});
|
|
46
|
+
it('should forward alt to the underlying Avatar', () => {
|
|
47
|
+
const {
|
|
48
|
+
getByLabelText
|
|
49
|
+
} = render(/*#__PURE__*/_jsx(TestWrapper, {
|
|
50
|
+
children: /*#__PURE__*/_jsx(AvatarButton, {
|
|
51
|
+
src: validSrc,
|
|
52
|
+
alt: "User profile"
|
|
53
|
+
})
|
|
54
|
+
}));
|
|
55
|
+
expect(getByLabelText('User profile')).toBeTruthy();
|
|
56
|
+
});
|
|
57
|
+
it('should render fallback icon when no src is provided', () => {
|
|
58
|
+
const {
|
|
59
|
+
getByTestId
|
|
60
|
+
} = render(/*#__PURE__*/_jsx(TestWrapper, {
|
|
61
|
+
children: /*#__PURE__*/_jsx(AvatarButton, {})
|
|
62
|
+
}));
|
|
63
|
+
expect(getByTestId('avatar-fallback-icon')).toBeTruthy();
|
|
64
|
+
});
|
|
65
|
+
it('should render image when src is provided', () => {
|
|
66
|
+
const {
|
|
67
|
+
getByTestId
|
|
68
|
+
} = render(/*#__PURE__*/_jsx(TestWrapper, {
|
|
69
|
+
children: /*#__PURE__*/_jsx(AvatarButton, {
|
|
70
|
+
src: validSrc
|
|
71
|
+
})
|
|
72
|
+
}));
|
|
73
|
+
const image = getByTestId('avatar-image');
|
|
74
|
+
expect(image.props.source).toEqual({
|
|
75
|
+
uri: validSrc
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
it('should forward testID to the pressable', () => {
|
|
79
|
+
const {
|
|
80
|
+
getByTestId
|
|
81
|
+
} = render(/*#__PURE__*/_jsx(TestWrapper, {
|
|
82
|
+
children: /*#__PURE__*/_jsx(AvatarButton, {
|
|
83
|
+
src: validSrc,
|
|
84
|
+
testID: "avatar-btn"
|
|
85
|
+
})
|
|
86
|
+
}));
|
|
87
|
+
expect(getByTestId('avatar-btn')).toBeTruthy();
|
|
88
|
+
});
|
|
89
|
+
it('should forward ref to the pressable element', () => {
|
|
90
|
+
const ref = /*#__PURE__*/createRef();
|
|
91
|
+
render(/*#__PURE__*/_jsx(TestWrapper, {
|
|
92
|
+
children: /*#__PURE__*/_jsx(AvatarButton, {
|
|
93
|
+
src: validSrc,
|
|
94
|
+
ref: ref
|
|
95
|
+
})
|
|
96
|
+
}));
|
|
97
|
+
expect(ref.current).toBeTruthy();
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=AvatarButton.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["describe","it","expect","jest","ledgerLiveThemes","render","fireEvent","createRef","ThemeProvider","AvatarButton","jsx","_jsx","TestWrapper","children","themes","colorScheme","locale","validSrc","getByRole","getByLabelText","src","alt","toBeTruthy","onPress","fn","press","toHaveBeenCalledTimes","getByTestId","image","props","source","toEqual","uri","testID","ref","current"],"sourceRoot":"../../../../../src","sources":["lib/Components/AvatarButton/AvatarButton.test.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,EAAEC,IAAI,QAAQ,eAAe;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,MAAM,EAAEC,SAAS,QAAQ,+BAA+B;AACjE,SAAyBC,SAAS,QAAQ,OAAO;AAEjD,SAASC,aAAa,QAAQ,mCAAgC;AAC9D,SAASC,YAAY,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE9C,MAAMC,WAAW,GAAGA,CAAC;EAAEC;AAAkC,CAAC,kBACxDF,IAAA,CAACH,aAAa;EAACM,MAAM,EAAEV,gBAAiB;EAACW,WAAW,EAAC,MAAM;EAACC,MAAM,EAAC,IAAI;EAAAH,QAAA,EACpEA;AAAQ,CACI,CAChB;AAEDb,QAAQ,CAAC,wBAAwB,EAAE,MAAM;EACvC,MAAMiB,QAAQ,GAAG,+BAA+B;EAEhDhB,EAAE,CAAC,+CAA+C,EAAE,MAAM;IACxD,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CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AvatarButton"],"sourceRoot":"../../../../../src","sources":["lib/Components/AvatarButton/index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,mBAAgB;AAC7C,cAAc,YAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["lib/Components/AvatarButton/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -73,6 +73,7 @@ export const BottomSheet = ({
|
|
|
73
73
|
const innerRef = useRef(null);
|
|
74
74
|
const mergedRefs = useMergedRef(ref, innerRef);
|
|
75
75
|
const [isOpen, setIsOpen] = useState(false);
|
|
76
|
+
const [hasFooter, setHasFooter] = useState(false);
|
|
76
77
|
const styles = useStyles({
|
|
77
78
|
shadow: hideBackdrop && isOpen,
|
|
78
79
|
hasCustomBackground: Boolean(backgroundComponent)
|
|
@@ -162,7 +163,9 @@ export const BottomSheet = ({
|
|
|
162
163
|
value: {
|
|
163
164
|
onBack,
|
|
164
165
|
hideCloseButton,
|
|
165
|
-
onHeaderClosePressed
|
|
166
|
+
onHeaderClosePressed,
|
|
167
|
+
hasFooter,
|
|
168
|
+
setHasFooter
|
|
166
169
|
},
|
|
167
170
|
children: children
|
|
168
171
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BottomSheetModal","GorhomBottomSheetModal","createSafeContext","useMergedRef","useCallback","useMemo","useRef","useState","StyleSheet","useStyleSheet","RuntimeConstants","CustomBackdrop","CustomHandle","HiddenHandle","jsx","_jsx","OFFSET_TOP","FULL_HEIGHT","insetDimensions","height","FULL_WITH_OFFSET","SNAP_POINTS_MAP","full","fullWithOffset","medium","small","MAX_DYNAMIC_CONTENT_SIZE","useStyles","shadow","hasCustomBackground","t","root","flatten","marginBottom","spacings","s16","width","sizes","flex","borderTopLeftRadius","borderRadius","xl","borderTopRightRadius","overflow","boxShadow","shadows","lg","background","backgroundColor","colors","bg","canvasSheet","BottomSheetProvider","useBottomSheetContext","BottomSheet","onOpen","onClose","onDismiss","onHeaderClosePressed","onBack","onAnimate","children","hideCloseButton","enablePanDownToClose","enableDynamicSizing","enableBlurKeyboardOnGesture","enableHandlePanningGesture","maxDynamicContentSize","undefined","detached","hideBackdrop","backdropPressBehavior","onBackdropPress","onChange","snapPoints","backgroundComponent","hideHandle","ref","props","innerRef","mergedRefs","isOpen","setIsOpen","styles","Boolean","computedSnapPoints","Array","isArray","computedMaxDynamicContentSize","renderBackdrop","backdropProps","onPress","handleChange","index","position","type","handleAnimate","fromIndex","toIndex","fromPosition","toPosition","newIsOpen","style","backgroundStyle","overDragResistanceFactor","keyboardBehavior","handleComponent","backdropComponent","value"],"sourceRoot":"../../../../../src","sources":["lib/Components/BottomSheet/BottomSheet.tsx"],"mappings":";;AACA,SAASA,gBAAgB,IAAIC,sBAAsB,QAAQ,sBAAsB;AACjF,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,8BAA8B;AAC9E,
|
|
1
|
+
{"version":3,"names":["BottomSheetModal","GorhomBottomSheetModal","createSafeContext","useMergedRef","useCallback","useMemo","useRef","useState","StyleSheet","useStyleSheet","RuntimeConstants","CustomBackdrop","CustomHandle","HiddenHandle","jsx","_jsx","OFFSET_TOP","FULL_HEIGHT","insetDimensions","height","FULL_WITH_OFFSET","SNAP_POINTS_MAP","full","fullWithOffset","medium","small","MAX_DYNAMIC_CONTENT_SIZE","useStyles","shadow","hasCustomBackground","t","root","flatten","marginBottom","spacings","s16","width","sizes","flex","borderTopLeftRadius","borderRadius","xl","borderTopRightRadius","overflow","boxShadow","shadows","lg","background","backgroundColor","colors","bg","canvasSheet","BottomSheetProvider","useBottomSheetContext","BottomSheet","onOpen","onClose","onDismiss","onHeaderClosePressed","onBack","onAnimate","children","hideCloseButton","enablePanDownToClose","enableDynamicSizing","enableBlurKeyboardOnGesture","enableHandlePanningGesture","maxDynamicContentSize","undefined","detached","hideBackdrop","backdropPressBehavior","onBackdropPress","onChange","snapPoints","backgroundComponent","hideHandle","ref","props","innerRef","mergedRefs","isOpen","setIsOpen","hasFooter","setHasFooter","styles","Boolean","computedSnapPoints","Array","isArray","computedMaxDynamicContentSize","renderBackdrop","backdropProps","onPress","handleChange","index","position","type","handleAnimate","fromIndex","toIndex","fromPosition","toPosition","newIsOpen","style","backgroundStyle","overDragResistanceFactor","keyboardBehavior","handleComponent","backdropComponent","value"],"sourceRoot":"../../../../../src","sources":["lib/Components/BottomSheet/BottomSheet.tsx"],"mappings":";;AACA,SAASA,gBAAgB,IAAIC,sBAAsB,QAAQ,sBAAsB;AACjF,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,8BAA8B;AAC9E,SACEC,WAAW,EACXC,OAAO,EACPC,MAAM,EACNC,QAAQ,QAGH,OAAO;AACd,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,aAAa,QAAQ,0BAAiB;AAC/C,SAASC,gBAAgB,QAAQ,sBAAa;AAC9C,SAASC,cAAc,QAAQ,qBAAkB;AACjD,SAASC,YAAY,EAAEC,YAAY,QAAQ,mBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG5D,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,WAAW,GAAGP,gBAAgB,CAACQ,eAAe,CAACC,MAAM;AAC3D,MAAMC,gBAAgB,GAAGH,WAAW,GAAGD,UAAU;AAEjD,MAAMK,eAAe,GAAG;EACtBC,IAAI,EAAE,CAACL,WAAW,CAAC;EACnBM,cAAc,EAAE,CAACH,gBAAgB,CAAC;EAClCI,MAAM,EAAE,CAAC,KAAK,CAAC;EACfC,KAAK,EAAE,CAAC,KAAK;AACf,CAAC;AAED,MAAMC,wBAAwB,GAAG;EAC/BJ,IAAI,EAAEL,WAAW;EACjBM,cAAc,EAAEH;AAClB,CAAC;AAED,MAAMO,SAAS,GAAGA,CAAC;EACjBC,MAAM;EACNC;AAIF,CAAC,KAAK;EACJ,OAAOpB,aAAa,C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;IACvDwC,wBAAwB,EAAE,GAAI;IAC9B3C,oBAAoB,EAAEA,oBAAqB;IAC3CI,qBAAqB,EAAEuB;IACvB;AACN;AACA,OAFM;IAGAzB,2BAA2B,EAAEA,2BAA4B;IACzD0C,gBAAgB,EAAC;IACjB;AACN;AACA,OAFM;IAGAlD,SAAS,EAAEA;IACX;AACN;AACA,OAFM;IAGAmD,eAAe,EAAEhC,UAAU,GAAG/D,YAAY,GAAGD,YAAa;IAC1DiG,iBAAiB,EAAEvC,YAAY,GAAGF,SAAS,GAAGuB,cAAe;IAAA9B,QAAA,eAE7D9C,IAAA,CAACqC,mBAAmB;MAClB0D,KAAK,EAAE;QACLnD,MAAM;QACNG,eAAe;QACfJ,oBAAoB;QACpByB,SAAS;QACTC;MACF,CAAE;MAAAvB,QAAA,EAEDA;IAAQ,CACU;EAAC,CACA,CAAC;AAE7B,CAAC;AAED,SAASR,qBAAqB","ignoreList":[]}
|
|
@@ -24,7 +24,8 @@ BottomSheet provides a flexible and performant way to present content, forms, or
|
|
|
24
24
|
- **Handle**: Visual indicator for draggable area
|
|
25
25
|
- **Backdrop**: Semi-transparent overlay behind the sheet
|
|
26
26
|
- **Header**: Optional header with title, description, back button, and close button
|
|
27
|
-
- **Content**: Scrollable or static content
|
|
27
|
+
- **Content**: Scrollable or static content
|
|
28
|
+
- **Footer**: Optional sticky area pinned to the bottom of the sheet
|
|
28
29
|
|
|
29
30
|
## Properties
|
|
30
31
|
|
|
@@ -97,6 +98,37 @@ Set both properties:
|
|
|
97
98
|
|
|
98
99
|
<Canvas of={BottomSheetStories.PreventClose} />
|
|
99
100
|
|
|
101
|
+
### Footer
|
|
102
|
+
|
|
103
|
+
`BottomSheetFooter` renders a sticky area pinned below the scrollable region.
|
|
104
|
+
|
|
105
|
+
`BottomSheetContent` is a non-scrollable content block that applies standard paddings.
|
|
106
|
+
|
|
107
|
+
#### BottomSheetContent
|
|
108
|
+
|
|
109
|
+
Gorhom's `BottomSheetView` is `position: absolute; top: 0`, so it always overlaps content above it-including the header. For this reason you cannot nest a second `BottomSheetView` inside another one to wrap your body content.
|
|
110
|
+
|
|
111
|
+
When using dynamic sizing (`enableDynamicSizing`), everything must live inside a single Gorhom-aware wrapper (`BottomSheetView`) so the library can measure the total height correctly. That rules out an extra `BottomSheetView` as a content wrapper.
|
|
112
|
+
|
|
113
|
+
`BottomSheetContent` solves this: it is a plain `Box`-based container (not a Gorhom component) with the standard horizontal and vertical paddings already built in, so you get consistent spacing without fighting the absolute-positioning constraint.
|
|
114
|
+
|
|
115
|
+
#### Automatic padding stripping
|
|
116
|
+
|
|
117
|
+
To avoid double-padding, `BottomSheetContent` and `BottomSheetFooter` communicate with their parent via React context:
|
|
118
|
+
|
|
119
|
+
- If `BottomSheetContent` is a child of `BottomSheetView`, its `paddingHorizontal` is dropped (the view already provides it).
|
|
120
|
+
- If a `BottomSheetFooter` is present inside the bottom sheet, `BottomSheetContent` drops its `paddingBottom` (the footer already handles the bottom spacing).
|
|
121
|
+
|
|
122
|
+
This means all combinations—with/without dynamic sizing, with/without a footer—produce consistent spacing automatically.
|
|
123
|
+
|
|
124
|
+
#### Scrollable content with a sticky footer
|
|
125
|
+
|
|
126
|
+
Footer and scrollable are siblings directly inside `BottomSheet`.
|
|
127
|
+
|
|
128
|
+
<Canvas of={BottomSheetStories.WithFooter} />
|
|
129
|
+
|
|
130
|
+
> **Android 3-button navigation:** If the footer is obscured by the system navigation bar, you can pass a bottom margin via `style` or `lx` to raise it.
|
|
131
|
+
|
|
100
132
|
</Tab>
|
|
101
133
|
<Tab label="Implementation">
|
|
102
134
|
|
|
@@ -266,10 +298,109 @@ import {
|
|
|
266
298
|
</BottomSheet>
|
|
267
299
|
```
|
|
268
300
|
|
|
301
|
+
### Footer and Content
|
|
302
|
+
|
|
303
|
+
#### BottomSheetFooter
|
|
304
|
+
|
|
305
|
+
`BottomSheetFooter` renders a sticky area at the bottom of the sheet. It must be placed inside a `BottomSheet` (context is required).
|
|
306
|
+
|
|
307
|
+
#### BottomSheetContent
|
|
308
|
+
|
|
309
|
+
`BottomSheetContent` is a non-scrollable `Box`-based container with `lx` support. By default it applies horizontal and vertical paddings.
|
|
310
|
+
|
|
311
|
+
Use it as the body wrapper whenever you need a static (non-scrollable) content area inside a `BottomSheetView`. Do **not** use a second `BottomSheetView` for this purpose. Gorhom's `BottomSheetView` is `position: absolute; top: 0`, so nesting one inside another causes it to overlap the header rather than flow below it. `BottomSheetContent` is a plain `Box` that avoids this constraint entirely.
|
|
312
|
+
|
|
313
|
+
When using dynamic sizing, all content must live inside a single `BottomSheetView` so the library can measure the sheet height. `BottomSheetContent` works correctly in this setup; a nested `BottomSheetView` does not.
|
|
314
|
+
|
|
315
|
+
Padding is handled automatically via context:
|
|
316
|
+
- `paddingHorizontal` is stripped when `BottomSheetContent` is a child of `BottomSheetView` (the view already provides it).
|
|
317
|
+
- `paddingBottom` is stripped when a `BottomSheetFooter` is present (the footer owns the bottom spacing).
|
|
318
|
+
|
|
319
|
+
#### Pattern A: scrollable content with a footer as siblings
|
|
320
|
+
|
|
321
|
+
Footer and scrollable are direct children of `BottomSheet`.
|
|
322
|
+
|
|
323
|
+
```tsx
|
|
324
|
+
import {
|
|
325
|
+
BottomSheet,
|
|
326
|
+
BottomSheetHeader,
|
|
327
|
+
BottomSheetScrollView,
|
|
328
|
+
BottomSheetFooter,
|
|
329
|
+
useBottomSheetRef,
|
|
330
|
+
} from '@ledgerhq/lumen-ui-rnative';
|
|
331
|
+
|
|
332
|
+
function MyComponent() {
|
|
333
|
+
const ref = useBottomSheetRef();
|
|
334
|
+
|
|
335
|
+
return (
|
|
336
|
+
<BottomSheet ref={ref} snapPoints={['50%']}>
|
|
337
|
+
<BottomSheetHeader spacing title="Title" density="compact" />
|
|
338
|
+
<BottomSheetScrollView>
|
|
339
|
+
{/* scrollable content */}
|
|
340
|
+
</BottomSheetScrollView>
|
|
341
|
+
<BottomSheetFooter>
|
|
342
|
+
<Button size="lg" isFull>Confirm</Button>
|
|
343
|
+
<Button size="lg" isFull appearance="ghost">Cancel</Button>
|
|
344
|
+
</BottomSheetFooter>
|
|
345
|
+
</BottomSheet>
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
#### Pattern B: static content with a footer inside BottomSheetView
|
|
351
|
+
|
|
352
|
+
Both `BottomSheetContent` and `BottomSheetFooter` are children of `BottomSheetView`.
|
|
353
|
+
|
|
354
|
+
```tsx
|
|
355
|
+
import {
|
|
356
|
+
BottomSheet,
|
|
357
|
+
BottomSheetView,
|
|
358
|
+
BottomSheetHeader,
|
|
359
|
+
BottomSheetContent,
|
|
360
|
+
BottomSheetFooter,
|
|
361
|
+
useBottomSheetRef,
|
|
362
|
+
} from '@ledgerhq/lumen-ui-rnative';
|
|
363
|
+
|
|
364
|
+
function MyComponent() {
|
|
365
|
+
const ref = useBottomSheetRef();
|
|
366
|
+
|
|
367
|
+
return (
|
|
368
|
+
<BottomSheet ref={ref} snapPoints={null} enableDynamicSizing>
|
|
369
|
+
<BottomSheetView>
|
|
370
|
+
<BottomSheetHeader title="Title" density="compact" />
|
|
371
|
+
<BottomSheetContent lx={{ gap: 's12' }}>
|
|
372
|
+
{/* static content */}
|
|
373
|
+
</BottomSheetContent>
|
|
374
|
+
<BottomSheetFooter>
|
|
375
|
+
<Button size="lg" isFull>Confirm</Button>
|
|
376
|
+
<Button size="lg" isFull appearance="ghost">Cancel</Button>
|
|
377
|
+
</BottomSheetFooter>
|
|
378
|
+
</BottomSheetView>
|
|
379
|
+
</BottomSheet>
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
#### Pattern C: standalone BottomSheetContent without a scrollable parent
|
|
385
|
+
|
|
386
|
+
`BottomSheetContent` is a direct child of `BottomSheet`, not wrapped in any scrollable.
|
|
387
|
+
|
|
388
|
+
```tsx
|
|
389
|
+
<BottomSheet ref={ref} snapPoints={['50%']}>
|
|
390
|
+
<BottomSheetHeader spacing title="Title" density="compact" />
|
|
391
|
+
<BottomSheetContent>
|
|
392
|
+
{/* content */}
|
|
393
|
+
</BottomSheetContent>
|
|
394
|
+
<BottomSheetFooter>
|
|
395
|
+
<Button size="lg" isFull>Confirm</Button>
|
|
396
|
+
</BottomSheetFooter>
|
|
397
|
+
</BottomSheet>
|
|
398
|
+
```
|
|
399
|
+
|
|
269
400
|
### Important Notes
|
|
270
401
|
|
|
271
402
|
- **Dynamic Sizing**: When using `enableDynamicSizing`, do not define `snapPoints`
|
|
272
|
-
- **Header Spacing**: Use `spacing` prop on `BottomSheetHeader` when using FlatList/VirtualizedList
|
|
403
|
+
- **Header Spacing**: Use `spacing` prop on `BottomSheetHeader` when using FlatList/VirtualizedList or when the footer is a sibling of a list-based scrollable
|
|
273
404
|
- **SectionList**: Not compatible with react-native-web. See [Gorhom documentation](https://gorhom.dev/react-native-bottom-sheet/components/bottomsheetsectionlist).
|
|
274
405
|
- **FlashList**: Requires `@shopify/flash-list` package. See [Gorhom docs](https://gorhom.dev/react-native-bottom-sheet/components/bottomsheetflashlist)
|
|
275
406
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
4
|
import { Button } from "../Button/index.js";
|
|
5
5
|
import { SearchInput } from "../SearchInput/index.js";
|
|
6
6
|
import { Spot } from "../Spot/index.js";
|
|
7
7
|
import { Box, RadialGradient, Text } from "../Utility/index.js";
|
|
8
8
|
import { BottomSheet } from "./BottomSheet.js";
|
|
9
|
+
import { BottomSheetContent } from "./BottomSheetContent.js";
|
|
10
|
+
import { BottomSheetFooter } from "./BottomSheetFooter.js";
|
|
9
11
|
import { BottomSheetHeader } from "./BottomSheetHeader.js";
|
|
10
12
|
import { BottomSheetFlatList, BottomSheetScrollView, BottomSheetView, BottomSheetVirtualizedList } from "./Scrollables.js";
|
|
11
13
|
import { useBottomSheetRef } from "./useBottomSheetRef.js";
|
|
@@ -122,7 +124,7 @@ export const Base = {
|
|
|
122
124
|
title: "Title",
|
|
123
125
|
density: "compact",
|
|
124
126
|
description: "Description"
|
|
125
|
-
}), /*#__PURE__*/_jsx(
|
|
127
|
+
}), /*#__PURE__*/_jsx(BottomSheetContent, {
|
|
126
128
|
lx: {
|
|
127
129
|
flexDirection: 'column',
|
|
128
130
|
gap: 's12'
|
|
@@ -142,6 +144,51 @@ export const Base = {
|
|
|
142
144
|
});
|
|
143
145
|
}
|
|
144
146
|
};
|
|
147
|
+
export const BaseOpen = {
|
|
148
|
+
args: {
|
|
149
|
+
...Base.args
|
|
150
|
+
},
|
|
151
|
+
render: args => {
|
|
152
|
+
const bottomSheetRef = useBottomSheetRef();
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
bottomSheetRef.current?.present();
|
|
155
|
+
}, [bottomSheetRef]);
|
|
156
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
157
|
+
lx: {
|
|
158
|
+
height: 's320',
|
|
159
|
+
width: 'full',
|
|
160
|
+
alignItems: 'center',
|
|
161
|
+
justifyContent: 'center',
|
|
162
|
+
paddingTop: 's32'
|
|
163
|
+
},
|
|
164
|
+
children: /*#__PURE__*/_jsx(BottomSheet, {
|
|
165
|
+
...args,
|
|
166
|
+
ref: bottomSheetRef,
|
|
167
|
+
children: /*#__PURE__*/_jsxs(BottomSheetView, {
|
|
168
|
+
children: [/*#__PURE__*/_jsx(BottomSheetHeader, {
|
|
169
|
+
title: "Title",
|
|
170
|
+
density: "compact",
|
|
171
|
+
description: "Description"
|
|
172
|
+
}), /*#__PURE__*/_jsx(BottomSheetContent, {
|
|
173
|
+
lx: {
|
|
174
|
+
flexDirection: 'column',
|
|
175
|
+
gap: 's12'
|
|
176
|
+
},
|
|
177
|
+
children: Array.from({
|
|
178
|
+
length: 3
|
|
179
|
+
}).map((_, index) => /*#__PURE__*/_jsx(Text, {
|
|
180
|
+
typography: "body2",
|
|
181
|
+
lx: {
|
|
182
|
+
color: 'base'
|
|
183
|
+
},
|
|
184
|
+
children: "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Vitae excepturi odit, quis tenetur iste perspiciatis mollitia porro velit laborum quasi numquam reiciendis dolor! Et quia voluptates eum, sunt asperiores quod."
|
|
185
|
+
}, index))
|
|
186
|
+
})]
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
};
|
|
145
192
|
export const TitleExpanded = {
|
|
146
193
|
args: {
|
|
147
194
|
snapPoints: 'full',
|
|
@@ -174,11 +221,7 @@ export const TitleExpanded = {
|
|
|
174
221
|
title: "Expanded title",
|
|
175
222
|
density: "expanded",
|
|
176
223
|
description: "Expanded description."
|
|
177
|
-
}), /*#__PURE__*/_jsx(
|
|
178
|
-
lx: {
|
|
179
|
-
flexDirection: 'column',
|
|
180
|
-
gap: 's12'
|
|
181
|
-
},
|
|
224
|
+
}), /*#__PURE__*/_jsx(BottomSheetContent, {
|
|
182
225
|
children: /*#__PURE__*/_jsx(Text, {
|
|
183
226
|
typography: "body2",
|
|
184
227
|
lx: {
|
|
@@ -870,4 +913,68 @@ export const InfoStateVariants = {
|
|
|
870
913
|
});
|
|
871
914
|
}
|
|
872
915
|
};
|
|
916
|
+
export const WithFooter = {
|
|
917
|
+
args: {
|
|
918
|
+
hideCloseButton: false,
|
|
919
|
+
enableHandlePanningGesture: true,
|
|
920
|
+
enablePanDownToClose: true,
|
|
921
|
+
enableBlurKeyboardOnGesture: true,
|
|
922
|
+
enableDynamicSizing: true,
|
|
923
|
+
detached: false,
|
|
924
|
+
backdropPressBehavior: 'close'
|
|
925
|
+
},
|
|
926
|
+
render: args => {
|
|
927
|
+
const bottomSheetRef = useBottomSheetRef();
|
|
928
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
929
|
+
lx: {
|
|
930
|
+
height: 's320',
|
|
931
|
+
width: 'full',
|
|
932
|
+
alignItems: 'center',
|
|
933
|
+
justifyContent: 'center',
|
|
934
|
+
paddingTop: 's32'
|
|
935
|
+
},
|
|
936
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
937
|
+
size: "sm",
|
|
938
|
+
onPress: () => bottomSheetRef.current?.present(),
|
|
939
|
+
children: "Toggle open"
|
|
940
|
+
}), /*#__PURE__*/_jsxs(BottomSheet, {
|
|
941
|
+
...args,
|
|
942
|
+
ref: bottomSheetRef,
|
|
943
|
+
children: [/*#__PURE__*/_jsx(BottomSheetHeader, {
|
|
944
|
+
spacing: true,
|
|
945
|
+
title: "With Footer",
|
|
946
|
+
density: "compact",
|
|
947
|
+
description: "Scrollable content with a sticky footer"
|
|
948
|
+
}), /*#__PURE__*/_jsx(BottomSheetScrollView, {
|
|
949
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
950
|
+
lx: {
|
|
951
|
+
flexDirection: 'column',
|
|
952
|
+
gap: 's12'
|
|
953
|
+
},
|
|
954
|
+
children: Array.from({
|
|
955
|
+
length: 10
|
|
956
|
+
}).map((_, index) => /*#__PURE__*/_jsxs(Text, {
|
|
957
|
+
typography: "body2",
|
|
958
|
+
lx: {
|
|
959
|
+
color: 'base'
|
|
960
|
+
},
|
|
961
|
+
children: ["Item ", index + 1, ": Lorem ipsum dolor sit amet consectetur adipisicing elit. Vitae excepturi odit, quis tenetur iste perspiciatis mollitia porro velit laborum quasi numquam reiciendis dolor!"]
|
|
962
|
+
}, index))
|
|
963
|
+
})
|
|
964
|
+
}), /*#__PURE__*/_jsxs(BottomSheetFooter, {
|
|
965
|
+
children: [/*#__PURE__*/_jsx(Button, {
|
|
966
|
+
size: "lg",
|
|
967
|
+
isFull: true,
|
|
968
|
+
children: "Confirm"
|
|
969
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
970
|
+
size: "lg",
|
|
971
|
+
isFull: true,
|
|
972
|
+
appearance: "gray",
|
|
973
|
+
children: "Cancel"
|
|
974
|
+
})]
|
|
975
|
+
})]
|
|
976
|
+
})]
|
|
977
|
+
});
|
|
978
|
+
}
|
|
979
|
+
};
|
|
873
980
|
//# sourceMappingURL=BottomSheet.stories.js.map
|