@ledgerhq/lumen-ui-rnative 0.1.37 → 0.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/lib/Components/AmountInput/AmountInput.js +109 -72
- package/dist/module/lib/Components/AmountInput/AmountInput.js.map +1 -1
- package/dist/module/lib/Components/AmountInput/AmountInput.mdx +12 -0
- package/dist/module/lib/Components/AmountInput/AmountInput.stories.js +53 -0
- package/dist/module/lib/Components/AmountInput/AmountInput.stories.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.js +6 -5
- package/dist/module/lib/Components/Avatar/Avatar.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.mdx +2 -0
- package/dist/module/lib/Components/Avatar/Avatar.test.js +10 -13
- package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js +3 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js +1 -0
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js +33 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheetHeader.js +7 -3
- package/dist/module/lib/Components/BottomSheet/BottomSheetHeader.js.map +1 -1
- package/dist/module/lib/Components/DotIcon/DotIcon.js +7 -4
- package/dist/module/lib/Components/DotIcon/DotIcon.js.map +1 -1
- package/dist/module/lib/Components/DotIcon/DotIcon.stories.js +10 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.stories.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/DotIndicator.js +5 -5
- package/dist/module/lib/Components/DotIndicator/DotIndicator.js.map +1 -1
- package/dist/module/lib/Components/DotIndicator/DotIndicator.mdx +4 -4
- package/dist/module/lib/Components/DotIndicator/DotIndicator.stories.js +3 -3
- package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js +12 -2
- package/dist/module/lib/Components/DotIndicator/DotIndicator.test.js.map +1 -1
- package/dist/module/lib/Components/DotSymbol/DotSymbol.js +7 -4
- package/dist/module/lib/Components/DotSymbol/DotSymbol.js.map +1 -1
- package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js +19 -0
- package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js.map +1 -1
- package/dist/module/lib/Components/Label/Label.js +1 -1
- package/dist/module/lib/Components/MediaButton/MediaButton.js +2 -2
- package/dist/module/lib/Components/MediaButton/MediaButton.mdx +2 -2
- package/dist/module/lib/Components/MediaImage/MediaImage.js +4 -2
- package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.mdx +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js +12 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js.map +1 -1
- package/dist/module/lib/Components/OptionList/OptionList.mdx +1 -1
- package/dist/module/lib/Components/ThemeProvider/ThemeProvider.js +2 -5
- package/dist/module/lib/Components/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/module/lib/Components/index.js +0 -1
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/module/lib/Symbols/Icons/Lightbulb.js +3 -3
- package/dist/module/lib/Symbols/Icons/Lightbulb.js.map +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/types.d.ts +12 -0
- package/dist/typescript/src/lib/Components/AmountInput/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts +2 -2
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetHeader.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts +9 -0
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts +2 -1
- package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotIndicator/types.d.ts +2 -2
- package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Label/Label.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts +2 -2
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/index.d.ts +0 -1
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/lib/Components/AmountInput/AmountInput.mdx +12 -0
- package/src/lib/Components/AmountInput/AmountInput.stories.tsx +68 -1
- package/src/lib/Components/AmountInput/AmountInput.tsx +118 -75
- package/src/lib/Components/AmountInput/types.ts +14 -0
- package/src/lib/Components/Avatar/Avatar.mdx +2 -0
- package/src/lib/Components/Avatar/Avatar.test.tsx +16 -18
- package/src/lib/Components/Avatar/Avatar.tsx +9 -8
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +1 -0
- package/src/lib/Components/BottomSheet/BottomSheet.test.tsx +32 -1
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +10 -4
- package/src/lib/Components/BottomSheet/BottomSheetHeader.tsx +10 -6
- package/src/lib/Components/BottomSheet/types.ts +9 -0
- package/src/lib/Components/DotIcon/DotIcon.stories.tsx +8 -0
- package/src/lib/Components/DotIcon/DotIcon.tsx +4 -1
- package/src/lib/Components/DotIcon/types.ts +1 -1
- package/src/lib/Components/DotIndicator/DotIndicator.mdx +4 -4
- package/src/lib/Components/DotIndicator/DotIndicator.stories.tsx +2 -2
- package/src/lib/Components/DotIndicator/DotIndicator.test.tsx +12 -2
- package/src/lib/Components/DotIndicator/DotIndicator.tsx +5 -5
- package/src/lib/Components/DotIndicator/types.ts +2 -2
- package/src/lib/Components/DotSymbol/DotSymbol.stories.tsx +15 -0
- package/src/lib/Components/DotSymbol/DotSymbol.tsx +4 -1
- package/src/lib/Components/DotSymbol/types.ts +1 -1
- package/src/lib/Components/Label/Label.tsx +1 -1
- package/src/lib/Components/MediaButton/MediaButton.mdx +2 -2
- package/src/lib/Components/MediaButton/MediaButton.tsx +2 -2
- package/src/lib/Components/MediaImage/MediaImage.mdx +1 -1
- package/src/lib/Components/MediaImage/MediaImage.stories.tsx +3 -0
- package/src/lib/Components/MediaImage/MediaImage.tsx +2 -0
- package/src/lib/Components/MediaImage/types.ts +1 -1
- package/src/lib/Components/OptionList/OptionList.mdx +1 -1
- package/src/lib/Components/ThemeProvider/ThemeProvider.tsx +1 -4
- package/src/lib/Components/index.ts +0 -1
- package/src/lib/Symbols/Icons/Lightbulb.tsx +3 -3
- package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js +0 -155
- package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js.map +0 -1
- package/dist/module/lib/Components/Select/GlobalSelectContext.js +0 -78
- package/dist/module/lib/Components/Select/GlobalSelectContext.js.map +0 -1
- package/dist/module/lib/Components/Select/Select.js +0 -366
- package/dist/module/lib/Components/Select/Select.js.map +0 -1
- package/dist/module/lib/Components/Select/Select.mdx +0 -596
- package/dist/module/lib/Components/Select/Select.stories.js +0 -304
- package/dist/module/lib/Components/Select/Select.stories.js.map +0 -1
- package/dist/module/lib/Components/Select/Select.test.js +0 -123
- package/dist/module/lib/Components/Select/Select.test.js.map +0 -1
- package/dist/module/lib/Components/Select/SelectContext.js +0 -38
- package/dist/module/lib/Components/Select/SelectContext.js.map +0 -1
- package/dist/module/lib/Components/Select/index.js +0 -6
- package/dist/module/lib/Components/Select/index.js.map +0 -1
- package/dist/module/lib/Components/Select/types.js +0 -4
- package/dist/module/lib/Components/Select/types.js.map +0 -1
- package/dist/typescript/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts +0 -20
- package/dist/typescript/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/GlobalSelectContext.d.ts +0 -44
- package/dist/typescript/src/lib/Components/Select/GlobalSelectContext.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/Select.d.ts +0 -52
- package/dist/typescript/src/lib/Components/Select/Select.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/SelectContext.d.ts +0 -36
- package/dist/typescript/src/lib/Components/Select/SelectContext.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/index.d.ts +0 -4
- package/dist/typescript/src/lib/Components/Select/index.d.ts.map +0 -1
- package/dist/typescript/src/lib/Components/Select/types.d.ts +0 -130
- package/dist/typescript/src/lib/Components/Select/types.d.ts.map +0 -1
- package/src/lib/Components/Select/GlobalSelectBottomSheet.tsx +0 -180
- package/src/lib/Components/Select/GlobalSelectContext.tsx +0 -103
- package/src/lib/Components/Select/Select.mdx +0 -596
- package/src/lib/Components/Select/Select.stories.tsx +0 -266
- package/src/lib/Components/Select/Select.test.tsx +0 -117
- package/src/lib/Components/Select/Select.tsx +0 -469
- package/src/lib/Components/Select/SelectContext.tsx +0 -68
- package/src/lib/Components/Select/index.ts +0 -3
- package/src/lib/Components/Select/types.ts +0 -149
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { MediaButtonProps } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Media button for
|
|
3
|
+
* Media button for option list/dropdown components. Displays a label with an optional
|
|
4
4
|
* leading content and a trailing chevron indicator.
|
|
5
5
|
*
|
|
6
|
-
* This component is intended to be used exclusively as the trigger inside
|
|
6
|
+
* This component is intended to be used exclusively as the trigger inside an OptionList or
|
|
7
7
|
* dropdown pattern. It should not be used as a standalone action button — use `Button`
|
|
8
8
|
* or `IconButton` instead.
|
|
9
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaImage.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaImage/MediaImage.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MediaImage.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaImage/MediaImage.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAmB,MAAM,SAAS,CAAC;AAiBhF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAWtD,CAAC;AAgDF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,UAAU,GAAI,gGAYxB,eAAe,4CA+CjB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StyledViewProps } from '../../../styles';
|
|
2
|
-
export type MediaImageSize = 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64;
|
|
2
|
+
export type MediaImageSize = 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56 | 64 | 72;
|
|
3
3
|
export type MediaImageShape = 'square' | 'circle';
|
|
4
4
|
export type MediaImageProps = {
|
|
5
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaImage/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/MediaImage/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE7E,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/ThemeProvider/ThemeProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/ThemeProvider/ThemeProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAIlD,QAAA,MAAM,aAAa,GAAI,4CAKpB,kBAAkB,4CAUpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-rnative",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"!**/*.tsbuildinfo"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ledgerhq/lumen-utils-shared": "0.1.
|
|
45
|
+
"@ledgerhq/lumen-utils-shared": "0.1.5",
|
|
46
46
|
"i18next": "^23.7.0",
|
|
47
47
|
"react-i18next": "^14.0.0"
|
|
48
48
|
},
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"@types/react": "^19.0.0",
|
|
54
54
|
"@gorhom/bottom-sheet": "^5.0.0",
|
|
55
|
-
"@ledgerhq/lumen-design-core": "0.1.
|
|
55
|
+
"@ledgerhq/lumen-design-core": "0.1.16",
|
|
56
56
|
"react": "^19.0.0",
|
|
57
57
|
"react-native": "~0.79.7",
|
|
58
58
|
"react-native-reanimated": "^4.1.0",
|
|
@@ -29,6 +29,18 @@ AmountInput is a specialized input component designed for handling numeric value
|
|
|
29
29
|
|
|
30
30
|
> **Layout:** The AmountInput component takes the full width of its container by default. You can control the width by using the `style` prop or by wrapping in a container.
|
|
31
31
|
|
|
32
|
+
### Size
|
|
33
|
+
|
|
34
|
+
Use the `size` prop to control typography scale.
|
|
35
|
+
|
|
36
|
+
<Canvas of={AmountInputStories.Size} />
|
|
37
|
+
|
|
38
|
+
### Alignment
|
|
39
|
+
|
|
40
|
+
Use the `align` prop to position the amount within its container. Defaults to `center`. Use `start` or `end` for left- or right-aligned layouts.
|
|
41
|
+
|
|
42
|
+
<Canvas of={AmountInputStories.Alignment} />
|
|
43
|
+
|
|
32
44
|
### Currency Text Position
|
|
33
45
|
|
|
34
46
|
The currency text can be positioned on either the **left** (default) or **right** side of the input:
|
|
@@ -2,7 +2,18 @@ import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import { AmountInput } from './AmountInput';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
type AmountInputAlign,
|
|
7
|
+
type AmountInputProps,
|
|
8
|
+
type AmountInputSize,
|
|
9
|
+
} from './types';
|
|
10
|
+
|
|
11
|
+
const ALIGNMENTS: AmountInputAlign[] = ['start', 'center', 'end'];
|
|
12
|
+
|
|
13
|
+
const SIZES: { size: AmountInputSize; value: string }[] = [
|
|
14
|
+
{ size: 'md', value: '1234.56' },
|
|
15
|
+
{ size: 'sm', value: '55 555' },
|
|
16
|
+
];
|
|
6
17
|
|
|
7
18
|
const meta: Meta<typeof AmountInput> = {
|
|
8
19
|
component: AmountInput,
|
|
@@ -16,6 +27,15 @@ const meta: Meta<typeof AmountInput> = {
|
|
|
16
27
|
},
|
|
17
28
|
},
|
|
18
29
|
},
|
|
30
|
+
argTypes: {
|
|
31
|
+
isInvalid: {
|
|
32
|
+
control: 'boolean',
|
|
33
|
+
description: 'Marks the input as invalid for error styling.',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
args: {
|
|
37
|
+
isInvalid: false,
|
|
38
|
+
},
|
|
19
39
|
};
|
|
20
40
|
|
|
21
41
|
export default meta;
|
|
@@ -68,6 +88,53 @@ export const WithValue: Story = {
|
|
|
68
88
|
},
|
|
69
89
|
};
|
|
70
90
|
|
|
91
|
+
export const Size: Story = {
|
|
92
|
+
render: () => (
|
|
93
|
+
<View
|
|
94
|
+
style={{
|
|
95
|
+
width: '100%',
|
|
96
|
+
maxWidth: 320,
|
|
97
|
+
alignItems: 'center',
|
|
98
|
+
gap: 24,
|
|
99
|
+
padding: 24,
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
{SIZES.map(({ size, value }) => (
|
|
103
|
+
<AmountInput
|
|
104
|
+
key={size}
|
|
105
|
+
size={size}
|
|
106
|
+
value={value}
|
|
107
|
+
currencyText='$'
|
|
108
|
+
onChangeText={() => {}}
|
|
109
|
+
/>
|
|
110
|
+
))}
|
|
111
|
+
</View>
|
|
112
|
+
),
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const Alignment: Story = {
|
|
116
|
+
render: () => (
|
|
117
|
+
<View
|
|
118
|
+
style={{
|
|
119
|
+
width: '100%',
|
|
120
|
+
maxWidth: 320,
|
|
121
|
+
gap: 24,
|
|
122
|
+
padding: 24,
|
|
123
|
+
}}
|
|
124
|
+
>
|
|
125
|
+
{ALIGNMENTS.map((align) => (
|
|
126
|
+
<AmountInput
|
|
127
|
+
key={align}
|
|
128
|
+
align={align}
|
|
129
|
+
value='1234.56'
|
|
130
|
+
currencyText='$'
|
|
131
|
+
onChangeText={() => {}}
|
|
132
|
+
/>
|
|
133
|
+
))}
|
|
134
|
+
</View>
|
|
135
|
+
),
|
|
136
|
+
};
|
|
137
|
+
|
|
71
138
|
export const CurrencyPositionLeft: Story = {
|
|
72
139
|
render: (args) => <AmountInputStory {...args} />,
|
|
73
140
|
args: {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
useDisabledContext,
|
|
5
5
|
} from '@ledgerhq/lumen-utils-shared';
|
|
6
6
|
import { useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
7
|
-
import { Pressable, StyleSheet, TextInput } from 'react-native';
|
|
7
|
+
import { Pressable, StyleSheet, TextInput, View } from 'react-native';
|
|
8
8
|
import Animated, {
|
|
9
9
|
Easing,
|
|
10
10
|
useAnimatedStyle,
|
|
@@ -13,9 +13,13 @@ import Animated, {
|
|
|
13
13
|
withSequence,
|
|
14
14
|
withTiming,
|
|
15
15
|
} from 'react-native-reanimated';
|
|
16
|
-
import { useStyleSheet } from '../../../styles';
|
|
16
|
+
import { useStyleSheet, useTheme } from '../../../styles';
|
|
17
17
|
import { Box } from '../Utility';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
type AmountInputAlign,
|
|
20
|
+
type AmountInputProps,
|
|
21
|
+
type AmountInputSize,
|
|
22
|
+
} from './types';
|
|
19
23
|
|
|
20
24
|
/**
|
|
21
25
|
* AmountInput component for handling numeric input with currency display.
|
|
@@ -25,6 +29,8 @@ import { type AmountInputProps } from './types';
|
|
|
25
29
|
export const AmountInput = ({
|
|
26
30
|
lx = {},
|
|
27
31
|
style,
|
|
32
|
+
size = 'md',
|
|
33
|
+
align = 'center',
|
|
28
34
|
currencyText,
|
|
29
35
|
currencyPosition = 'left',
|
|
30
36
|
editable,
|
|
@@ -48,16 +54,20 @@ export const AmountInput = ({
|
|
|
48
54
|
});
|
|
49
55
|
|
|
50
56
|
const translateX = useSharedValue(0);
|
|
51
|
-
const animatedFontSize = useSharedValue(getFontSize(inputValue));
|
|
57
|
+
const animatedFontSize = useSharedValue(getFontSize(inputValue, size));
|
|
52
58
|
const caretOpacity = useSharedValue(0);
|
|
53
59
|
|
|
54
60
|
useImperativeHandle(ref, () => inputRef.current as TextInput, []);
|
|
55
61
|
|
|
62
|
+
const { theme } = useTheme();
|
|
56
63
|
const styles = useStyles({
|
|
64
|
+
size,
|
|
65
|
+
align,
|
|
57
66
|
hasValue: !!inputValue,
|
|
58
67
|
isEditable: !disabled,
|
|
59
68
|
isInvalid,
|
|
60
69
|
});
|
|
70
|
+
const caretFixedHeight = size === 'sm' ? theme.sizes.s28 : 0;
|
|
61
71
|
|
|
62
72
|
const animatedInputStyle = useAnimatedStyle(
|
|
63
73
|
() => ({
|
|
@@ -79,13 +89,13 @@ export const AmountInput = ({
|
|
|
79
89
|
const animatedCaretStyle = useAnimatedStyle(
|
|
80
90
|
() => ({
|
|
81
91
|
opacity: caretOpacity.value,
|
|
82
|
-
height: animatedFontSize.value,
|
|
92
|
+
height: size === 'sm' ? caretFixedHeight : animatedFontSize.value,
|
|
83
93
|
}),
|
|
84
|
-
[caretOpacity, animatedFontSize],
|
|
94
|
+
[caretOpacity, animatedFontSize, size, caretFixedHeight],
|
|
85
95
|
);
|
|
86
96
|
|
|
87
97
|
useEffect(() => {
|
|
88
|
-
const newSize = getFontSize(inputValue);
|
|
98
|
+
const newSize = getFontSize(inputValue, size);
|
|
89
99
|
|
|
90
100
|
translateX.value = withSequence(
|
|
91
101
|
withTiming(4, { duration: 0 }),
|
|
@@ -99,7 +109,7 @@ export const AmountInput = ({
|
|
|
99
109
|
duration: 250,
|
|
100
110
|
easing: Easing.bezier(0.4, 0, 0.2, 1),
|
|
101
111
|
});
|
|
102
|
-
}, [inputValue, animatedFontSize, translateX]);
|
|
112
|
+
}, [inputValue, size, animatedFontSize, translateX]);
|
|
103
113
|
|
|
104
114
|
useEffect(() => {
|
|
105
115
|
if (isFocused && !disabled) {
|
|
@@ -164,94 +174,127 @@ export const AmountInput = ({
|
|
|
164
174
|
style={styles.hiddenInput}
|
|
165
175
|
{...props}
|
|
166
176
|
/>
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
{currencyPosition === 'left' && CurrencyText}
|
|
173
|
-
|
|
174
|
-
{/** display text that mirrors the hidden input's value */}
|
|
175
|
-
<Animated.Text
|
|
176
|
-
style={[styles.displayText, animatedInputStyle, style]}
|
|
177
|
-
allowFontScaling={false}
|
|
177
|
+
<View style={styles.alignRow}>
|
|
178
|
+
<Pressable
|
|
179
|
+
onPress={handlePress}
|
|
180
|
+
style={styles.pressable}
|
|
181
|
+
accessibilityLabel={props.accessibilityLabel || 'Amount input'}
|
|
178
182
|
>
|
|
179
|
-
{
|
|
180
|
-
|
|
183
|
+
{currencyPosition === 'left' && CurrencyText}
|
|
184
|
+
|
|
185
|
+
{/** display text that mirrors the hidden input's value */}
|
|
186
|
+
<Animated.Text
|
|
187
|
+
style={[styles.displayText, animatedInputStyle, style]}
|
|
188
|
+
allowFontScaling={false}
|
|
189
|
+
>
|
|
190
|
+
{inputValue || '0'}
|
|
191
|
+
</Animated.Text>
|
|
181
192
|
|
|
182
|
-
|
|
183
|
-
|
|
193
|
+
{/** custom caret */}
|
|
194
|
+
<Animated.View style={[styles.caret, animatedCaretStyle]} />
|
|
184
195
|
|
|
185
|
-
|
|
186
|
-
|
|
196
|
+
{currencyPosition === 'right' && CurrencyText}
|
|
197
|
+
</Pressable>
|
|
198
|
+
</View>
|
|
187
199
|
</Box>
|
|
188
200
|
);
|
|
189
201
|
};
|
|
190
202
|
|
|
203
|
+
const SIZE_TYPOGRAPHY = {
|
|
204
|
+
md: 'heading0SemiBold',
|
|
205
|
+
sm: 'heading2SemiBold',
|
|
206
|
+
} as const satisfies Record<
|
|
207
|
+
AmountInputSize,
|
|
208
|
+
'heading0SemiBold' | 'heading2SemiBold'
|
|
209
|
+
>;
|
|
210
|
+
|
|
211
|
+
const ALIGN_ROW_JUSTIFY = {
|
|
212
|
+
center: 'center',
|
|
213
|
+
start: 'flex-start',
|
|
214
|
+
end: 'flex-end',
|
|
215
|
+
} as const satisfies Record<
|
|
216
|
+
AmountInputAlign,
|
|
217
|
+
'center' | 'flex-start' | 'flex-end'
|
|
218
|
+
>;
|
|
219
|
+
|
|
191
220
|
const useStyles = ({
|
|
221
|
+
size,
|
|
222
|
+
align,
|
|
192
223
|
hasValue,
|
|
193
224
|
isEditable,
|
|
194
225
|
isInvalid,
|
|
195
226
|
}: {
|
|
227
|
+
size: AmountInputSize;
|
|
228
|
+
align: AmountInputAlign;
|
|
196
229
|
hasValue: boolean;
|
|
197
230
|
isEditable: boolean;
|
|
198
231
|
isInvalid: boolean;
|
|
199
232
|
}) => {
|
|
200
233
|
return useStyleSheet(
|
|
201
|
-
(t) =>
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
opacity: 0,
|
|
210
|
-
},
|
|
211
|
-
pressable: {
|
|
212
|
-
flexDirection: 'row',
|
|
213
|
-
alignItems: 'center',
|
|
214
|
-
justifyContent: 'center',
|
|
215
|
-
},
|
|
216
|
-
displayText: StyleSheet.flatten([
|
|
217
|
-
{
|
|
218
|
-
height: t.sizes.s56,
|
|
219
|
-
backgroundColor: 'transparent',
|
|
220
|
-
color: t.colors.text.base,
|
|
221
|
-
alignItems: 'flex-start',
|
|
222
|
-
...t.typographies.heading0SemiBold,
|
|
223
|
-
},
|
|
224
|
-
!hasValue && {
|
|
225
|
-
color: t.colors.text.mutedSubtle,
|
|
226
|
-
},
|
|
227
|
-
!isEditable && {
|
|
228
|
-
color: t.colors.text.disabled,
|
|
229
|
-
},
|
|
230
|
-
isInvalid && {
|
|
231
|
-
color: t.colors.text.error,
|
|
234
|
+
(t) => {
|
|
235
|
+
const typography = t.typographies[SIZE_TYPOGRAPHY[size]];
|
|
236
|
+
const displayHeight = size === 'md' ? t.sizes.s56 : t.sizes.s36;
|
|
237
|
+
|
|
238
|
+
return {
|
|
239
|
+
container: {
|
|
240
|
+
position: 'relative',
|
|
241
|
+
width: t.sizes.full,
|
|
232
242
|
},
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
243
|
+
hiddenInput: {
|
|
244
|
+
position: 'absolute',
|
|
245
|
+
width: t.sizes.full,
|
|
246
|
+
height: t.sizes.full,
|
|
247
|
+
opacity: 0,
|
|
238
248
|
},
|
|
239
|
-
|
|
240
|
-
|
|
249
|
+
alignRow: {
|
|
250
|
+
width: t.sizes.full,
|
|
251
|
+
flexDirection: 'row',
|
|
252
|
+
justifyContent: ALIGN_ROW_JUSTIFY[align],
|
|
241
253
|
},
|
|
242
|
-
|
|
243
|
-
|
|
254
|
+
pressable: {
|
|
255
|
+
flexDirection: 'row',
|
|
256
|
+
alignItems: 'center',
|
|
244
257
|
},
|
|
245
|
-
|
|
246
|
-
|
|
258
|
+
displayText: StyleSheet.flatten([
|
|
259
|
+
{
|
|
260
|
+
height: displayHeight,
|
|
261
|
+
backgroundColor: 'transparent',
|
|
262
|
+
color: t.colors.text.base,
|
|
263
|
+
alignItems: 'flex-start',
|
|
264
|
+
...typography,
|
|
265
|
+
},
|
|
266
|
+
!hasValue && {
|
|
267
|
+
color: t.colors.text.mutedSubtle,
|
|
268
|
+
},
|
|
269
|
+
!isEditable && {
|
|
270
|
+
color: t.colors.text.disabled,
|
|
271
|
+
},
|
|
272
|
+
isInvalid && {
|
|
273
|
+
color: t.colors.text.error,
|
|
274
|
+
},
|
|
275
|
+
]),
|
|
276
|
+
currency: StyleSheet.flatten([
|
|
277
|
+
{
|
|
278
|
+
color: t.colors.text.base,
|
|
279
|
+
...typography,
|
|
280
|
+
},
|
|
281
|
+
!hasValue && {
|
|
282
|
+
color: t.colors.text.mutedSubtle,
|
|
283
|
+
},
|
|
284
|
+
!isEditable && {
|
|
285
|
+
color: t.colors.text.disabled,
|
|
286
|
+
},
|
|
287
|
+
isInvalid && {
|
|
288
|
+
color: t.colors.text.error,
|
|
289
|
+
},
|
|
290
|
+
]),
|
|
291
|
+
caret: {
|
|
292
|
+
marginHorizontal: t.spacings.s2,
|
|
293
|
+
width: t.sizes.s2,
|
|
294
|
+
backgroundColor: t.colors.text.active,
|
|
247
295
|
},
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
width: t.sizes.s2,
|
|
252
|
-
backgroundColor: t.colors.text.active,
|
|
253
|
-
},
|
|
254
|
-
}),
|
|
255
|
-
[hasValue, isEditable, isInvalid],
|
|
296
|
+
};
|
|
297
|
+
},
|
|
298
|
+
[size, align, hasValue, isEditable, isInvalid],
|
|
256
299
|
);
|
|
257
300
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { TextInputProps, ViewStyle } from 'react-native';
|
|
2
2
|
import type { BoxProps } from '../Utility';
|
|
3
3
|
|
|
4
|
+
export type AmountInputSize = 'md' | 'sm';
|
|
5
|
+
|
|
6
|
+
export type AmountInputAlign = 'center' | 'start' | 'end';
|
|
7
|
+
|
|
4
8
|
export type AmountInputProps = Omit<
|
|
5
9
|
TextInputProps,
|
|
6
10
|
'value' | 'onChangeText'
|
|
@@ -15,6 +19,16 @@ export type AmountInputProps = Omit<
|
|
|
15
19
|
* @required
|
|
16
20
|
*/
|
|
17
21
|
onChangeText: (text: string) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Visual size of the amount input.
|
|
24
|
+
* @default 'md'
|
|
25
|
+
*/
|
|
26
|
+
size?: AmountInputSize;
|
|
27
|
+
/**
|
|
28
|
+
* Horizontal alignment of the amount and currency.
|
|
29
|
+
* @default 'center'
|
|
30
|
+
*/
|
|
31
|
+
align?: AmountInputAlign;
|
|
18
32
|
/**
|
|
19
33
|
* The currency text (e.g. USD, EUR)
|
|
20
34
|
*/
|
|
@@ -55,6 +55,8 @@ An optional notification indicator can be displayed to show status or alerts:
|
|
|
55
55
|
|
|
56
56
|
- **showNotification**: Boolean prop to toggle the notification dot (default: false)
|
|
57
57
|
|
|
58
|
+
> The notification dot is only rendered on the `sm` and `md` sizes. It is suppressed on `lg` and `xl` even when `showNotification` is `true`.
|
|
59
|
+
|
|
58
60
|
<Canvas of={AvatarStories.NotificationShowcase} />
|
|
59
61
|
|
|
60
62
|
### As Interactive Trigger
|
|
@@ -195,26 +195,24 @@ describe('Avatar Component', () => {
|
|
|
195
195
|
|
|
196
196
|
dot = toJSON().children[0];
|
|
197
197
|
expect(dot.props.style.height).toBe(sizes.s12);
|
|
198
|
-
|
|
199
|
-
rerender(
|
|
200
|
-
<TestWrapper>
|
|
201
|
-
<Avatar testID='avatar-id' size='lg' showNotification />
|
|
202
|
-
</TestWrapper>,
|
|
203
|
-
);
|
|
204
|
-
|
|
205
|
-
dot = toJSON().children[0];
|
|
206
|
-
expect(dot.props.style.height).toBe(sizes.s14);
|
|
207
|
-
|
|
208
|
-
rerender(
|
|
209
|
-
<TestWrapper>
|
|
210
|
-
<Avatar testID='avatar-id' size='xl' showNotification />
|
|
211
|
-
</TestWrapper>,
|
|
212
|
-
);
|
|
213
|
-
|
|
214
|
-
dot = toJSON().children[0];
|
|
215
|
-
expect(dot.props.style.height).toBe(sizes.s16);
|
|
216
198
|
});
|
|
217
199
|
|
|
200
|
+
it.each(['lg', 'xl'] as const)(
|
|
201
|
+
'should not render the notification indicator on size=%s even when showNotification is true',
|
|
202
|
+
(size) => {
|
|
203
|
+
const { toJSON } = render(
|
|
204
|
+
<TestWrapper>
|
|
205
|
+
<Avatar testID='avatar-id' size={size} showNotification />
|
|
206
|
+
</TestWrapper>,
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
const tree = toJSON();
|
|
210
|
+
expect(tree.props.testID).toBe('avatar-id');
|
|
211
|
+
expect(tree.props.accessibilityRole).toBe('image');
|
|
212
|
+
expect(tree.props.accessibilityLabel).toBe('avatar');
|
|
213
|
+
},
|
|
214
|
+
);
|
|
215
|
+
|
|
218
216
|
it('should apply custom styles', () => {
|
|
219
217
|
const customStyle = { borderWidth: 2 };
|
|
220
218
|
const { getByTestId } = render(
|
|
@@ -16,14 +16,11 @@ const fallbackSizes = {
|
|
|
16
16
|
xl: 40,
|
|
17
17
|
} as const;
|
|
18
18
|
|
|
19
|
-
const dotSizeMap:
|
|
20
|
-
Size,
|
|
21
|
-
NonNullable<React.ComponentProps<typeof DotIndicator>['size']>
|
|
19
|
+
const dotSizeMap: Partial<
|
|
20
|
+
Record<Size, NonNullable<React.ComponentProps<typeof DotIndicator>['size']>>
|
|
22
21
|
> = {
|
|
23
|
-
sm: '
|
|
24
|
-
md: '
|
|
25
|
-
lg: 'md',
|
|
26
|
-
xl: 'lg',
|
|
22
|
+
sm: 'lg',
|
|
23
|
+
md: 'xl',
|
|
27
24
|
};
|
|
28
25
|
|
|
29
26
|
const useStyles = ({ size }: { size: Size }) => {
|
|
@@ -81,7 +78,7 @@ export const Avatar = ({
|
|
|
81
78
|
src,
|
|
82
79
|
alt = 'avatar',
|
|
83
80
|
size = 'md',
|
|
84
|
-
showNotification = false,
|
|
81
|
+
showNotification: showNotificationProp = false,
|
|
85
82
|
testID,
|
|
86
83
|
ref,
|
|
87
84
|
...props
|
|
@@ -93,6 +90,10 @@ export const Avatar = ({
|
|
|
93
90
|
|
|
94
91
|
const resolvedAlt = alt || t('components.avatar.defaultAlt');
|
|
95
92
|
|
|
93
|
+
// dot indicator is not visible on larger sizes, regardless of the `showNotification` prop
|
|
94
|
+
const showNotification =
|
|
95
|
+
showNotificationProp && (size === 'sm' || size === 'md');
|
|
96
|
+
|
|
96
97
|
const accessibilityLabel = showNotification
|
|
97
98
|
? `${resolvedAlt}, ${t('components.avatar.notificationAriaLabel')}`
|
|
98
99
|
: resolvedAlt;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { describe, it, expect, jest } from '@jest/globals';
|
|
2
2
|
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
3
|
import type { RenderOptions } from '@testing-library/react-native';
|
|
4
|
-
import { render } from '@testing-library/react-native';
|
|
4
|
+
import { fireEvent, render } from '@testing-library/react-native';
|
|
5
5
|
import { Text, View } from 'react-native';
|
|
6
6
|
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
7
7
|
import { BottomSheet as BottomSheetComponent } from './BottomSheet';
|
|
8
|
+
import { BottomSheetHeader } from './BottomSheetHeader';
|
|
8
9
|
// Mock react-native-gesture-handler which is used by @gorhom/bottom-sheet
|
|
9
10
|
jest.mock('react-native-gesture-handler', () => ({}));
|
|
10
11
|
|
|
@@ -339,6 +340,36 @@ describe('BottomSheet', () => {
|
|
|
339
340
|
expect(onDismiss).not.toHaveBeenCalled();
|
|
340
341
|
});
|
|
341
342
|
|
|
343
|
+
it('calls onHeaderClosePressed when the header close button is pressed', () => {
|
|
344
|
+
const { BottomSheet } = require('./BottomSheet');
|
|
345
|
+
const onHeaderClosePressed = jest.fn();
|
|
346
|
+
const { getByTestId } = renderWithTheme(
|
|
347
|
+
<BottomSheet
|
|
348
|
+
onHeaderClosePressed={onHeaderClosePressed}
|
|
349
|
+
testID='bottom-sheet'
|
|
350
|
+
>
|
|
351
|
+
<BottomSheetHeader title='Title' />
|
|
352
|
+
</BottomSheet>,
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
fireEvent.press(getByTestId('bottom-sheet-header-close-button'));
|
|
356
|
+
|
|
357
|
+
expect(onHeaderClosePressed).toHaveBeenCalledTimes(1);
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
it('does not require onHeaderClosePressed to close from the header', () => {
|
|
361
|
+
const { BottomSheet } = require('./BottomSheet');
|
|
362
|
+
const { getByTestId } = renderWithTheme(
|
|
363
|
+
<BottomSheet testID='bottom-sheet'>
|
|
364
|
+
<BottomSheetHeader title='Title' />
|
|
365
|
+
</BottomSheet>,
|
|
366
|
+
);
|
|
367
|
+
|
|
368
|
+
expect(() =>
|
|
369
|
+
fireEvent.press(getByTestId('bottom-sheet-header-close-button')),
|
|
370
|
+
).not.toThrow();
|
|
371
|
+
});
|
|
372
|
+
|
|
342
373
|
it('accepts multiple callbacks simultaneously', () => {
|
|
343
374
|
const { BottomSheet } = require('./BottomSheet');
|
|
344
375
|
const onOpen = jest.fn();
|