@ledgerhq/lumen-ui-rnative 0.1.57 → 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.figma.js +17 -1
- package/dist/module/lib/Components/core/Card/Card.figma.js.map +1 -1
- package/dist/module/lib/Components/core/Card/Card.js +36 -24
- package/dist/module/lib/Components/core/Card/Card.js.map +1 -1
- package/dist/module/lib/Components/core/Card/Card.mdx +10 -1
- package/dist/module/lib/Components/core/Card/Card.stories.js +78 -2
- package/dist/module/lib/Components/core/Card/Card.stories.js.map +1 -1
- package/dist/module/lib/Components/core/Card/Card.test.js +31 -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.js +1 -2
- package/dist/module/lib/Components/core/Trend/Trend.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/core/Trend/Trend.test.js +5 -5
- package/dist/module/lib/Components/core/Trend/Trend.test.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/module/lib/Components/symbols/icons/CalendarRefresh.js +50 -0
- package/dist/module/lib/Components/symbols/icons/CalendarRefresh.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/CodeShield.js +50 -0
- package/dist/module/lib/Components/symbols/icons/CodeShield.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/CoinStacked.js +50 -0
- package/dist/module/lib/Components/symbols/icons/CoinStacked.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Craft.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Craft.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Equal.js +49 -0
- package/dist/module/lib/Components/symbols/icons/Equal.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/File.js +50 -0
- package/dist/module/lib/Components/symbols/icons/File.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/FileShield.js +50 -0
- package/dist/module/lib/Components/symbols/icons/FileShield.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Fire.js +51 -0
- package/dist/module/lib/Components/symbols/icons/Fire.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Handshake.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Handshake.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/MailShield.js +50 -0
- package/dist/module/lib/Components/symbols/icons/MailShield.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Merge.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Merge.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Minimize.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Minimize.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Nested.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Nested.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/NotEqual.js +49 -0
- package/dist/module/lib/Components/symbols/icons/NotEqual.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/PeopleShield.js +50 -0
- package/dist/module/lib/Components/symbols/icons/PeopleShield.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Pin.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Pin.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/PinFill.js +47 -0
- package/dist/module/lib/Components/symbols/icons/PinFill.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Receive.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Receive.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Retry.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Retry.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Send.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Send.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/Servers.js +50 -0
- package/dist/module/lib/Components/symbols/icons/Servers.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/SubArrow.js +50 -0
- package/dist/module/lib/Components/symbols/icons/SubArrow.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/UsbCircleFill.js +52 -0
- package/dist/module/lib/Components/symbols/icons/UsbCircleFill.js.map +1 -0
- package/dist/module/lib/Components/symbols/icons/WarningCircleFill.js +47 -0
- package/dist/module/lib/Components/symbols/icons/WarningCircleFill.js.map +1 -0
- package/dist/module/lib/Components/symbols/index.js +24 -0
- package/dist/module/lib/Components/symbols/index.js.map +1 -1
- package/dist/module/lib/utils/index.js +0 -1
- package/dist/module/lib/utils/index.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 +1 -1
- package/dist/typescript/src/lib/Components/core/Card/Card.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/core/Card/types.d.ts +6 -0
- package/dist/typescript/src/lib/Components/core/Card/types.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/core/Trend/Trend.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/dist/typescript/src/lib/Components/symbols/icons/CalendarRefresh.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CalendarRefresh.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CodeShield.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CodeShield.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CoinStacked.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/CoinStacked.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Craft.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Craft.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Equal.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Equal.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/File.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/File.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/FileShield.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/FileShield.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Fire.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Fire.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Handshake.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Handshake.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/MailShield.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/MailShield.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Merge.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Merge.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Minimize.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Minimize.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Nested.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Nested.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/NotEqual.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/NotEqual.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/PeopleShield.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/PeopleShield.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Pin.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Pin.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/PinFill.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/PinFill.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Receive.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Receive.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Retry.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Retry.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Send.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Send.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Servers.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/Servers.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/SubArrow.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/SubArrow.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/UsbCircleFill.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/UsbCircleFill.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/icons/WarningCircleFill.d.ts +35 -0
- package/dist/typescript/src/lib/Components/symbols/icons/WarningCircleFill.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/symbols/index.d.ts +24 -0
- package/dist/typescript/src/lib/Components/symbols/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/utils/index.d.ts +0 -1
- package/dist/typescript/src/lib/utils/index.d.ts.map +1 -1
- package/dist/typescript/src/styles/types/create.types.d.ts +1 -3
- package/dist/typescript/src/styles/types/create.types.d.ts.map +1 -1
- package/package.json +3 -3
- 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.figma.tsx +20 -0
- package/src/lib/Components/core/Card/Card.mdx +10 -1
- package/src/lib/Components/core/Card/Card.stories.tsx +63 -2
- package/src/lib/Components/core/Card/Card.test.tsx +35 -3
- package/src/lib/Components/core/Card/Card.tsx +46 -26
- package/src/lib/Components/core/Card/types.ts +7 -0
- 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/core/Trend/Trend.test.tsx +4 -5
- package/src/lib/Components/core/Trend/Trend.tsx +1 -3
- 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
- package/src/lib/Components/symbols/icons/CalendarRefresh.tsx +45 -0
- package/src/lib/Components/symbols/icons/CodeShield.tsx +45 -0
- package/src/lib/Components/symbols/icons/CoinStacked.tsx +45 -0
- package/src/lib/Components/symbols/icons/Craft.tsx +45 -0
- package/src/lib/Components/symbols/icons/Equal.tsx +44 -0
- package/src/lib/Components/symbols/icons/File.tsx +45 -0
- package/src/lib/Components/symbols/icons/FileShield.tsx +45 -0
- package/src/lib/Components/symbols/icons/Fire.tsx +46 -0
- package/src/lib/Components/symbols/icons/Handshake.tsx +45 -0
- package/src/lib/Components/symbols/icons/MailShield.tsx +45 -0
- package/src/lib/Components/symbols/icons/Merge.tsx +45 -0
- package/src/lib/Components/symbols/icons/Minimize.tsx +45 -0
- package/src/lib/Components/symbols/icons/Nested.tsx +45 -0
- package/src/lib/Components/symbols/icons/NotEqual.tsx +44 -0
- package/src/lib/Components/symbols/icons/PeopleShield.tsx +45 -0
- package/src/lib/Components/symbols/icons/Pin.tsx +45 -0
- package/src/lib/Components/symbols/icons/PinFill.tsx +42 -0
- package/src/lib/Components/symbols/icons/Receive.tsx +45 -0
- package/src/lib/Components/symbols/icons/Retry.tsx +45 -0
- package/src/lib/Components/symbols/icons/Send.tsx +45 -0
- package/src/lib/Components/symbols/icons/Servers.tsx +45 -0
- package/src/lib/Components/symbols/icons/SubArrow.tsx +45 -0
- package/src/lib/Components/symbols/icons/UsbCircleFill.tsx +48 -0
- package/src/lib/Components/symbols/icons/WarningCircleFill.tsx +42 -0
- package/src/lib/Components/symbols/index.ts +24 -0
- package/src/lib/utils/index.ts +0 -1
- package/src/styles/types/create.types.ts +6 -6
- package/dist/module/lib/utils/react/extractTextFromChildren.js +0 -23
- package/dist/module/lib/utils/react/extractTextFromChildren.js.map +0 -1
- package/dist/module/lib/utils/react/index.js +0 -4
- package/dist/module/lib/utils/react/index.js.map +0 -1
- package/dist/typescript/src/lib/utils/react/extractTextFromChildren.d.ts +0 -8
- package/dist/typescript/src/lib/utils/react/extractTextFromChildren.d.ts.map +0 -1
- package/dist/typescript/src/lib/utils/react/index.d.ts +0 -2
- package/dist/typescript/src/lib/utils/react/index.d.ts.map +0 -1
- package/src/lib/utils/react/extractTextFromChildren.ts +0 -32
- package/src/lib/utils/react/index.ts +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import type { TextStyle } from 'react-native';
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import Animated, {
|
|
5
|
+
interpolate,
|
|
6
|
+
useSharedValue,
|
|
7
|
+
useAnimatedStyle,
|
|
8
|
+
withTiming,
|
|
9
|
+
cancelAnimation,
|
|
10
|
+
type AnimatedStyle,
|
|
11
|
+
} from 'react-native-reanimated';
|
|
12
|
+
import type { LumenStyleSheetTheme } from '../../../../styles';
|
|
13
|
+
import { useStyleSheet, useTheme } from '../../../../styles';
|
|
14
|
+
import { useTimingConfig } from '../../animations/useTimingConfig';
|
|
15
|
+
import type { BaseInputLabelProps } from './types';
|
|
16
|
+
|
|
17
|
+
const useAnimatedFloatingLabel = ({
|
|
18
|
+
isFloatingLabel,
|
|
19
|
+
theme,
|
|
20
|
+
}: {
|
|
21
|
+
isFloatingLabel: boolean;
|
|
22
|
+
theme: LumenStyleSheetTheme;
|
|
23
|
+
}): { animatedStyle: AnimatedStyle<TextStyle> } => {
|
|
24
|
+
const floatingAnimation = useSharedValue(isFloatingLabel ? 1 : 0);
|
|
25
|
+
const timingConfig = useTimingConfig({
|
|
26
|
+
duration: 150,
|
|
27
|
+
easing: 'linear',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
floatingAnimation.value = withTiming(isFloatingLabel ? 1 : 0, timingConfig);
|
|
32
|
+
|
|
33
|
+
return () => cancelAnimation(floatingAnimation);
|
|
34
|
+
}, [isFloatingLabel, timingConfig, floatingAnimation]);
|
|
35
|
+
|
|
36
|
+
const animatedStyle = useAnimatedStyle(
|
|
37
|
+
() => ({
|
|
38
|
+
top: interpolate(
|
|
39
|
+
floatingAnimation.value,
|
|
40
|
+
[0, 1],
|
|
41
|
+
[theme.spacings.s14, theme.spacings.s6],
|
|
42
|
+
),
|
|
43
|
+
fontSize: interpolate(
|
|
44
|
+
floatingAnimation.value,
|
|
45
|
+
[0, 1],
|
|
46
|
+
[theme.typographies.body2.fontSize, theme.typographies.body4.fontSize],
|
|
47
|
+
),
|
|
48
|
+
}),
|
|
49
|
+
[floatingAnimation, theme],
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return { animatedStyle };
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const useFloatingLabelStyles = ({
|
|
56
|
+
isFocused,
|
|
57
|
+
hasContent,
|
|
58
|
+
showClearButton,
|
|
59
|
+
status,
|
|
60
|
+
isEditable,
|
|
61
|
+
labelStaysFloatedWithPlaceholder,
|
|
62
|
+
}: {
|
|
63
|
+
isFocused: boolean;
|
|
64
|
+
hasContent: boolean;
|
|
65
|
+
showClearButton: boolean;
|
|
66
|
+
status: 'error' | 'success' | undefined;
|
|
67
|
+
isEditable: boolean;
|
|
68
|
+
labelStaysFloatedWithPlaceholder: boolean;
|
|
69
|
+
}): { label: TextStyle; animatedStyle: AnimatedStyle<TextStyle> } => {
|
|
70
|
+
const { theme } = useTheme();
|
|
71
|
+
|
|
72
|
+
const { label } = useStyleSheet(
|
|
73
|
+
(t) => ({
|
|
74
|
+
label: StyleSheet.flatten([
|
|
75
|
+
{
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
left: t.spacings.s16,
|
|
78
|
+
width: t.sizes.full,
|
|
79
|
+
color: t.colors.text.muted,
|
|
80
|
+
},
|
|
81
|
+
hasContent &&
|
|
82
|
+
showClearButton && {
|
|
83
|
+
width: '92%',
|
|
84
|
+
},
|
|
85
|
+
status === 'error' && {
|
|
86
|
+
color: t.colors.text.error,
|
|
87
|
+
},
|
|
88
|
+
!isEditable && {
|
|
89
|
+
color: t.colors.text.disabled,
|
|
90
|
+
},
|
|
91
|
+
]),
|
|
92
|
+
}),
|
|
93
|
+
[hasContent, showClearButton, status, isEditable],
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const { animatedStyle } = useAnimatedFloatingLabel({
|
|
97
|
+
theme,
|
|
98
|
+
isFloatingLabel:
|
|
99
|
+
isFocused || hasContent || labelStaysFloatedWithPlaceholder,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return { label, animatedStyle };
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Floating label rendered over the control inside `BaseInput`.
|
|
107
|
+
*
|
|
108
|
+
* @internal
|
|
109
|
+
*/
|
|
110
|
+
export const BaseInputLabel = ({
|
|
111
|
+
isFocused,
|
|
112
|
+
hasContent,
|
|
113
|
+
showClearButton,
|
|
114
|
+
status,
|
|
115
|
+
isEditable,
|
|
116
|
+
labelStaysFloatedWithPlaceholder,
|
|
117
|
+
style,
|
|
118
|
+
children,
|
|
119
|
+
}: BaseInputLabelProps) => {
|
|
120
|
+
const styles = useFloatingLabelStyles({
|
|
121
|
+
isFocused,
|
|
122
|
+
hasContent,
|
|
123
|
+
showClearButton,
|
|
124
|
+
status,
|
|
125
|
+
isEditable,
|
|
126
|
+
labelStaysFloatedWithPlaceholder,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<Animated.Text
|
|
131
|
+
style={[styles.label, styles.animatedStyle, style]}
|
|
132
|
+
numberOfLines={1}
|
|
133
|
+
>
|
|
134
|
+
{children}
|
|
135
|
+
</Animated.Text>
|
|
136
|
+
);
|
|
137
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { LumenStyleSheetTheme } from '../../../../styles';
|
|
2
|
+
|
|
3
|
+
type MultilineLayout = {
|
|
4
|
+
lineHeight: number;
|
|
5
|
+
labelRowHeight: number;
|
|
6
|
+
paddingVertical: number;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type MultilineMinHeightArgs = {
|
|
10
|
+
hasLabel: boolean;
|
|
11
|
+
minLines: number;
|
|
12
|
+
maxLines: number | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Vertical layout values a multiline `BaseInput` is laid out from. A label floats
|
|
17
|
+
* over the field and shrinks its text to `body2`, which moves all three.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export const getMultilineLayout = (
|
|
22
|
+
t: LumenStyleSheetTheme,
|
|
23
|
+
hasLabel: boolean,
|
|
24
|
+
): MultilineLayout => ({
|
|
25
|
+
lineHeight: hasLabel
|
|
26
|
+
? t.typographies.body2.lineHeight
|
|
27
|
+
: t.typographies.body1.lineHeight,
|
|
28
|
+
labelRowHeight: hasLabel ? t.spacings.s16 : 0,
|
|
29
|
+
paddingVertical: hasLabel ? t.spacings.s6 : t.spacings.s12,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Height floor of a multiline `BaseInput`: `minLines` of text — never more than
|
|
34
|
+
* `maxLines` — plus the label row and the vertical padding.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
export const getMultilineMinHeight = (
|
|
39
|
+
t: LumenStyleSheetTheme,
|
|
40
|
+
{ hasLabel, minLines, maxLines }: MultilineMinHeightArgs,
|
|
41
|
+
): number => {
|
|
42
|
+
const { lineHeight, labelRowHeight, paddingVertical } = getMultilineLayout(
|
|
43
|
+
t,
|
|
44
|
+
hasLabel,
|
|
45
|
+
);
|
|
46
|
+
const floorLines = maxLines ? Math.min(minLines, maxLines) : minLines;
|
|
47
|
+
|
|
48
|
+
return floorLines * lineHeight + labelRowHeight + 2 * paddingVertical;
|
|
49
|
+
};
|
|
@@ -70,6 +70,7 @@ export type BaseInputProps = {
|
|
|
70
70
|
prefix?: React.ReactNode;
|
|
71
71
|
/**
|
|
72
72
|
* Optional function to extend the default clear behavior with custom logic.
|
|
73
|
+
* Called after the field is emptied. Clearing always calls `onChangeText('')`
|
|
73
74
|
*/
|
|
74
75
|
onClear?: () => void;
|
|
75
76
|
/**
|
|
@@ -77,9 +78,56 @@ export type BaseInputProps = {
|
|
|
77
78
|
* @default false
|
|
78
79
|
*/
|
|
79
80
|
hideClearButton?: boolean;
|
|
80
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Renders a multi-line field that auto-grows between `minLines` and `maxLines`.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
multiline?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Minimum height of the field, in lines. Ignored unless `multiline` is set.
|
|
88
|
+
* @default 1
|
|
89
|
+
*/
|
|
90
|
+
minLines?: number;
|
|
91
|
+
/**
|
|
92
|
+
* Growth ceiling, in lines; past it the field scrolls internally. Unbounded when
|
|
93
|
+
* omitted. Ignored unless `multiline` is set.
|
|
94
|
+
*/
|
|
95
|
+
maxLines?: number;
|
|
96
|
+
} & Omit<TextInputProps, 'style' | 'multiline' | 'numberOfLines'> &
|
|
81
97
|
BoxProps;
|
|
82
98
|
|
|
99
|
+
export type BaseInputLabelProps = {
|
|
100
|
+
/**
|
|
101
|
+
* Whether the input currently has focus, which floats the label.
|
|
102
|
+
*/
|
|
103
|
+
isFocused: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the input holds a value, which keeps the label floated.
|
|
106
|
+
*/
|
|
107
|
+
hasContent: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Whether the clear button is visible, which narrows the label to avoid it.
|
|
110
|
+
*/
|
|
111
|
+
showClearButton: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Whether the input is editable, driving the disabled label colour.
|
|
114
|
+
*/
|
|
115
|
+
isEditable: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Keeps the label floated even when empty and unfocused, used when a label
|
|
118
|
+
* and a placeholder are displayed together.
|
|
119
|
+
*/
|
|
120
|
+
labelStaysFloatedWithPlaceholder: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Additional styles to apply to the label element.
|
|
123
|
+
*/
|
|
124
|
+
style?: StyleProp<TextStyle>;
|
|
125
|
+
/**
|
|
126
|
+
* The label copy.
|
|
127
|
+
*/
|
|
128
|
+
children: React.ReactNode;
|
|
129
|
+
} & Pick<BaseInputProps, 'status'>;
|
|
130
|
+
|
|
83
131
|
export type BaseInputHelperTextProps = {
|
|
84
132
|
/**
|
|
85
133
|
* The helper copy shown below the input.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { describe, expect, it, jest } from '@jest/globals';
|
|
2
|
+
import { act, renderHook } from '@testing-library/react-native';
|
|
3
|
+
import { useBaseInputValue } from './useBaseInputValue';
|
|
4
|
+
|
|
5
|
+
const createArgs = (
|
|
6
|
+
overrides: Partial<Parameters<typeof useBaseInputValue>[0]> = {},
|
|
7
|
+
): Parameters<typeof useBaseInputValue>[0] => ({
|
|
8
|
+
value: undefined,
|
|
9
|
+
defaultValue: undefined,
|
|
10
|
+
onChangeText: undefined,
|
|
11
|
+
onClear: undefined,
|
|
12
|
+
ref: undefined,
|
|
13
|
+
...overrides,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
describe('useBaseInputValue', () => {
|
|
17
|
+
it('starts empty when neither value nor defaultValue is given', () => {
|
|
18
|
+
const { result } = renderHook(() => useBaseInputValue(createArgs()));
|
|
19
|
+
|
|
20
|
+
expect(result.current.value).toBe('');
|
|
21
|
+
expect(result.current.hasContent).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('seeds the value from defaultValue when uncontrolled', () => {
|
|
25
|
+
const { result } = renderHook(() =>
|
|
26
|
+
useBaseInputValue(createArgs({ defaultValue: 'jane.doe' })),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
expect(result.current.value).toBe('jane.doe');
|
|
30
|
+
expect(result.current.hasContent).toBe(true);
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('tracks typing and forwards the text when uncontrolled', () => {
|
|
34
|
+
const onChangeText = jest.fn();
|
|
35
|
+
const { result } = renderHook(() =>
|
|
36
|
+
useBaseInputValue(createArgs({ onChangeText })),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
act(() => {
|
|
40
|
+
result.current.handleChangeText('ledger');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
expect(result.current.value).toBe('ledger');
|
|
44
|
+
expect(onChangeText).toHaveBeenCalledTimes(1);
|
|
45
|
+
expect(onChangeText).toHaveBeenCalledWith('ledger');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('derives the value from the prop when controlled and ignores internal tracking', () => {
|
|
49
|
+
const onChangeText = jest.fn();
|
|
50
|
+
const { result, rerender } = renderHook(
|
|
51
|
+
({ value }: { value: string }) =>
|
|
52
|
+
useBaseInputValue(createArgs({ value, onChangeText })),
|
|
53
|
+
{ initialProps: { value: 'first' } },
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
expect(result.current.value).toBe('first');
|
|
57
|
+
|
|
58
|
+
act(() => {
|
|
59
|
+
result.current.handleChangeText('typed but not applied');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
expect(result.current.value).toBe('first');
|
|
63
|
+
expect(onChangeText).toHaveBeenCalledTimes(1);
|
|
64
|
+
expect(onChangeText).toHaveBeenCalledWith('typed but not applied');
|
|
65
|
+
|
|
66
|
+
rerender({ value: 'second' });
|
|
67
|
+
|
|
68
|
+
expect(result.current.value).toBe('second');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('clears the mirror and calls onChangeText when uncontrolled', () => {
|
|
72
|
+
const onChangeText = jest.fn();
|
|
73
|
+
const onClear = jest.fn();
|
|
74
|
+
const { result } = renderHook(() =>
|
|
75
|
+
useBaseInputValue(
|
|
76
|
+
createArgs({ defaultValue: 'something', onChangeText, onClear }),
|
|
77
|
+
),
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
act(() => {
|
|
81
|
+
result.current.handleClear();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
expect(result.current.value).toBe('');
|
|
85
|
+
expect(result.current.hasContent).toBe(false);
|
|
86
|
+
expect(onChangeText).toHaveBeenCalledTimes(1);
|
|
87
|
+
expect(onChangeText).toHaveBeenCalledWith('');
|
|
88
|
+
expect(onClear).toHaveBeenCalledTimes(1);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('calls onChangeText with an empty string on clear so controlled consumers react', () => {
|
|
92
|
+
const onChangeText = jest.fn();
|
|
93
|
+
const onClear = jest.fn();
|
|
94
|
+
const { result } = renderHook(() =>
|
|
95
|
+
useBaseInputValue(
|
|
96
|
+
createArgs({ value: 'controlled', onChangeText, onClear }),
|
|
97
|
+
),
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
act(() => {
|
|
101
|
+
result.current.handleClear();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
expect(onChangeText).toHaveBeenCalledTimes(1);
|
|
105
|
+
expect(onChangeText).toHaveBeenCalledWith('');
|
|
106
|
+
expect(onClear).toHaveBeenCalledTimes(1);
|
|
107
|
+
// The prop still drives the rendered value until the consumer updates it.
|
|
108
|
+
expect(result.current.value).toBe('controlled');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useMergedRef } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
+
import type { RefCallback, RefObject } from 'react';
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
4
|
+
import type { TextInput } from 'react-native';
|
|
5
|
+
import type { BaseInputProps } from '../types';
|
|
6
|
+
|
|
7
|
+
type UseBaseInputValueArgs = {
|
|
8
|
+
value: string | undefined;
|
|
9
|
+
defaultValue: string | undefined;
|
|
10
|
+
onChangeText: ((text: string) => void) | undefined;
|
|
11
|
+
onClear: (() => void) | undefined;
|
|
12
|
+
ref: BaseInputProps['ref'];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type UseBaseInputValueReturn = {
|
|
16
|
+
inputRef: RefObject<TextInput | null>;
|
|
17
|
+
composedRef: RefCallback<TextInput>;
|
|
18
|
+
value: string | undefined;
|
|
19
|
+
hasContent: boolean;
|
|
20
|
+
handleChangeText: (text: string) => void;
|
|
21
|
+
handleClear: () => void;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Tracks the input value for `BaseInput` and implements the clear button, in both
|
|
26
|
+
* controlled and uncontrolled mode.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export const useBaseInputValue = ({
|
|
31
|
+
value: valueProp,
|
|
32
|
+
defaultValue,
|
|
33
|
+
onChangeText,
|
|
34
|
+
onClear,
|
|
35
|
+
ref,
|
|
36
|
+
}: UseBaseInputValueArgs): UseBaseInputValueReturn => {
|
|
37
|
+
const inputRef = useRef<TextInput>(null);
|
|
38
|
+
const composedRef = useMergedRef(ref, inputRef);
|
|
39
|
+
|
|
40
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(
|
|
41
|
+
defaultValue ?? '',
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const isControlled = valueProp !== undefined;
|
|
45
|
+
const value = isControlled ? valueProp : uncontrolledValue;
|
|
46
|
+
|
|
47
|
+
const hasContent = (value ?? '').length > 0;
|
|
48
|
+
|
|
49
|
+
const handleChangeText = (text: string): void => {
|
|
50
|
+
if (!isControlled) {
|
|
51
|
+
setUncontrolledValue(text);
|
|
52
|
+
}
|
|
53
|
+
onChangeText?.(text);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const handleClear = () => {
|
|
57
|
+
if (!isControlled) {
|
|
58
|
+
setUncontrolledValue('');
|
|
59
|
+
}
|
|
60
|
+
onChangeText?.('');
|
|
61
|
+
onClear?.();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
inputRef,
|
|
66
|
+
composedRef,
|
|
67
|
+
value,
|
|
68
|
+
hasContent,
|
|
69
|
+
handleChangeText,
|
|
70
|
+
handleClear,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
2
|
import { Box } from './Box';
|
|
3
3
|
|
|
4
|
-
const meta
|
|
4
|
+
const meta = {
|
|
5
5
|
component: Box,
|
|
6
6
|
id: 'rnative-box',
|
|
7
7
|
title: 'Primitives/Box',
|
|
@@ -14,7 +14,7 @@ const meta: Meta<typeof Box> = {
|
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
-
}
|
|
17
|
+
} satisfies Meta<typeof Box>;
|
|
18
18
|
|
|
19
19
|
export default meta;
|
|
20
20
|
type Story = StoryObj<typeof Box>;
|
|
@@ -4,7 +4,7 @@ import { Box } from '../../Box';
|
|
|
4
4
|
import { Text } from '../../Text';
|
|
5
5
|
import { LinearGradient } from './LinearGradient';
|
|
6
6
|
|
|
7
|
-
const meta
|
|
7
|
+
const meta = {
|
|
8
8
|
component: LinearGradient,
|
|
9
9
|
id: 'rnative-lineargradient',
|
|
10
10
|
title: 'Primitives/LinearGradient',
|
|
@@ -19,7 +19,7 @@ const meta: Meta<typeof LinearGradient> = {
|
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
-
}
|
|
22
|
+
} satisfies Meta<typeof LinearGradient>;
|
|
23
23
|
|
|
24
24
|
export default meta;
|
|
25
25
|
type Story = StoryObj<typeof LinearGradient>;
|
|
@@ -37,6 +37,9 @@ export const Base: Story = {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export const DirectionShowcase: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
stops: [{ color: 'accent' }, { color: 'active', opacity: 0 }],
|
|
42
|
+
},
|
|
40
43
|
render: () => {
|
|
41
44
|
const orientations = [
|
|
42
45
|
'to-bottom',
|
|
@@ -130,6 +133,7 @@ export const WithMultipleStops: Story = {
|
|
|
130
133
|
|
|
131
134
|
export const CryptoGradients: Story = {
|
|
132
135
|
args: {
|
|
136
|
+
stops: [{ color: 'accent' }, { color: 'active', opacity: 0 }],
|
|
133
137
|
direction: 'to-bottomright',
|
|
134
138
|
lx: {
|
|
135
139
|
borderRadius: 'md',
|
|
@@ -3,7 +3,7 @@ import { Box } from '../../Box';
|
|
|
3
3
|
import { Text } from '../../Text';
|
|
4
4
|
import { RadialGradient } from './RadialGradient';
|
|
5
5
|
|
|
6
|
-
const meta
|
|
6
|
+
const meta = {
|
|
7
7
|
component: RadialGradient,
|
|
8
8
|
id: 'rnative-radialgradient',
|
|
9
9
|
title: 'Primitives/RadialGradient',
|
|
@@ -18,7 +18,7 @@ const meta: Meta<typeof RadialGradient> = {
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
|
-
}
|
|
21
|
+
} satisfies Meta<typeof RadialGradient>;
|
|
22
22
|
|
|
23
23
|
export default meta;
|
|
24
24
|
type Story = StoryObj<typeof RadialGradient>;
|
|
@@ -35,6 +35,9 @@ export const Base: Story = {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
export const CenterPositionShowcase: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
stops: [{ color: 'accent' }, { color: 'active', opacity: 0 }],
|
|
40
|
+
},
|
|
38
41
|
render: () => {
|
|
39
42
|
const positions = [
|
|
40
43
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
2
|
import { Pressable } from './Pressable';
|
|
3
3
|
|
|
4
|
-
const meta
|
|
4
|
+
const meta = {
|
|
5
5
|
component: Pressable,
|
|
6
6
|
id: 'rnative-pressable',
|
|
7
7
|
title: 'Primitives/Pressable',
|
|
@@ -14,7 +14,7 @@ const meta: Meta<typeof Pressable> = {
|
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
|
-
}
|
|
17
|
+
} satisfies Meta<typeof Pressable>;
|
|
18
18
|
|
|
19
19
|
export default meta;
|
|
20
20
|
type Story = StoryObj<typeof Pressable>;
|
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
|
2
2
|
import { Text } from './Text';
|
|
3
3
|
import type { TextProps } from './types';
|
|
4
4
|
|
|
5
|
-
const meta
|
|
5
|
+
const meta = {
|
|
6
6
|
component: Text,
|
|
7
7
|
id: 'rnative-text',
|
|
8
8
|
title: 'Primitives/Text',
|
|
@@ -15,7 +15,7 @@ const meta: Meta<TextProps> = {
|
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
|
-
}
|
|
18
|
+
} satisfies Meta<TextProps>;
|
|
19
19
|
|
|
20
20
|
export default meta;
|
|
21
21
|
type Story = StoryObj<TextProps>;
|
|
@@ -6,10 +6,10 @@ import { Box, Text, Pressable } from '../../primitives';
|
|
|
6
6
|
import * as Icons from '../../symbols';
|
|
7
7
|
import type { IconSize } from './types';
|
|
8
8
|
|
|
9
|
-
const meta
|
|
9
|
+
const meta = {
|
|
10
10
|
id: 'rnative-icon',
|
|
11
11
|
title: 'Symbols/Interface Icons',
|
|
12
|
-
};
|
|
12
|
+
} satisfies Meta;
|
|
13
13
|
|
|
14
14
|
export default meta;
|
|
15
15
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Svg, { Path } from 'react-native-svg';
|
|
2
|
+
import createIcon from '../Icon/createIcon';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CalendarRefresh icon component for React Native.
|
|
6
|
+
*
|
|
7
|
+
* This icon component is automatically generated from SVG files and uses the createIcon utility
|
|
8
|
+
* to create a consistent icon interface. It supports all standard SVG props (from react-native-svg)
|
|
9
|
+
* and additional size variants defined in the Icon component.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {16 | 20 | 24 | 40 | 48 | 56} [size=24] - The size of the icon in pixels.
|
|
13
|
+
* @param {string} [color] - The color of the icon.
|
|
14
|
+
* @param {SVGProps} [...props] - All standard SVG element props (from react-native-svg).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Basic usage with default size (24px)
|
|
18
|
+
* import { CalendarRefresh } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
19
|
+
*
|
|
20
|
+
* <CalendarRefresh />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With custom size and style
|
|
24
|
+
* <CalendarRefresh size={40} color="warning" lx={{ marginTop: 's4' }} />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Used within a Button component
|
|
28
|
+
* import { Button } from '@ledgerhq/lumen-ui-rnative';
|
|
29
|
+
*
|
|
30
|
+
* <Button icon={CalendarRefresh} size="md">
|
|
31
|
+
* Click me
|
|
32
|
+
* </Button>
|
|
33
|
+
*/
|
|
34
|
+
export const CalendarRefresh = createIcon(
|
|
35
|
+
'CalendarRefresh',
|
|
36
|
+
<Svg width={24} height={24} fill='currentColor' viewBox='0 0 16 16'>
|
|
37
|
+
<Path
|
|
38
|
+
stroke='currentColor'
|
|
39
|
+
strokeLinecap='round'
|
|
40
|
+
strokeLinejoin='round'
|
|
41
|
+
strokeWidth={1.3}
|
|
42
|
+
d='m9.482 11.247-.578-.52-.581.52m4.095 1.828a2.26 2.26 0 0 1-1.278.396 2.28 2.28 0 0 1-2.237-2.728m4.1.162.556.52.56-.52m-4.074-1.828a2.26 2.26 0 0 1 1.278-.396 2.28 2.28 0 0 1 2.236 2.728M10 2v1.333M4.667 2v1.333M2 5.333h10.667m0 1.334V4c0-.737-.597-1.333-1.334-1.333h-8C2.597 2.667 2 3.263 2 4v7.333c0 .737.597 1.334 1.333 1.334h3.334m.683-4.918h-.006l-.007-.007v-.006m-2.64.013H4.69l-.006-.007v-.006m.013 2.46H4.69l-.006-.006v-.007'
|
|
43
|
+
/>
|
|
44
|
+
</Svg>,
|
|
45
|
+
);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Svg, { Path } from 'react-native-svg';
|
|
2
|
+
import createIcon from '../Icon/createIcon';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CodeShield icon component for React Native.
|
|
6
|
+
*
|
|
7
|
+
* This icon component is automatically generated from SVG files and uses the createIcon utility
|
|
8
|
+
* to create a consistent icon interface. It supports all standard SVG props (from react-native-svg)
|
|
9
|
+
* and additional size variants defined in the Icon component.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {16 | 20 | 24 | 40 | 48 | 56} [size=24] - The size of the icon in pixels.
|
|
13
|
+
* @param {string} [color] - The color of the icon.
|
|
14
|
+
* @param {SVGProps} [...props] - All standard SVG element props (from react-native-svg).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Basic usage with default size (24px)
|
|
18
|
+
* import { CodeShield } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
19
|
+
*
|
|
20
|
+
* <CodeShield />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With custom size and style
|
|
24
|
+
* <CodeShield size={40} color="warning" lx={{ marginTop: 's4' }} />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Used within a Button component
|
|
28
|
+
* import { Button } from '@ledgerhq/lumen-ui-rnative';
|
|
29
|
+
*
|
|
30
|
+
* <Button icon={CodeShield} size="md">
|
|
31
|
+
* Click me
|
|
32
|
+
* </Button>
|
|
33
|
+
*/
|
|
34
|
+
export const CodeShield = createIcon(
|
|
35
|
+
'CodeShield',
|
|
36
|
+
<Svg width={24} height={24} fill='currentColor' viewBox='0 0 16 16'>
|
|
37
|
+
<Path
|
|
38
|
+
stroke='currentColor'
|
|
39
|
+
strokeLinecap='round'
|
|
40
|
+
strokeLinejoin='round'
|
|
41
|
+
strokeWidth={1.3}
|
|
42
|
+
d='m10.345 6.633.988.994-1 1.006m-2.333 5a6 6 0 1 1 6-6m-8.345-1-.988.995 1 1.005M8.5 5.971l-1 3.325m4.2 1.204c.267-.133.6-.133.933 0l1.2.467v1.4c0 1.2-1.666 2-1.666 2s-1.667-.8-1.667-2v-1.4z'
|
|
43
|
+
/>
|
|
44
|
+
</Svg>,
|
|
45
|
+
);
|