@ledgerhq/lumen-ui-rnative 0.1.58 → 0.1.59
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/animations/Pulse/Pulse.stories.js +9 -0
- package/dist/module/lib/Components/animations/Pulse/Pulse.stories.js.map +1 -1
- package/dist/module/lib/Components/animations/Spin/Spin.stories.js +3 -0
- package/dist/module/lib/Components/animations/Spin/Spin.stories.js.map +1 -1
- package/dist/module/lib/Components/core/AddressInput/AddressInput.figma.js +4 -0
- package/dist/module/lib/Components/core/AddressInput/AddressInput.figma.js.map +1 -1
- package/dist/module/lib/Components/core/AddressInput/AddressInput.js +18 -6
- package/dist/module/lib/Components/core/AddressInput/AddressInput.js.map +1 -1
- package/dist/module/lib/Components/core/AddressInput/AddressInput.mdx +26 -1
- package/dist/module/lib/Components/core/AddressInput/AddressInput.stories.js +30 -0
- package/dist/module/lib/Components/core/AddressInput/AddressInput.stories.js.map +1 -1
- package/dist/module/lib/Components/core/AmountDisplay/AmountDisplay.stories.js +6 -0
- package/dist/module/lib/Components/core/AmountDisplay/AmountDisplay.stories.js.map +1 -1
- package/dist/module/lib/Components/core/AmountInput/AmountInput.stories.js +64 -44
- package/dist/module/lib/Components/core/AmountInput/AmountInput.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Banner/Banner.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Button/Button.stories.js +21 -0
- package/dist/module/lib/Components/core/Button/Button.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Card/Card.js +15 -10
- package/dist/module/lib/Components/core/Card/Card.js.map +1 -1
- package/dist/module/lib/Components/core/Card/Card.stories.js +19 -2
- package/dist/module/lib/Components/core/Card/Card.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Card/Card.test.js +8 -3
- package/dist/module/lib/Components/core/Card/Card.test.js.map +1 -1
- package/dist/module/lib/Components/core/CardButton/CardButton.stories.js +15 -0
- package/dist/module/lib/Components/core/CardButton/CardButton.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Checkbox/Checkbox.stories.js.map +1 -1
- package/dist/module/lib/Components/core/ContentBanner/ContentBanner.stories.js +13 -0
- package/dist/module/lib/Components/core/ContentBanner/ContentBanner.stories.js.map +1 -1
- package/dist/module/lib/Components/core/DescriptionItem/DescriptionItem.stories.js +11 -0
- package/dist/module/lib/Components/core/DescriptionItem/DescriptionItem.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Divider/Divider.stories.js.map +1 -1
- package/dist/module/lib/Components/core/IconButton/IconButton.stories.js +10 -0
- package/dist/module/lib/Components/core/IconButton/IconButton.stories.js.map +1 -1
- package/dist/module/lib/Components/core/InteractiveIcon/InteractiveIcon.stories.js +12 -0
- package/dist/module/lib/Components/core/InteractiveIcon/InteractiveIcon.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Link/Link.stories.js.map +1 -1
- package/dist/module/lib/Components/core/ListItem/ListItem.stories.js +21 -3
- package/dist/module/lib/Components/core/ListItem/ListItem.stories.js.map +1 -1
- package/dist/module/lib/Components/core/MediaBanner/MediaBanner.stories.js +18 -1
- package/dist/module/lib/Components/core/MediaBanner/MediaBanner.stories.js.map +1 -1
- package/dist/module/lib/Components/core/MediaButton/MediaButton.stories.js +9 -0
- package/dist/module/lib/Components/core/MediaButton/MediaButton.stories.js.map +1 -1
- package/dist/module/lib/Components/core/MediaCard/MediaCard.stories.js +13 -0
- package/dist/module/lib/Components/core/MediaCard/MediaCard.stories.js.map +1 -1
- package/dist/module/lib/Components/core/MediaTag/MediaTag.stories.js +13 -0
- package/dist/module/lib/Components/core/MediaTag/MediaTag.stories.js.map +1 -1
- package/dist/module/lib/Components/core/NavBar/NavBar.stories.js.map +1 -1
- package/dist/module/lib/Components/core/OptionList/OptionList.stories.js +52 -0
- package/dist/module/lib/Components/core/OptionList/OptionList.stories.js.map +1 -1
- package/dist/module/lib/Components/core/SearchInput/SearchInput.stories.js.map +1 -1
- package/dist/module/lib/Components/core/SectionHeader/SectionHeader.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Skeleton/Skeleton.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Spinner/Spinner.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Spot/Spot.stories.js +20 -0
- package/dist/module/lib/Components/core/Spot/Spot.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Stepper/Stepper.stories.js +4 -0
- package/dist/module/lib/Components/core/Stepper/Stepper.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Subheader/Subheader.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Switch/Switch.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Tag/Tag.stories.js +12 -0
- package/dist/module/lib/Components/core/Tag/Tag.stories.js.map +1 -1
- package/dist/module/lib/Components/core/TextInput/TextInput.figma.js +4 -0
- package/dist/module/lib/Components/core/TextInput/TextInput.figma.js.map +1 -1
- package/dist/module/lib/Components/core/TextInput/TextInput.mdx +25 -0
- package/dist/module/lib/Components/core/TextInput/TextInput.stories.js +29 -0
- package/dist/module/lib/Components/core/TextInput/TextInput.stories.js.map +1 -1
- package/dist/module/lib/Components/core/TextInput/TextInput.test.js +125 -2
- package/dist/module/lib/Components/core/TextInput/TextInput.test.js.map +1 -1
- package/dist/module/lib/Components/core/Tile/Tile.stories.js +23 -1
- package/dist/module/lib/Components/core/Tile/Tile.stories.js.map +1 -1
- package/dist/module/lib/Components/core/TileButton/TileButton.stories.js +24 -0
- package/dist/module/lib/Components/core/TileButton/TileButton.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Tooltip/Tooltip.stories.js +12 -0
- package/dist/module/lib/Components/core/Tooltip/Tooltip.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Trend/Trend.stories.js +9 -0
- package/dist/module/lib/Components/core/Trend/Trend.stories.js.map +1 -1
- package/dist/module/lib/Components/internal/BaseInput/BaseInput.js +114 -201
- package/dist/module/lib/Components/internal/BaseInput/BaseInput.js.map +1 -1
- package/dist/module/lib/Components/internal/BaseInput/BaseInputCounter.js +32 -0
- package/dist/module/lib/Components/internal/BaseInput/BaseInputCounter.js.map +1 -0
- package/dist/module/lib/Components/internal/BaseInput/BaseInputHelperText.js +60 -0
- package/dist/module/lib/Components/internal/BaseInput/BaseInputHelperText.js.map +1 -0
- package/dist/module/lib/Components/internal/BaseInput/BaseInputLabel.js +126 -0
- package/dist/module/lib/Components/internal/BaseInput/BaseInputLabel.js.map +1 -0
- package/dist/module/lib/Components/internal/BaseInput/multilineLayout.js +34 -0
- package/dist/module/lib/Components/internal/BaseInput/multilineLayout.js.map +1 -0
- package/dist/module/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.js +46 -0
- package/dist/module/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.js.map +1 -0
- package/dist/module/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.test.js +111 -0
- package/dist/module/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.test.js.map +1 -0
- package/dist/module/lib/Components/primitives/Box/Box.stories.js.map +1 -1
- package/dist/module/lib/Components/primitives/Gradient/LinearGradient/LinearGradient.stories.js +14 -0
- package/dist/module/lib/Components/primitives/Gradient/LinearGradient/LinearGradient.stories.js.map +1 -1
- package/dist/module/lib/Components/primitives/Gradient/RadialGradient/RadialGradient.stories.js +8 -0
- package/dist/module/lib/Components/primitives/Gradient/RadialGradient/RadialGradient.stories.js.map +1 -1
- package/dist/module/lib/Components/primitives/Pressable/Pressable.stories.js.map +1 -1
- package/dist/module/lib/Components/primitives/Text/Text.stories.js.map +1 -1
- package/dist/module/lib/Components/symbols/Icon/Icon.stories.js.map +1 -1
- package/dist/typescript/src/lib/Components/core/AddressInput/AddressInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/core/AddressInput/AddressInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Card/Card.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/SearchInput/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/core/SearchInput/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/internal/BaseInput/BaseInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/internal/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/internal/BaseInput/BaseInputCounter.d.ts +8 -0
- package/dist/typescript/src/lib/Components/internal/BaseInput/BaseInputCounter.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/internal/BaseInput/BaseInputHelperText.d.ts +8 -0
- package/dist/typescript/src/lib/Components/internal/BaseInput/BaseInputHelperText.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/internal/BaseInput/BaseInputLabel.d.ts +8 -0
- package/dist/typescript/src/lib/Components/internal/BaseInput/BaseInputLabel.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/internal/BaseInput/multilineLayout.d.ts +27 -0
- package/dist/typescript/src/lib/Components/internal/BaseInput/multilineLayout.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/internal/BaseInput/types.d.ts +48 -1
- package/dist/typescript/src/lib/Components/internal/BaseInput/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.d.ts +27 -0
- package/dist/typescript/src/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/lib/Components/animations/Pulse/Pulse.stories.tsx +7 -2
- package/src/lib/Components/animations/Spin/Spin.stories.tsx +5 -2
- package/src/lib/Components/core/AddressInput/AddressInput.figma.tsx +4 -0
- package/src/lib/Components/core/AddressInput/AddressInput.mdx +26 -1
- package/src/lib/Components/core/AddressInput/AddressInput.stories.tsx +30 -2
- package/src/lib/Components/core/AddressInput/AddressInput.tsx +24 -8
- package/src/lib/Components/core/AmountDisplay/AmountDisplay.stories.tsx +8 -2
- package/src/lib/Components/core/AmountInput/AmountInput.stories.tsx +33 -13
- package/src/lib/Components/core/Avatar/Avatar.stories.tsx +1 -1
- package/src/lib/Components/core/AvatarButton/AvatarButton.stories.tsx +1 -1
- package/src/lib/Components/core/Banner/Banner.stories.tsx +2 -2
- package/src/lib/Components/core/Button/Button.stories.tsx +23 -2
- package/src/lib/Components/core/Card/Card.stories.tsx +19 -2
- package/src/lib/Components/core/Card/Card.test.tsx +10 -3
- package/src/lib/Components/core/Card/Card.tsx +20 -9
- package/src/lib/Components/core/CardButton/CardButton.stories.tsx +17 -2
- package/src/lib/Components/core/Checkbox/Checkbox.stories.tsx +3 -3
- package/src/lib/Components/core/ContentBanner/ContentBanner.stories.tsx +15 -2
- package/src/lib/Components/core/DescriptionItem/DescriptionItem.stories.tsx +13 -2
- package/src/lib/Components/core/Divider/Divider.stories.tsx +2 -2
- package/src/lib/Components/core/DotCount/DotCount.stories.tsx +1 -1
- package/src/lib/Components/core/DotIcon/DotIcon.stories.tsx +1 -1
- package/src/lib/Components/core/DotIndicator/DotIndicator.stories.tsx +1 -1
- package/src/lib/Components/core/DotSymbol/DotSymbol.stories.tsx +1 -1
- package/src/lib/Components/core/IconButton/IconButton.stories.tsx +12 -2
- package/src/lib/Components/core/InteractiveIcon/InteractiveIcon.stories.tsx +14 -2
- package/src/lib/Components/core/Link/Link.stories.tsx +2 -2
- package/src/lib/Components/core/ListItem/ListItem.stories.tsx +18 -0
- package/src/lib/Components/core/MediaBanner/MediaBanner.stories.tsx +19 -2
- package/src/lib/Components/core/MediaButton/MediaButton.stories.tsx +11 -2
- package/src/lib/Components/core/MediaCard/MediaCard.stories.tsx +13 -0
- package/src/lib/Components/core/MediaImage/MediaImage.stories.tsx +1 -1
- package/src/lib/Components/core/MediaTag/MediaTag.stories.tsx +15 -2
- package/src/lib/Components/core/NavBar/NavBar.stories.tsx +2 -2
- package/src/lib/Components/core/OptionList/OptionList.stories.tsx +52 -0
- package/src/lib/Components/core/PageIndicator/PageIndicator.stories.tsx +1 -1
- package/src/lib/Components/core/SearchInput/SearchInput.stories.tsx +2 -2
- package/src/lib/Components/core/SearchInput/types.ts +4 -1
- package/src/lib/Components/core/SectionHeader/SectionHeader.stories.tsx +2 -2
- package/src/lib/Components/core/SegmentedControl/SegmentedControl.stories.tsx +1 -1
- package/src/lib/Components/core/Skeleton/Skeleton.stories.tsx +2 -2
- package/src/lib/Components/core/Spinner/Spinner.stories.tsx +2 -2
- package/src/lib/Components/core/Spot/Spot.stories.tsx +22 -2
- package/src/lib/Components/core/Stepper/Stepper.stories.tsx +6 -2
- package/src/lib/Components/core/Subheader/Subheader.stories.tsx +2 -2
- package/src/lib/Components/core/Switch/Switch.stories.tsx +3 -3
- package/src/lib/Components/core/TabBar/TabBar.stories.tsx +1 -1
- package/src/lib/Components/core/Tag/Tag.stories.tsx +14 -2
- package/src/lib/Components/core/TextInput/TextInput.figma.tsx +4 -0
- package/src/lib/Components/core/TextInput/TextInput.mdx +25 -0
- package/src/lib/Components/core/TextInput/TextInput.stories.tsx +29 -2
- package/src/lib/Components/core/TextInput/TextInput.test.tsx +129 -2
- package/src/lib/Components/core/Tile/Tile.stories.tsx +24 -2
- package/src/lib/Components/core/TileButton/TileButton.stories.tsx +26 -2
- package/src/lib/Components/core/Tooltip/Tooltip.stories.tsx +14 -2
- package/src/lib/Components/core/Trend/Trend.stories.tsx +11 -2
- package/src/lib/Components/internal/BaseInput/BaseInput.tsx +123 -242
- package/src/lib/Components/internal/BaseInput/BaseInputCounter.tsx +35 -0
- package/src/lib/Components/internal/BaseInput/BaseInputHelperText.tsx +57 -0
- package/src/lib/Components/internal/BaseInput/BaseInputLabel.tsx +137 -0
- package/src/lib/Components/internal/BaseInput/multilineLayout.ts +49 -0
- package/src/lib/Components/internal/BaseInput/types.ts +49 -1
- package/src/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.test.ts +110 -0
- package/src/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.ts +72 -0
- package/src/lib/Components/primitives/Box/Box.stories.tsx +2 -2
- package/src/lib/Components/primitives/Gradient/LinearGradient/LinearGradient.stories.tsx +6 -2
- package/src/lib/Components/primitives/Gradient/RadialGradient/RadialGradient.stories.tsx +5 -2
- package/src/lib/Components/primitives/Pressable/Pressable.stories.tsx +2 -2
- package/src/lib/Components/primitives/Text/Text.stories.tsx +2 -2
- package/src/lib/Components/symbols/Icon/Icon.stories.tsx +2 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { LumenStyleSheetTheme } from '../../../../styles';
|
|
2
|
+
type MultilineLayout = {
|
|
3
|
+
lineHeight: number;
|
|
4
|
+
labelRowHeight: number;
|
|
5
|
+
paddingVertical: number;
|
|
6
|
+
};
|
|
7
|
+
type MultilineMinHeightArgs = {
|
|
8
|
+
hasLabel: boolean;
|
|
9
|
+
minLines: number;
|
|
10
|
+
maxLines: number | undefined;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Vertical layout values a multiline `BaseInput` is laid out from. A label floats
|
|
14
|
+
* over the field and shrinks its text to `body2`, which moves all three.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare const getMultilineLayout: (t: LumenStyleSheetTheme, hasLabel: boolean) => MultilineLayout;
|
|
19
|
+
/**
|
|
20
|
+
* Height floor of a multiline `BaseInput`: `minLines` of text — never more than
|
|
21
|
+
* `maxLines` — plus the label row and the vertical padding.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare const getMultilineMinHeight: (t: LumenStyleSheetTheme, { hasLabel, minLines, maxLines }: MultilineMinHeightArgs) => number;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=multilineLayout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multilineLayout.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/internal/BaseInput/multilineLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,KAAK,eAAe,GAAG;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,GAAG,oBAAoB,EACvB,UAAU,OAAO,KAChB,eAMD,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,GAAG,oBAAoB,EACvB,kCAAkC,sBAAsB,KACvD,MAQF,CAAC"}
|
|
@@ -63,6 +63,7 @@ export type BaseInputProps = {
|
|
|
63
63
|
prefix?: React.ReactNode;
|
|
64
64
|
/**
|
|
65
65
|
* Optional function to extend the default clear behavior with custom logic.
|
|
66
|
+
* Called after the field is emptied. Clearing always calls `onChangeText('')`
|
|
66
67
|
*/
|
|
67
68
|
onClear?: () => void;
|
|
68
69
|
/**
|
|
@@ -70,7 +71,53 @@ export type BaseInputProps = {
|
|
|
70
71
|
* @default false
|
|
71
72
|
*/
|
|
72
73
|
hideClearButton?: boolean;
|
|
73
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Renders a multi-line field that auto-grows between `minLines` and `maxLines`.
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
multiline?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Minimum height of the field, in lines. Ignored unless `multiline` is set.
|
|
81
|
+
* @default 1
|
|
82
|
+
*/
|
|
83
|
+
minLines?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Growth ceiling, in lines; past it the field scrolls internally. Unbounded when
|
|
86
|
+
* omitted. Ignored unless `multiline` is set.
|
|
87
|
+
*/
|
|
88
|
+
maxLines?: number;
|
|
89
|
+
} & Omit<TextInputProps, 'style' | 'multiline' | 'numberOfLines'> & BoxProps;
|
|
90
|
+
export type BaseInputLabelProps = {
|
|
91
|
+
/**
|
|
92
|
+
* Whether the input currently has focus, which floats the label.
|
|
93
|
+
*/
|
|
94
|
+
isFocused: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Whether the input holds a value, which keeps the label floated.
|
|
97
|
+
*/
|
|
98
|
+
hasContent: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Whether the clear button is visible, which narrows the label to avoid it.
|
|
101
|
+
*/
|
|
102
|
+
showClearButton: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Whether the input is editable, driving the disabled label colour.
|
|
105
|
+
*/
|
|
106
|
+
isEditable: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Keeps the label floated even when empty and unfocused, used when a label
|
|
109
|
+
* and a placeholder are displayed together.
|
|
110
|
+
*/
|
|
111
|
+
labelStaysFloatedWithPlaceholder: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Additional styles to apply to the label element.
|
|
114
|
+
*/
|
|
115
|
+
style?: StyleProp<TextStyle>;
|
|
116
|
+
/**
|
|
117
|
+
* The label copy.
|
|
118
|
+
*/
|
|
119
|
+
children: React.ReactNode;
|
|
120
|
+
} & Pick<BaseInputProps, 'status'>;
|
|
74
121
|
export type BaseInputHelperTextProps = {
|
|
75
122
|
/**
|
|
76
123
|
* The helper copy shown below the input.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/internal/BaseInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/internal/BaseInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,SAAS,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW,GAAG,eAAe,CAAC,GAC/D,QAAQ,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,gCAAgC,EAAE,OAAO,CAAC;IAC1C;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,GAAG,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAEnC,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;AAEnC,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RefCallback, RefObject } from 'react';
|
|
2
|
+
import type { TextInput } from 'react-native';
|
|
3
|
+
import type { BaseInputProps } from '../types';
|
|
4
|
+
type UseBaseInputValueArgs = {
|
|
5
|
+
value: string | undefined;
|
|
6
|
+
defaultValue: string | undefined;
|
|
7
|
+
onChangeText: ((text: string) => void) | undefined;
|
|
8
|
+
onClear: (() => void) | undefined;
|
|
9
|
+
ref: BaseInputProps['ref'];
|
|
10
|
+
};
|
|
11
|
+
type UseBaseInputValueReturn = {
|
|
12
|
+
inputRef: RefObject<TextInput | null>;
|
|
13
|
+
composedRef: RefCallback<TextInput>;
|
|
14
|
+
value: string | undefined;
|
|
15
|
+
hasContent: boolean;
|
|
16
|
+
handleChangeText: (text: string) => void;
|
|
17
|
+
handleClear: () => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Tracks the input value for `BaseInput` and implements the clear button, in both
|
|
21
|
+
* controlled and uncontrolled mode.
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare const useBaseInputValue: ({ value: valueProp, defaultValue, onChangeText, onClear, ref, }: UseBaseInputValueArgs) => UseBaseInputValueReturn;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=useBaseInputValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBaseInputValue.d.ts","sourceRoot":"","sources":["../../../../../../../../src/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,KAAK,qBAAqB,GAAG;IAC3B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACnD,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAClC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;CAC5B,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACtC,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,iEAM/B,qBAAqB,KAAG,uBAoC1B,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.59",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -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.27",
|
|
56
56
|
"react": "^19.0.0",
|
|
57
57
|
"react-native": "~0.81.6",
|
|
58
58
|
"react-native-reanimated": "^4.1.0",
|
|
@@ -17,7 +17,7 @@ const usdFormatter = (value: number): FormattedValue => {
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
const meta
|
|
20
|
+
const meta = {
|
|
21
21
|
id: 'rnative-pulse',
|
|
22
22
|
title: 'Primitives/Pulse',
|
|
23
23
|
component: Pulse,
|
|
@@ -27,7 +27,7 @@ const meta: Meta<typeof Pulse> = {
|
|
|
27
27
|
} satisfies Meta<typeof Pulse>;
|
|
28
28
|
|
|
29
29
|
export default meta;
|
|
30
|
-
type Story = StoryObj<typeof
|
|
30
|
+
type Story = StoryObj<typeof Pulse>;
|
|
31
31
|
|
|
32
32
|
export const Base: Story = {
|
|
33
33
|
args: {
|
|
@@ -78,6 +78,11 @@ export const DurationShowcase: Story = {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
export const WithAmountDisplay: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
children: (
|
|
83
|
+
<Box lx={{ width: 's48', height: 's48', backgroundColor: 'accent' }} />
|
|
84
|
+
),
|
|
85
|
+
},
|
|
81
86
|
render: () => {
|
|
82
87
|
return (
|
|
83
88
|
<View style={{ flexDirection: 'column', alignItems: 'center', gap: 16 }}>
|
|
@@ -4,7 +4,7 @@ import { Spinner } from '../../core/Spinner';
|
|
|
4
4
|
import { Box, Text } from '../../primitives';
|
|
5
5
|
import { Spin } from './Spin';
|
|
6
6
|
|
|
7
|
-
const meta
|
|
7
|
+
const meta = {
|
|
8
8
|
id: 'rnative-spin',
|
|
9
9
|
title: 'Primitives/Spin',
|
|
10
10
|
component: Spin,
|
|
@@ -14,7 +14,7 @@ const meta: Meta<typeof Spin> = {
|
|
|
14
14
|
} satisfies Meta<typeof Spin>;
|
|
15
15
|
|
|
16
16
|
export default meta;
|
|
17
|
-
type Story = StoryObj<typeof
|
|
17
|
+
type Story = StoryObj<typeof Spin>;
|
|
18
18
|
|
|
19
19
|
export const Base: Story = {
|
|
20
20
|
args: {
|
|
@@ -57,6 +57,9 @@ export const DurationShowcase: Story = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
export const WithSpinner: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
children: null,
|
|
62
|
+
},
|
|
60
63
|
render: () => {
|
|
61
64
|
return (
|
|
62
65
|
<View style={{ flexDirection: 'column', alignItems: 'center', gap: 16 }}>
|
|
@@ -23,6 +23,9 @@ figma.connect(
|
|
|
23
23
|
helperText: figma.nestedProps('.status', {
|
|
24
24
|
label: figma.string('label'),
|
|
25
25
|
}),
|
|
26
|
+
multiline: figma.enum('type', {
|
|
27
|
+
'multi-line': true,
|
|
28
|
+
}),
|
|
26
29
|
},
|
|
27
30
|
example: (props) => (
|
|
28
31
|
<AddressInput
|
|
@@ -32,6 +35,7 @@ figma.connect(
|
|
|
32
35
|
onQrCodeClick={() => {}}
|
|
33
36
|
helperText={props.helperText.label}
|
|
34
37
|
status={props.status}
|
|
38
|
+
multiline={props.multiline}
|
|
35
39
|
onChangeText={() => {}}
|
|
36
40
|
/>
|
|
37
41
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
1
|
+
import { Meta, Canvas, Controls, Source } from '@storybook/addon-docs/blocks';
|
|
2
2
|
import * as AddressInputStories from './AddressInput.stories';
|
|
3
3
|
import { AddressInput } from './AddressInput';
|
|
4
4
|
import { CustomTabs, Tab } from '../../../../../.storybook/components';
|
|
@@ -51,6 +51,21 @@ Use `hideClearButton` to prevent the clear button from appearing.
|
|
|
51
51
|
|
|
52
52
|
<Canvas of={AddressInputStories.WithHiddenClearButton} />
|
|
53
53
|
|
|
54
|
+
### Multiline
|
|
55
|
+
|
|
56
|
+
Set `multiline` to wrap a long address over several lines instead of truncating it. Prefix, QR scanner, clear button, helper text, and counter behave exactly as they do on a single-line field.
|
|
57
|
+
|
|
58
|
+
- `minLines`: height the field starts at, in lines. Defaults to `1`
|
|
59
|
+
- `maxLines`: growth ceiling, in lines. Once reached, the field scrolls internally instead of growing. Unbounded when omitted
|
|
60
|
+
|
|
61
|
+
<Canvas of={AddressInputStories.WithMultiline} />
|
|
62
|
+
|
|
63
|
+
Equal `minLines` and `maxLines` give a fixed-height box that scrolls instead of growing:
|
|
64
|
+
|
|
65
|
+
<Canvas of={AddressInputStories.WithMultilineFixedHeight} />
|
|
66
|
+
|
|
67
|
+
> **Note:** The scroll indicator inside a clamped field is drawn by the platform, so unlike the web component there is no `scrollbarWidth` prop to configure it.
|
|
68
|
+
|
|
54
69
|
### Error State
|
|
55
70
|
|
|
56
71
|
The input supports error handling through `helperText` and `status` (`'error'` \| `'success'`), which show copy below the input with matching border and text styling.
|
|
@@ -294,6 +309,16 @@ function MyComponent() {
|
|
|
294
309
|
|
|
295
310
|
> **Note:** Helper text is optional. Use `helperText` with `status="error"` to show validation feedback below the input.
|
|
296
311
|
|
|
312
|
+
### Multiline
|
|
313
|
+
|
|
314
|
+
`multiline` wraps a long address over several lines, bounded by `minLines` and `maxLines`:
|
|
315
|
+
|
|
316
|
+
<Source of={AddressInputStories.WithMultiline} />
|
|
317
|
+
|
|
318
|
+
Equal `minLines` and `maxLines` give a fixed-height box that scrolls once the ceiling is reached.
|
|
319
|
+
|
|
320
|
+
<Source of={AddressInputStories.WithMultilineFixedHeight} />
|
|
321
|
+
|
|
297
322
|
### With Custom Styling
|
|
298
323
|
|
|
299
324
|
While the component comes with predefined styles, you can extend them using the `style` prop:
|
|
@@ -4,7 +4,7 @@ import { View } from 'react-native';
|
|
|
4
4
|
import { AddressInput } from './AddressInput';
|
|
5
5
|
import type { AddressInputProps } from './types';
|
|
6
6
|
|
|
7
|
-
const meta
|
|
7
|
+
const meta = {
|
|
8
8
|
component: AddressInput,
|
|
9
9
|
id: 'rnative-addressinput',
|
|
10
10
|
title: 'Core/AddressInput',
|
|
@@ -17,7 +17,7 @@ const meta: Meta<typeof AddressInput> = {
|
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
|
-
}
|
|
20
|
+
} satisfies Meta<typeof AddressInput>;
|
|
21
21
|
|
|
22
22
|
export default meta;
|
|
23
23
|
type Story = StoryObj<typeof AddressInput>;
|
|
@@ -128,6 +128,34 @@ export const WithError: Story = {
|
|
|
128
128
|
},
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
+
export const WithMultiline: Story = {
|
|
132
|
+
render: (args) => <AddressInputStory {...args} />,
|
|
133
|
+
args: {
|
|
134
|
+
placeholder: 'Enter address or ENS',
|
|
135
|
+
value: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb27',
|
|
136
|
+
prefix: 'To:',
|
|
137
|
+
multiline: true,
|
|
138
|
+
minLines: 2,
|
|
139
|
+
maxLines: 5,
|
|
140
|
+
editable: true,
|
|
141
|
+
hideClearButton: false,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const WithMultilineFixedHeight: Story = {
|
|
146
|
+
render: (args) => <AddressInputStory {...args} />,
|
|
147
|
+
args: {
|
|
148
|
+
placeholder: 'Enter address or ENS',
|
|
149
|
+
value: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb27',
|
|
150
|
+
prefix: 'To:',
|
|
151
|
+
multiline: true,
|
|
152
|
+
minLines: 4,
|
|
153
|
+
maxLines: 4,
|
|
154
|
+
editable: true,
|
|
155
|
+
hideClearButton: false,
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
131
159
|
export const Disabled: Story = {
|
|
132
160
|
render: (args) => <AddressInputStory {...args} />,
|
|
133
161
|
args: {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
-
import { Text } from 'react-native';
|
|
2
|
+
import { StyleSheet, Text } from 'react-native';
|
|
3
3
|
import { useCommonTranslation } from '../../../../i18n';
|
|
4
4
|
import { useStyleSheet } from '../../../../styles';
|
|
5
|
+
import { RuntimeConstants } from '../../../utils';
|
|
5
6
|
import { BaseInput } from '../../internal/BaseInput';
|
|
6
7
|
import { QrCode } from '../../symbols';
|
|
7
8
|
import { InteractiveIcon } from '../InteractiveIcon';
|
|
@@ -12,6 +13,7 @@ export const AddressInput = ({
|
|
|
12
13
|
suffix,
|
|
13
14
|
onQrCodeClick,
|
|
14
15
|
disabled: disabledProp,
|
|
16
|
+
multiline = false,
|
|
15
17
|
ref,
|
|
16
18
|
...props
|
|
17
19
|
}: AddressInputProps) => {
|
|
@@ -20,7 +22,7 @@ export const AddressInput = ({
|
|
|
20
22
|
mergeWith: { disabled: disabledProp },
|
|
21
23
|
});
|
|
22
24
|
const { t } = useCommonTranslation();
|
|
23
|
-
const styles = useStyles({ disabled });
|
|
25
|
+
const styles = useStyles({ disabled, multiline });
|
|
24
26
|
|
|
25
27
|
const actualPrefix = (
|
|
26
28
|
<Text accessible={false} style={styles.prefix}>
|
|
@@ -46,19 +48,33 @@ export const AddressInput = ({
|
|
|
46
48
|
prefix={actualPrefix}
|
|
47
49
|
suffix={actualSuffix}
|
|
48
50
|
disabled={disabledProp}
|
|
51
|
+
multiline={multiline}
|
|
49
52
|
{...props}
|
|
50
53
|
/>
|
|
51
54
|
);
|
|
52
55
|
};
|
|
53
56
|
|
|
54
|
-
const useStyles = ({
|
|
57
|
+
const useStyles = ({
|
|
58
|
+
disabled,
|
|
59
|
+
multiline,
|
|
60
|
+
}: {
|
|
61
|
+
disabled: boolean;
|
|
62
|
+
multiline: boolean;
|
|
63
|
+
}) => {
|
|
55
64
|
return useStyleSheet(
|
|
56
65
|
(t) => ({
|
|
57
|
-
prefix:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
66
|
+
prefix: StyleSheet.flatten([
|
|
67
|
+
{
|
|
68
|
+
...t.typographies.body1,
|
|
69
|
+
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
70
|
+
},
|
|
71
|
+
// A multiline field top-aligns its row instead of centring it. iOS centres a
|
|
72
|
+
// Text's glyph inside an explicit line height but leaves the field's at the
|
|
73
|
+
// bottom of it, so only there does the prefix need the field's natural metrics
|
|
74
|
+
// to share a line with it.
|
|
75
|
+
multiline && RuntimeConstants.isIOS && { lineHeight: 0 },
|
|
76
|
+
]),
|
|
61
77
|
}),
|
|
62
|
-
[disabled],
|
|
78
|
+
[disabled, multiline],
|
|
63
79
|
);
|
|
64
80
|
};
|
|
@@ -42,7 +42,7 @@ const btcFormatter = (value: number): FormattedValue => {
|
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
const meta
|
|
45
|
+
const meta = {
|
|
46
46
|
component: AmountDisplay,
|
|
47
47
|
id: 'rnative-amountdisplay',
|
|
48
48
|
title: 'Core/AmountDisplay',
|
|
@@ -98,7 +98,7 @@ const meta: Meta<typeof AmountDisplay> = {
|
|
|
98
98
|
},
|
|
99
99
|
},
|
|
100
100
|
},
|
|
101
|
-
}
|
|
101
|
+
} satisfies Meta<typeof AmountDisplay>;
|
|
102
102
|
|
|
103
103
|
export default meta;
|
|
104
104
|
type Story = StoryObj<typeof AmountDisplay>;
|
|
@@ -129,6 +129,9 @@ export const Sizes: Story = {
|
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
export const WithHideButton: Story = {
|
|
132
|
+
args: {
|
|
133
|
+
value: 1234.56,
|
|
134
|
+
},
|
|
132
135
|
render: (props) => {
|
|
133
136
|
const [hidden, setHidden] = useState(false);
|
|
134
137
|
|
|
@@ -174,6 +177,9 @@ export const AnimationShowcase: Story = {
|
|
|
174
177
|
};
|
|
175
178
|
|
|
176
179
|
export const Loading: Story = {
|
|
180
|
+
args: {
|
|
181
|
+
value: 1234.56,
|
|
182
|
+
},
|
|
177
183
|
render: (props) => {
|
|
178
184
|
return (
|
|
179
185
|
<AmountDisplay
|
|
@@ -15,7 +15,7 @@ const SIZES: { size: AmountInputSize; value: string }[] = [
|
|
|
15
15
|
{ size: 'sm', value: '55 555' },
|
|
16
16
|
];
|
|
17
17
|
|
|
18
|
-
const meta
|
|
18
|
+
const meta = {
|
|
19
19
|
component: AmountInput,
|
|
20
20
|
id: 'rnative-amountinput',
|
|
21
21
|
title: 'Core/AmountInput',
|
|
@@ -37,7 +37,7 @@ const meta: Meta<typeof AmountInput> = {
|
|
|
37
37
|
args: {
|
|
38
38
|
isInvalid: false,
|
|
39
39
|
},
|
|
40
|
-
}
|
|
40
|
+
} satisfies Meta<typeof AmountInput>;
|
|
41
41
|
|
|
42
42
|
export default meta;
|
|
43
43
|
type Story = StoryObj<typeof AmountInput>;
|
|
@@ -63,8 +63,9 @@ const AmountInputStory = (args: AmountInputProps) => {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
export const Base: Story = {
|
|
66
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
67
66
|
args: {
|
|
67
|
+
value: '',
|
|
68
|
+
onChangeText: () => {},
|
|
68
69
|
currencyText: 'USD',
|
|
69
70
|
currencyPosition: 'left',
|
|
70
71
|
allowDecimals: true,
|
|
@@ -74,12 +75,13 @@ export const Base: Story = {
|
|
|
74
75
|
isInvalid: false,
|
|
75
76
|
editable: true,
|
|
76
77
|
},
|
|
78
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
77
79
|
};
|
|
78
80
|
|
|
79
81
|
export const WithValue: Story = {
|
|
80
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
81
82
|
args: {
|
|
82
83
|
value: '1234.56',
|
|
84
|
+
onChangeText: () => {},
|
|
83
85
|
currencyText: 'USD',
|
|
84
86
|
currencyPosition: 'left',
|
|
85
87
|
allowDecimals: true,
|
|
@@ -87,9 +89,14 @@ export const WithValue: Story = {
|
|
|
87
89
|
isInvalid: false,
|
|
88
90
|
editable: true,
|
|
89
91
|
},
|
|
92
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
90
93
|
};
|
|
91
94
|
|
|
92
95
|
export const Size: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
value: '1234.56',
|
|
98
|
+
onChangeText: () => {},
|
|
99
|
+
},
|
|
93
100
|
render: () => (
|
|
94
101
|
<View
|
|
95
102
|
style={{
|
|
@@ -114,6 +121,10 @@ export const Size: Story = {
|
|
|
114
121
|
};
|
|
115
122
|
|
|
116
123
|
export const Alignment: Story = {
|
|
124
|
+
args: {
|
|
125
|
+
value: '1234.56',
|
|
126
|
+
onChangeText: () => {},
|
|
127
|
+
},
|
|
117
128
|
render: () => (
|
|
118
129
|
<View
|
|
119
130
|
style={{
|
|
@@ -137,9 +148,9 @@ export const Alignment: Story = {
|
|
|
137
148
|
};
|
|
138
149
|
|
|
139
150
|
export const CurrencyPositionLeft: Story = {
|
|
140
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
141
151
|
args: {
|
|
142
152
|
value: '1000',
|
|
153
|
+
onChangeText: () => {},
|
|
143
154
|
currencyText: '$',
|
|
144
155
|
currencyPosition: 'left',
|
|
145
156
|
allowDecimals: true,
|
|
@@ -147,12 +158,13 @@ export const CurrencyPositionLeft: Story = {
|
|
|
147
158
|
isInvalid: false,
|
|
148
159
|
editable: true,
|
|
149
160
|
},
|
|
161
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
150
162
|
};
|
|
151
163
|
|
|
152
164
|
export const CurrencyPositionRight: Story = {
|
|
153
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
154
165
|
args: {
|
|
155
166
|
value: '1000',
|
|
167
|
+
onChangeText: () => {},
|
|
156
168
|
currencyText: 'ETH',
|
|
157
169
|
currencyPosition: 'right',
|
|
158
170
|
allowDecimals: true,
|
|
@@ -160,12 +172,13 @@ export const CurrencyPositionRight: Story = {
|
|
|
160
172
|
isInvalid: false,
|
|
161
173
|
editable: true,
|
|
162
174
|
},
|
|
175
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
163
176
|
};
|
|
164
177
|
|
|
165
178
|
export const IntegerOnly: Story = {
|
|
166
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
167
179
|
args: {
|
|
168
180
|
value: '1234',
|
|
181
|
+
onChangeText: () => {},
|
|
169
182
|
currencyText: 'items',
|
|
170
183
|
currencyPosition: 'right',
|
|
171
184
|
allowDecimals: false,
|
|
@@ -173,12 +186,13 @@ export const IntegerOnly: Story = {
|
|
|
173
186
|
isInvalid: false,
|
|
174
187
|
editable: true,
|
|
175
188
|
},
|
|
189
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
176
190
|
};
|
|
177
191
|
|
|
178
192
|
export const WithThousandsSeparator: Story = {
|
|
179
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
180
193
|
args: {
|
|
181
194
|
value: '1000000',
|
|
195
|
+
onChangeText: () => {},
|
|
182
196
|
currencyText: 'USD',
|
|
183
197
|
currencyPosition: 'left',
|
|
184
198
|
allowDecimals: true,
|
|
@@ -186,12 +200,13 @@ export const WithThousandsSeparator: Story = {
|
|
|
186
200
|
isInvalid: false,
|
|
187
201
|
editable: true,
|
|
188
202
|
},
|
|
203
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
189
204
|
};
|
|
190
205
|
|
|
191
206
|
export const WithoutThousandsSeparator: Story = {
|
|
192
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
193
207
|
args: {
|
|
194
208
|
value: '1000000',
|
|
209
|
+
onChangeText: () => {},
|
|
195
210
|
currencyText: 'USD',
|
|
196
211
|
currencyPosition: 'left',
|
|
197
212
|
allowDecimals: true,
|
|
@@ -199,12 +214,13 @@ export const WithoutThousandsSeparator: Story = {
|
|
|
199
214
|
isInvalid: false,
|
|
200
215
|
editable: true,
|
|
201
216
|
},
|
|
217
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
202
218
|
};
|
|
203
219
|
|
|
204
220
|
export const DecimalSeparatorComma: Story = {
|
|
205
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
206
221
|
args: {
|
|
207
222
|
value: '1234.5',
|
|
223
|
+
onChangeText: () => {},
|
|
208
224
|
currencyText: '€',
|
|
209
225
|
currencyPosition: 'right',
|
|
210
226
|
allowDecimals: true,
|
|
@@ -213,12 +229,13 @@ export const DecimalSeparatorComma: Story = {
|
|
|
213
229
|
isInvalid: false,
|
|
214
230
|
editable: true,
|
|
215
231
|
},
|
|
232
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
216
233
|
};
|
|
217
234
|
|
|
218
235
|
export const ErrorState: Story = {
|
|
219
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
220
236
|
args: {
|
|
221
237
|
value: '1234.56',
|
|
238
|
+
onChangeText: () => {},
|
|
222
239
|
currencyText: 'USD',
|
|
223
240
|
currencyPosition: 'left',
|
|
224
241
|
allowDecimals: true,
|
|
@@ -226,12 +243,13 @@ export const ErrorState: Story = {
|
|
|
226
243
|
isInvalid: true,
|
|
227
244
|
editable: true,
|
|
228
245
|
},
|
|
246
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
229
247
|
};
|
|
230
248
|
|
|
231
249
|
export const DisabledAmountInput: Story = {
|
|
232
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
233
250
|
args: {
|
|
234
251
|
value: '1234.56',
|
|
252
|
+
onChangeText: () => {},
|
|
235
253
|
currencyText: 'USD',
|
|
236
254
|
currencyPosition: 'left',
|
|
237
255
|
allowDecimals: true,
|
|
@@ -239,12 +257,13 @@ export const DisabledAmountInput: Story = {
|
|
|
239
257
|
isInvalid: false,
|
|
240
258
|
disabled: true,
|
|
241
259
|
},
|
|
260
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
242
261
|
};
|
|
243
262
|
|
|
244
263
|
export const CustomLengthLimits: Story = {
|
|
245
|
-
render: (args) => <AmountInputStory {...args} />,
|
|
246
264
|
args: {
|
|
247
265
|
value: '123',
|
|
266
|
+
onChangeText: () => {},
|
|
248
267
|
currencyText: '$',
|
|
249
268
|
currencyPosition: 'left',
|
|
250
269
|
allowDecimals: true,
|
|
@@ -254,4 +273,5 @@ export const CustomLengthLimits: Story = {
|
|
|
254
273
|
isInvalid: false,
|
|
255
274
|
editable: true,
|
|
256
275
|
},
|
|
276
|
+
render: (args) => <AmountInputStory {...args} />,
|
|
257
277
|
};
|
|
@@ -22,7 +22,7 @@ const meta = {
|
|
|
22
22
|
} satisfies Meta<typeof Avatar>;
|
|
23
23
|
|
|
24
24
|
export default meta;
|
|
25
|
-
type Story = StoryObj<typeof
|
|
25
|
+
type Story = StoryObj<typeof Avatar>;
|
|
26
26
|
|
|
27
27
|
const exampleSrc =
|
|
28
28
|
'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';
|
|
@@ -17,7 +17,7 @@ const meta = {
|
|
|
17
17
|
} satisfies Meta<typeof AvatarButton>;
|
|
18
18
|
|
|
19
19
|
export default meta;
|
|
20
|
-
type Story = StoryObj<typeof
|
|
20
|
+
type Story = StoryObj<typeof AvatarButton>;
|
|
21
21
|
|
|
22
22
|
const exampleSrc =
|
|
23
23
|
'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';
|
|
@@ -4,7 +4,7 @@ import { Box, Text } from '../../primitives';
|
|
|
4
4
|
import { Button } from '../Button';
|
|
5
5
|
import { Banner } from './Banner';
|
|
6
6
|
|
|
7
|
-
const meta
|
|
7
|
+
const meta = {
|
|
8
8
|
component: Banner,
|
|
9
9
|
id: 'rnative-banner',
|
|
10
10
|
title: 'Core/Banner',
|
|
@@ -81,7 +81,7 @@ const meta: Meta<typeof Banner> = {
|
|
|
81
81
|
description: 'Close action with onClick and ariaLabel',
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
|
-
}
|
|
84
|
+
} satisfies Meta<typeof Banner>;
|
|
85
85
|
|
|
86
86
|
export default meta;
|
|
87
87
|
type Story = StoryObj<typeof Banner>;
|