@ledgerhq/lumen-ui-rnative 0.1.14 → 0.1.16
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/i18n/i18n.js +2 -0
- package/dist/module/i18n/i18n.js.map +1 -1
- package/dist/module/index.js +0 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/Animations/Spin/Spin.js +3 -1
- package/dist/module/lib/Animations/Spin/Spin.js.map +1 -1
- package/dist/module/lib/Components/AddressInput/AddressInput.js +21 -10
- package/dist/module/lib/Components/AddressInput/AddressInput.js.map +1 -1
- package/dist/module/lib/Components/AddressInput/AddressInput.mdx +18 -2
- package/dist/module/lib/Components/AddressInput/AddressInput.stories.js +1 -23
- package/dist/module/lib/Components/AddressInput/AddressInput.stories.js.map +1 -1
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.test.js +0 -1
- package/dist/module/lib/Components/AmountDisplay/AmountDisplay.test.js.map +1 -1
- package/dist/module/lib/Components/AmountInput/AmountInput.js +7 -6
- package/dist/module/lib/Components/AmountInput/AmountInput.js.map +1 -1
- package/dist/module/lib/Components/AmountInput/AmountInput.mdx +5 -1
- package/dist/module/lib/Components/AmountInput/AmountInput.stories.js +1 -36
- package/dist/module/lib/Components/AmountInput/AmountInput.stories.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.figma.js +26 -0
- package/dist/module/lib/Components/Avatar/Avatar.figma.js.map +1 -0
- package/dist/module/lib/Components/Avatar/Avatar.stories.js +0 -1
- package/dist/module/lib/Components/Avatar/Avatar.stories.js.map +1 -1
- package/dist/module/lib/Components/Avatar/Avatar.test.js +0 -1
- package/dist/module/lib/Components/Avatar/Avatar.test.js.map +1 -1
- package/dist/module/lib/Components/Banner/Banner.stories.js +3 -3
- package/dist/module/lib/Components/Banner/Banner.stories.js.map +1 -1
- package/dist/module/lib/Components/Banner/Banner.test.js +0 -1
- package/dist/module/lib/Components/Banner/Banner.test.js.map +1 -1
- package/dist/module/lib/Components/BaseInput/BaseInput.js +54 -48
- package/dist/module/lib/Components/BaseInput/BaseInput.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js +0 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.test.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/CustomBackdrop.js +0 -2
- package/dist/module/lib/Components/BottomSheet/CustomBackdrop.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/CustomHandle.js +0 -1
- package/dist/module/lib/Components/BottomSheet/CustomHandle.js.map +1 -1
- package/dist/module/lib/Components/Button/BaseButton.test.js +0 -1
- package/dist/module/lib/Components/Button/BaseButton.test.js.map +1 -1
- package/dist/module/lib/Components/Button/Button.stories.js +2 -2
- package/dist/module/lib/Components/Button/Button.stories.js.map +1 -1
- package/dist/module/lib/Components/Card/Card.js +3 -3
- package/dist/module/lib/Components/Card/Card.js.map +1 -1
- package/dist/module/lib/Components/Card/Card.test.js +0 -1
- package/dist/module/lib/Components/Card/Card.test.js.map +1 -1
- package/dist/module/lib/Components/CardButton/CardButton.test.js +0 -1
- package/dist/module/lib/Components/CardButton/CardButton.test.js.map +1 -1
- package/dist/module/lib/Components/Checkbox/BaseCheckbox.js +1 -1
- package/dist/module/lib/Components/Checkbox/BaseCheckbox.js.map +1 -1
- package/dist/module/lib/Components/Checkbox/Checkbox.test.js +0 -1
- package/dist/module/lib/Components/Checkbox/Checkbox.test.js.map +1 -1
- package/dist/module/lib/Components/ContentBanner/ContentBanner.stories.js +2 -2
- package/dist/module/lib/Components/ContentBanner/ContentBanner.stories.js.map +1 -1
- package/dist/module/lib/Components/ContentBanner/ContentBanner.test.js +0 -1
- package/dist/module/lib/Components/ContentBanner/ContentBanner.test.js.map +1 -1
- package/dist/module/lib/Components/Divider/Divider.test.js +0 -1
- package/dist/module/lib/Components/Divider/Divider.test.js.map +1 -1
- package/dist/module/lib/Components/Icon/Icon.js +2 -1
- package/dist/module/lib/Components/Icon/Icon.js.map +1 -1
- package/dist/module/lib/Components/Icon/Icon.test.js +0 -1
- package/dist/module/lib/Components/Icon/Icon.test.js.map +1 -1
- package/dist/module/lib/Components/Icon/createIcon.js +4 -2
- package/dist/module/lib/Components/Icon/createIcon.js.map +1 -1
- package/dist/module/lib/Components/IconButton/IconButton.test.js +0 -1
- package/dist/module/lib/Components/IconButton/IconButton.test.js.map +1 -1
- package/dist/module/lib/Components/Link/Link.test.js +3 -3
- package/dist/module/lib/Components/Link/Link.test.js.map +1 -1
- package/dist/module/lib/Components/ListItem/ListItem.js +64 -179
- package/dist/module/lib/Components/ListItem/ListItem.js.map +1 -1
- package/dist/module/lib/Components/ListItem/ListItem.mdx +53 -49
- package/dist/module/lib/Components/ListItem/ListItem.stories.js +65 -59
- package/dist/module/lib/Components/ListItem/ListItem.stories.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.js +102 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.mdx +103 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js +91 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js.map +1 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.test.js +204 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.test.js.map +1 -0
- package/dist/module/lib/Components/MediaImage/index.js +5 -0
- package/dist/module/lib/Components/MediaImage/index.js.map +1 -0
- package/dist/module/lib/Components/MediaImage/types.js +4 -0
- package/dist/module/lib/Components/MediaImage/types.js.map +1 -0
- package/dist/module/lib/Components/NavBar/NavBar.js +3 -3
- package/dist/module/lib/Components/NavBar/NavBar.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.test.js +0 -1
- package/dist/module/lib/Components/NavBar/NavBar.test.js.map +1 -1
- package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js +2 -2
- package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js.map +1 -1
- package/dist/module/lib/Components/SearchInput/SearchInput.js +11 -2
- package/dist/module/lib/Components/SearchInput/SearchInput.js.map +1 -1
- package/dist/module/lib/Components/SearchInput/SearchInput.mdx +14 -2
- package/dist/module/lib/Components/SearchInput/SearchInput.stories.js +1 -19
- package/dist/module/lib/Components/SearchInput/SearchInput.stories.js.map +1 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.js +46 -14
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.mdx +0 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.stories.js +90 -64
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.stories.js.map +1 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.test.js +0 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.test.js.map +1 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControlContext.js.map +1 -1
- package/dist/module/lib/Components/SegmentedControl/usePillLayout.js +40 -16
- package/dist/module/lib/Components/SegmentedControl/usePillLayout.js.map +1 -1
- package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js +1 -1
- package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js.map +1 -1
- package/dist/module/lib/Components/Select/GlobalSelectContext.js +1 -1
- package/dist/module/lib/Components/Select/GlobalSelectContext.js.map +1 -1
- package/dist/module/lib/Components/Select/Select.js +3 -3
- package/dist/module/lib/Components/Select/Select.js.map +1 -1
- package/dist/module/lib/Components/Select/Select.test.js +0 -1
- package/dist/module/lib/Components/Select/Select.test.js.map +1 -1
- package/dist/module/lib/Components/Skeleton/Skeleton.test.js +0 -1
- package/dist/module/lib/Components/Skeleton/Skeleton.test.js.map +1 -1
- package/dist/module/lib/Components/Slot/Slot.js +4 -0
- package/dist/module/lib/Components/Slot/Slot.js.map +1 -1
- package/dist/module/lib/Components/Spinner/Spinner.mdx +1 -3
- package/dist/module/lib/Components/Spot/Spot.stories.js +0 -1
- package/dist/module/lib/Components/Spot/Spot.stories.js.map +1 -1
- package/dist/module/lib/Components/Stepper/Stepper.mdx +1 -3
- package/dist/module/lib/Components/Stepper/Stepper.test.js +0 -1
- package/dist/module/lib/Components/Stepper/Stepper.test.js.map +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.stories.js +0 -1
- package/dist/module/lib/Components/Subheader/Subheader.stories.js.map +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.test.js +0 -1
- package/dist/module/lib/Components/Subheader/Subheader.test.js.map +1 -1
- package/dist/module/lib/Components/Switch/BaseSwitch.js +1 -1
- package/dist/module/lib/Components/Switch/BaseSwitch.js.map +1 -1
- package/dist/module/lib/Components/Switch/Switch.test.js +0 -1
- package/dist/module/lib/Components/Switch/Switch.test.js.map +1 -1
- package/dist/module/lib/Components/TabBar/TabBar.js +8 -8
- package/dist/module/lib/Components/TabBar/TabBar.js.map +1 -1
- package/dist/module/lib/Components/TabBar/TabBar.test.js +0 -1
- package/dist/module/lib/Components/TabBar/TabBar.test.js.map +1 -1
- package/dist/module/lib/Components/TextInput/TextInput.mdx +14 -2
- package/dist/module/lib/Components/TextInput/TextInput.stories.js +1 -28
- package/dist/module/lib/Components/TextInput/TextInput.stories.js.map +1 -1
- package/dist/module/lib/Components/Tile/Tile.stories.js +0 -1
- package/dist/module/lib/Components/Tile/Tile.stories.js.map +1 -1
- package/dist/module/lib/Components/Tile/Tile.test.js +0 -1
- package/dist/module/lib/Components/Tile/Tile.test.js.map +1 -1
- package/dist/module/lib/Components/TileButton/TileButton.test.js +0 -1
- package/dist/module/lib/Components/TileButton/TileButton.test.js.map +1 -1
- package/dist/module/lib/Components/Tooltip/GlobalTooltipBottomSheet.js +1 -1
- package/dist/module/lib/Components/Tooltip/GlobalTooltipBottomSheet.js.map +1 -1
- package/dist/module/lib/Components/Tooltip/GlobalTooltipContext.js +1 -1
- package/dist/module/lib/Components/Tooltip/GlobalTooltipContext.js.map +1 -1
- package/dist/module/lib/Components/Tooltip/Tooltip.test.js +0 -1
- package/dist/module/lib/Components/Tooltip/Tooltip.test.js.map +1 -1
- package/dist/module/lib/Components/TriggerButton/TriggerButton.test.js +1 -1
- package/dist/module/lib/Components/TriggerButton/TriggerButton.test.js.map +1 -1
- package/dist/module/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.js.map +1 -1
- package/dist/module/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.test.js +1 -1
- package/dist/module/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.test.js.map +1 -1
- package/dist/module/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.test.js +1 -1
- package/dist/module/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.test.js.map +1 -1
- package/dist/module/lib/Components/Utility/Pressable/Pressable.test.js +1 -1
- package/dist/module/lib/Components/Utility/Pressable/Pressable.test.js.map +1 -1
- package/dist/module/lib/Components/index.js +1 -0
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/module/lib/utils/react/extractTextFromChildren.js +3 -3
- package/dist/module/lib/utils/react/extractTextFromChildren.js.map +1 -1
- package/dist/module/lib/utils/useControllableState/useControllableState.js +5 -5
- package/dist/module/lib/utils/useControllableState/useControllableState.js.map +1 -1
- package/dist/module/lib/utils/useEvent/useGet.js +3 -3
- package/dist/module/lib/utils/useEvent/useGet.js.map +1 -1
- package/dist/module/styles/hooks/useStyleSheet.test.js +1 -1
- package/dist/module/styles/hooks/useStyleSheet.test.js.map +1 -1
- package/dist/module/styles/lx/createStyledPressable.test.js +1 -1
- package/dist/module/styles/lx/createStyledPressable.test.js.map +1 -1
- package/dist/module/styles/lx/createStyledText.test.js +1 -1
- package/dist/module/styles/lx/createStyledText.test.js.map +1 -1
- package/dist/module/styles/lx/createStyledView.test.js +1 -1
- package/dist/module/styles/lx/createStyledView.test.js.map +1 -1
- package/dist/module/styles/lx/resolveStyle.test.js +0 -1
- package/dist/module/styles/lx/resolveStyle.test.js.map +1 -1
- package/dist/module/styles/provider/LumenStyleSheetProvider.test.js +2 -4
- package/dist/module/styles/provider/LumenStyleSheetProvider.test.js.map +1 -1
- package/dist/module/utils/icon-template.js +3 -0
- package/dist/module/utils/icon-template.js.map +1 -1
- package/dist/typescript/src/i18n/i18n.d.ts.map +1 -1
- package/dist/typescript/src/index.d.ts +0 -1
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Animations/Spin/Spin.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AddressInput/AddressInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/AddressInput/AddressInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/types.d.ts +7 -0
- package/dist/typescript/src/lib/Components/AmountInput/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Avatar/Avatar.figma.d.ts +2 -0
- package/dist/typescript/src/lib/Components/Avatar/Avatar.figma.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/BaseInput/BaseInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BaseInput/types.d.ts +7 -0
- package/dist/typescript/src/lib/Components/BaseInput/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/CustomBackdrop.d.ts +0 -1
- package/dist/typescript/src/lib/Components/BottomSheet/CustomBackdrop.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/CustomHandle.d.ts +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/CustomHandle.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Card/Card.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/CardButton/types.d.ts +0 -1
- package/dist/typescript/src/lib/Components/CardButton/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ContentBanner/types.d.ts +0 -1
- package/dist/typescript/src/lib/Components/ContentBanner/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Icon/createIcon.d.ts +1 -2
- package/dist/typescript/src/lib/Components/Icon/createIcon.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts +21 -40
- package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ListItem/types.d.ts +10 -37
- package/dist/typescript/src/lib/Components/ListItem/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts +18 -0
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/MediaImage/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/MediaImage/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts +25 -0
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/SearchInput/SearchInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControlContext.d.ts +6 -0
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/types.d.ts +7 -0
- package/dist/typescript/src/lib/Components/SegmentedControl/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/usePillLayout.d.ts +7 -3
- package/dist/typescript/src/lib/Components/SegmentedControl/usePillLayout.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts +0 -1
- package/dist/typescript/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Select/GlobalSelectContext.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Select/GlobalSelectContext.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Select/Select.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Slot/Slot.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Spot/types.d.ts +2 -2
- package/dist/typescript/src/lib/Components/Spot/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Switch/BaseSwitch.d.ts +0 -1
- package/dist/typescript/src/lib/Components/Switch/BaseSwitch.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/TabBar/TabBar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tooltip/GlobalTooltipBottomSheet.d.ts +0 -1
- package/dist/typescript/src/lib/Components/Tooltip/GlobalTooltipBottomSheet.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tooltip/GlobalTooltipContext.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Tooltip/GlobalTooltipContext.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/index.d.ts +1 -0
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/types/index.d.ts +6 -6
- package/dist/typescript/src/lib/types/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/utils/react/extractTextFromChildren.d.ts +2 -2
- package/dist/typescript/src/lib/utils/react/extractTextFromChildren.d.ts.map +1 -1
- package/dist/typescript/src/lib/utils/useControllableState/useControllableState.d.ts +3 -3
- package/dist/typescript/src/lib/utils/useControllableState/useControllableState.d.ts.map +1 -1
- package/dist/typescript/src/utils/icon-template.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/i18n/i18n.ts +2 -0
- package/src/index.ts +0 -1
- package/src/lib/Animations/Spin/Spin.tsx +5 -1
- package/src/lib/Components/AddressInput/AddressInput.mdx +18 -2
- package/src/lib/Components/AddressInput/AddressInput.stories.tsx +1 -23
- package/src/lib/Components/AddressInput/AddressInput.tsx +15 -7
- package/src/lib/Components/AmountDisplay/AmountDisplay.test.tsx +0 -1
- package/src/lib/Components/AmountInput/AmountInput.mdx +5 -1
- package/src/lib/Components/AmountInput/AmountInput.stories.tsx +1 -36
- package/src/lib/Components/AmountInput/AmountInput.tsx +4 -3
- package/src/lib/Components/AmountInput/types.ts +7 -0
- package/src/lib/Components/Avatar/Avatar.figma.tsx +29 -0
- package/src/lib/Components/Avatar/Avatar.stories.tsx +0 -1
- package/src/lib/Components/Avatar/Avatar.test.tsx +0 -1
- package/src/lib/Components/Banner/Banner.stories.tsx +3 -3
- package/src/lib/Components/Banner/Banner.test.tsx +0 -1
- package/src/lib/Components/BaseInput/BaseInput.tsx +66 -60
- package/src/lib/Components/BaseInput/types.ts +7 -0
- package/src/lib/Components/BottomSheet/BottomSheet.test.tsx +0 -1
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +1 -1
- package/src/lib/Components/BottomSheet/CustomBackdrop.tsx +0 -2
- package/src/lib/Components/BottomSheet/CustomHandle.tsx +1 -1
- package/src/lib/Components/Button/BaseButton.test.tsx +0 -1
- package/src/lib/Components/Button/Button.stories.tsx +2 -2
- package/src/lib/Components/Card/Card.test.tsx +0 -1
- package/src/lib/Components/Card/Card.tsx +3 -2
- package/src/lib/Components/CardButton/CardButton.test.tsx +0 -1
- package/src/lib/Components/CardButton/types.ts +0 -1
- package/src/lib/Components/Checkbox/BaseCheckbox.tsx +1 -1
- package/src/lib/Components/Checkbox/Checkbox.test.tsx +0 -1
- package/src/lib/Components/ContentBanner/ContentBanner.stories.tsx +2 -2
- package/src/lib/Components/ContentBanner/ContentBanner.test.tsx +0 -1
- package/src/lib/Components/ContentBanner/types.ts +0 -1
- package/src/lib/Components/Divider/Divider.test.tsx +0 -1
- package/src/lib/Components/Icon/Icon.test.tsx +0 -1
- package/src/lib/Components/Icon/Icon.tsx +1 -1
- package/src/lib/Components/Icon/createIcon.ts +3 -2
- package/src/lib/Components/IconButton/IconButton.test.tsx +0 -1
- package/src/lib/Components/Link/Link.test.tsx +3 -3
- package/src/lib/Components/ListItem/ListItem.mdx +53 -49
- package/src/lib/Components/ListItem/ListItem.stories.tsx +51 -54
- package/src/lib/Components/ListItem/ListItem.tsx +80 -210
- package/src/lib/Components/ListItem/types.ts +10 -41
- package/src/lib/Components/MediaImage/MediaImage.mdx +103 -0
- package/src/lib/Components/MediaImage/MediaImage.stories.tsx +55 -0
- package/src/lib/Components/MediaImage/MediaImage.test.tsx +179 -0
- package/src/lib/Components/MediaImage/MediaImage.tsx +117 -0
- package/src/lib/Components/MediaImage/index.ts +2 -0
- package/src/lib/Components/MediaImage/types.ts +27 -0
- package/src/lib/Components/NavBar/NavBar.test.tsx +0 -1
- package/src/lib/Components/NavBar/NavBar.tsx +3 -3
- package/src/lib/Components/PageIndicator/PageIndicator.test.tsx +2 -2
- package/src/lib/Components/SearchInput/SearchInput.mdx +14 -2
- package/src/lib/Components/SearchInput/SearchInput.stories.tsx +1 -19
- package/src/lib/Components/SearchInput/SearchInput.tsx +8 -1
- package/src/lib/Components/SegmentedControl/SegmentedControl.mdx +0 -1
- package/src/lib/Components/SegmentedControl/SegmentedControl.stories.tsx +77 -51
- package/src/lib/Components/SegmentedControl/SegmentedControl.test.tsx +0 -1
- package/src/lib/Components/SegmentedControl/SegmentedControl.tsx +42 -9
- package/src/lib/Components/SegmentedControl/SegmentedControlContext.tsx +4 -0
- package/src/lib/Components/SegmentedControl/types.ts +7 -0
- package/src/lib/Components/SegmentedControl/usePillLayout.ts +66 -19
- package/src/lib/Components/Select/GlobalSelectBottomSheet.tsx +1 -1
- package/src/lib/Components/Select/GlobalSelectContext.tsx +1 -1
- package/src/lib/Components/Select/Select.test.tsx +0 -1
- package/src/lib/Components/Select/Select.tsx +16 -14
- package/src/lib/Components/Skeleton/Skeleton.test.tsx +0 -1
- package/src/lib/Components/Slot/Slot.tsx +4 -0
- package/src/lib/Components/Spinner/Spinner.mdx +1 -3
- package/src/lib/Components/Spot/Spot.stories.tsx +0 -1
- package/src/lib/Components/Spot/types.ts +2 -2
- package/src/lib/Components/Stepper/Stepper.mdx +1 -3
- package/src/lib/Components/Stepper/Stepper.test.tsx +0 -1
- package/src/lib/Components/Subheader/Subheader.stories.tsx +0 -1
- package/src/lib/Components/Subheader/Subheader.test.tsx +0 -1
- package/src/lib/Components/Switch/BaseSwitch.tsx +1 -1
- package/src/lib/Components/Switch/Switch.test.tsx +0 -1
- package/src/lib/Components/TabBar/TabBar.test.tsx +0 -1
- package/src/lib/Components/TabBar/TabBar.tsx +12 -5
- package/src/lib/Components/TextInput/TextInput.mdx +14 -2
- package/src/lib/Components/TextInput/TextInput.stories.tsx +1 -28
- package/src/lib/Components/Tile/Tile.stories.tsx +0 -1
- package/src/lib/Components/Tile/Tile.test.tsx +0 -1
- package/src/lib/Components/TileButton/TileButton.test.tsx +0 -1
- package/src/lib/Components/Tooltip/GlobalTooltipBottomSheet.tsx +1 -1
- package/src/lib/Components/Tooltip/GlobalTooltipContext.tsx +1 -7
- package/src/lib/Components/Tooltip/Tooltip.test.tsx +0 -1
- package/src/lib/Components/TriggerButton/TriggerButton.test.tsx +1 -1
- package/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.tsx +1 -1
- package/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.test.tsx +1 -1
- package/src/lib/Components/Utility/Gradient/RadialGradient/RadialGradient.test.tsx +1 -1
- package/src/lib/Components/Utility/Pressable/Pressable.test.tsx +1 -1
- package/src/lib/Components/index.ts +1 -0
- package/src/lib/types/index.ts +7 -7
- package/src/lib/utils/react/extractTextFromChildren.ts +4 -4
- package/src/lib/utils/useControllableState/useControllableState.ts +7 -9
- package/src/lib/utils/useEvent/useGet.ts +3 -3
- package/src/styles/hooks/useStyleSheet.test.tsx +1 -1
- package/src/styles/lx/createStyledPressable.test.tsx +1 -1
- package/src/styles/lx/createStyledText.test.tsx +1 -1
- package/src/styles/lx/createStyledView.test.tsx +1 -1
- package/src/styles/lx/resolveStyle.test.tsx +0 -1
- package/src/styles/provider/LumenStyleSheetProvider.test.tsx +2 -2
- package/src/utils/icon-template.ts +2 -0
- package/dist/module/lib/Patterns/index.js +0 -4
- package/dist/module/lib/Patterns/index.js.map +0 -1
- package/dist/typescript/src/lib/Patterns/index.d.ts +0 -3
- package/dist/typescript/src/lib/Patterns/index.d.ts.map +0 -1
- package/src/lib/Patterns/index.ts +0 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { describe, it, expect } from '@jest/globals';
|
|
2
|
+
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
|
+
import { render, waitFor } from '@testing-library/react-native';
|
|
4
|
+
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
5
|
+
import { MediaImage } from './MediaImage';
|
|
6
|
+
|
|
7
|
+
const { sizes, borderRadius } = ledgerLiveThemes.dark;
|
|
8
|
+
|
|
9
|
+
const TestWrapper = ({ children }: { children: React.ReactNode }) => (
|
|
10
|
+
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
11
|
+
{children}
|
|
12
|
+
</ThemeProvider>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
describe('MediaImage Component', () => {
|
|
16
|
+
const validSrc = 'https://crypto-icons.ledger.com/ADA.png';
|
|
17
|
+
|
|
18
|
+
it('should render with image when valid src is provided', () => {
|
|
19
|
+
const { getByTestId } = render(
|
|
20
|
+
<TestWrapper>
|
|
21
|
+
<MediaImage src={validSrc} alt='Cardano' />
|
|
22
|
+
</TestWrapper>,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const img = getByTestId('media-image-img');
|
|
26
|
+
expect(img.props.source).toEqual({ uri: validSrc });
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should render fallback when no src is provided', () => {
|
|
30
|
+
const { queryByTestId } = render(
|
|
31
|
+
<TestWrapper>
|
|
32
|
+
<MediaImage alt='Empty' />
|
|
33
|
+
</TestWrapper>,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
expect(queryByTestId('media-image-img')).toBeNull();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should render fallback when src is empty string', () => {
|
|
40
|
+
const { queryByTestId } = render(
|
|
41
|
+
<TestWrapper>
|
|
42
|
+
<MediaImage src='' alt='Empty' />
|
|
43
|
+
</TestWrapper>,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
expect(queryByTestId('media-image-img')).toBeNull();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should render fallback when image fails to load', async () => {
|
|
50
|
+
const { getByTestId, queryByTestId, rerender } = render(
|
|
51
|
+
<TestWrapper>
|
|
52
|
+
<MediaImage src='https://broken-link.com/404.png' alt='Broken' />
|
|
53
|
+
</TestWrapper>,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const img = getByTestId('media-image-img');
|
|
57
|
+
img.props.onError();
|
|
58
|
+
|
|
59
|
+
rerender(
|
|
60
|
+
<TestWrapper>
|
|
61
|
+
<MediaImage src='https://broken-link.com/404.png' alt='Broken' />
|
|
62
|
+
</TestWrapper>,
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
await waitFor(() => {
|
|
66
|
+
expect(queryByTestId('media-image-img')).toBeNull();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should reset error state when src changes', async () => {
|
|
71
|
+
const { getByTestId, rerender } = render(
|
|
72
|
+
<TestWrapper>
|
|
73
|
+
<MediaImage src='https://broken-link.com/404.png' alt='Test' />
|
|
74
|
+
</TestWrapper>,
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const img = getByTestId('media-image-img');
|
|
78
|
+
img.props.onError();
|
|
79
|
+
|
|
80
|
+
rerender(
|
|
81
|
+
<TestWrapper>
|
|
82
|
+
<MediaImage src={validSrc} alt='Test' />
|
|
83
|
+
</TestWrapper>,
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
await waitFor(() => {
|
|
87
|
+
const newImg = getByTestId('media-image-img');
|
|
88
|
+
expect(newImg.props.source).toEqual({ uri: validSrc });
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should apply default size (48)', () => {
|
|
93
|
+
const { getByTestId } = render(
|
|
94
|
+
<TestWrapper>
|
|
95
|
+
<MediaImage testID='mi' src={validSrc} alt='Test' />
|
|
96
|
+
</TestWrapper>,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const root = getByTestId('mi');
|
|
100
|
+
expect(root.props.style.width).toBe(sizes.s48);
|
|
101
|
+
expect(root.props.style.height).toBe(sizes.s48);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('should apply specified size', () => {
|
|
105
|
+
const { getByTestId } = render(
|
|
106
|
+
<TestWrapper>
|
|
107
|
+
<MediaImage testID='mi' src={validSrc} alt='Test' size={24} />
|
|
108
|
+
</TestWrapper>,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
const root = getByTestId('mi');
|
|
112
|
+
expect(root.props.style.width).toBe(sizes.s24);
|
|
113
|
+
expect(root.props.style.height).toBe(sizes.s24);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should apply circle shape', () => {
|
|
117
|
+
const { getByTestId } = render(
|
|
118
|
+
<TestWrapper>
|
|
119
|
+
<MediaImage testID='mi' src={validSrc} alt='Test' shape='circle' />
|
|
120
|
+
</TestWrapper>,
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const root = getByTestId('mi');
|
|
124
|
+
expect(root.props.style.borderRadius).toBe(borderRadius.full);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should apply square shape with correct border radius', () => {
|
|
128
|
+
const { getByTestId } = render(
|
|
129
|
+
<TestWrapper>
|
|
130
|
+
<MediaImage
|
|
131
|
+
testID='mi'
|
|
132
|
+
src={validSrc}
|
|
133
|
+
alt='Test'
|
|
134
|
+
size={48}
|
|
135
|
+
shape='square'
|
|
136
|
+
/>
|
|
137
|
+
</TestWrapper>,
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
const root = getByTestId('mi');
|
|
141
|
+
expect(root.props.style.borderRadius).toBe(borderRadius.md);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should set accessibility label from alt prop', () => {
|
|
145
|
+
const { getByLabelText } = render(
|
|
146
|
+
<TestWrapper>
|
|
147
|
+
<MediaImage src={validSrc} alt='Cardano icon' />
|
|
148
|
+
</TestWrapper>,
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
expect(getByLabelText('Cardano icon')).toBeTruthy();
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('should apply custom styles', () => {
|
|
155
|
+
const { getByTestId } = render(
|
|
156
|
+
<TestWrapper>
|
|
157
|
+
<MediaImage
|
|
158
|
+
testID='mi'
|
|
159
|
+
src={validSrc}
|
|
160
|
+
alt='Test'
|
|
161
|
+
style={{ borderWidth: 2 }}
|
|
162
|
+
/>
|
|
163
|
+
</TestWrapper>,
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
const root = getByTestId('mi');
|
|
167
|
+
expect(root.props.style.borderWidth).toBe(2);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it('should pass additional props', () => {
|
|
171
|
+
const { getByTestId } = render(
|
|
172
|
+
<TestWrapper>
|
|
173
|
+
<MediaImage testID='custom-id' src={validSrc} alt='Test' />
|
|
174
|
+
</TestWrapper>,
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
expect(getByTestId('custom-id')).toBeTruthy();
|
|
178
|
+
});
|
|
179
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { Image, StyleSheet } from 'react-native';
|
|
3
|
+
import { useStyleSheet } from '../../../styles';
|
|
4
|
+
import { Box } from '../Utility';
|
|
5
|
+
import { MediaImageProps, MediaImageSize, MediaImageShape } from './types';
|
|
6
|
+
|
|
7
|
+
type BorderRadiusKey = 'xs' | 'sm' | 'md' | 'lg' | 'full';
|
|
8
|
+
|
|
9
|
+
const borderRadiusMap: Record<MediaImageSize, BorderRadiusKey> = {
|
|
10
|
+
12: 'xs',
|
|
11
|
+
16: 'xs',
|
|
12
|
+
20: 'xs',
|
|
13
|
+
24: 'sm',
|
|
14
|
+
32: 'sm',
|
|
15
|
+
40: 'md',
|
|
16
|
+
48: 'md',
|
|
17
|
+
56: 'lg',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const mediaImageDotSizeMap: Record<MediaImageSize, number> = {
|
|
21
|
+
12: 8,
|
|
22
|
+
16: 8,
|
|
23
|
+
20: 8,
|
|
24
|
+
24: 10,
|
|
25
|
+
32: 12,
|
|
26
|
+
40: 16,
|
|
27
|
+
48: 20,
|
|
28
|
+
56: 24,
|
|
29
|
+
} as const;
|
|
30
|
+
|
|
31
|
+
const useStyles = ({
|
|
32
|
+
size,
|
|
33
|
+
shape,
|
|
34
|
+
}: {
|
|
35
|
+
size: MediaImageSize;
|
|
36
|
+
shape: MediaImageShape;
|
|
37
|
+
}) => {
|
|
38
|
+
return useStyleSheet(
|
|
39
|
+
(t) => {
|
|
40
|
+
const sizeValue = t.sizes[`s${size}` as keyof typeof t.sizes] as number;
|
|
41
|
+
const radius =
|
|
42
|
+
shape === 'circle'
|
|
43
|
+
? t.borderRadius.full
|
|
44
|
+
: t.borderRadius[borderRadiusMap[size]];
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
root: {
|
|
48
|
+
width: sizeValue,
|
|
49
|
+
height: sizeValue,
|
|
50
|
+
borderRadius: radius,
|
|
51
|
+
overflow: 'hidden' as const,
|
|
52
|
+
alignItems: 'center' as const,
|
|
53
|
+
justifyContent: 'center' as const,
|
|
54
|
+
backgroundColor: t.colors.bg.mutedTransparent,
|
|
55
|
+
},
|
|
56
|
+
image: {
|
|
57
|
+
width: '100%' as const,
|
|
58
|
+
height: '100%' as const,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
[size, shape],
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A generic media image component that displays an image with optional shape variants.
|
|
68
|
+
* Supports square and circular appearances with consistent sizing.
|
|
69
|
+
*
|
|
70
|
+
* When the image fails to load or no src is provided, displays a background placeholder.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* import { MediaImage } from '@ledgerhq/lumen-ui-rnative';
|
|
74
|
+
*
|
|
75
|
+
* <MediaImage src="https://example.com/icon.png" alt="Bitcoin" size={32} />
|
|
76
|
+
*/
|
|
77
|
+
export const MediaImage = ({
|
|
78
|
+
src,
|
|
79
|
+
alt,
|
|
80
|
+
size = 48,
|
|
81
|
+
shape = 'square',
|
|
82
|
+
lx = {},
|
|
83
|
+
style,
|
|
84
|
+
ref,
|
|
85
|
+
...props
|
|
86
|
+
}: MediaImageProps) => {
|
|
87
|
+
const [error, setError] = useState(false);
|
|
88
|
+
const shouldFallback = !src || error;
|
|
89
|
+
const styles = useStyles({ size, shape });
|
|
90
|
+
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
setError(false);
|
|
93
|
+
}, [src]);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Box
|
|
97
|
+
ref={ref}
|
|
98
|
+
lx={lx}
|
|
99
|
+
style={StyleSheet.flatten([styles.root, style])}
|
|
100
|
+
accessibilityRole='image'
|
|
101
|
+
accessibilityLabel={alt}
|
|
102
|
+
{...props}
|
|
103
|
+
>
|
|
104
|
+
{!shouldFallback && (
|
|
105
|
+
<Image
|
|
106
|
+
source={{ uri: src }}
|
|
107
|
+
style={styles.image}
|
|
108
|
+
accessible={false}
|
|
109
|
+
onError={() => setError(true)}
|
|
110
|
+
testID='media-image-img'
|
|
111
|
+
/>
|
|
112
|
+
)}
|
|
113
|
+
</Box>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
MediaImage.displayName = 'MediaImage';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { StyledViewProps } from '../../../styles';
|
|
2
|
+
|
|
3
|
+
export type MediaImageSize = 12 | 16 | 20 | 24 | 32 | 40 | 48 | 56;
|
|
4
|
+
|
|
5
|
+
export type MediaImageShape = 'square' | 'circle';
|
|
6
|
+
|
|
7
|
+
export type MediaImageProps = {
|
|
8
|
+
/**
|
|
9
|
+
* Image source URL. When undefined or on load error, displays a fallback.
|
|
10
|
+
* @optional
|
|
11
|
+
*/
|
|
12
|
+
src?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The shape of the media image.
|
|
15
|
+
* @default 'square'
|
|
16
|
+
*/
|
|
17
|
+
shape?: MediaImageShape;
|
|
18
|
+
/**
|
|
19
|
+
* The size of the media image in pixels.
|
|
20
|
+
* @default 48
|
|
21
|
+
*/
|
|
22
|
+
size?: MediaImageSize;
|
|
23
|
+
/**
|
|
24
|
+
* Alternative text for the image, used for accessibility.
|
|
25
|
+
*/
|
|
26
|
+
alt?: string;
|
|
27
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, jest } from '@jest/globals';
|
|
2
2
|
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
3
|
import { render, screen, fireEvent } from '@testing-library/react-native';
|
|
4
|
-
import React from 'react';
|
|
5
4
|
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
6
5
|
import {
|
|
7
6
|
NavBar,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createSafeContext } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
-
import
|
|
2
|
+
import { Children, isValidElement, ReactNode } from 'react';
|
|
3
3
|
import { StyleSheet } from 'react-native';
|
|
4
4
|
import { useCommonTranslation } from '../../../i18n';
|
|
5
5
|
import { useStyleSheet } from '../../../styles';
|
|
@@ -35,8 +35,8 @@ function extractSlots(children: ReactNode): Slots {
|
|
|
35
35
|
trailing: null,
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
if (!
|
|
38
|
+
Children.forEach(children, (child) => {
|
|
39
|
+
if (!isValidElement(child)) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { describe, expect, it } from '@jest/globals';
|
|
2
2
|
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
3
|
import { render, screen } from '@testing-library/react-native';
|
|
4
|
-
import React from 'react';
|
|
5
4
|
|
|
5
|
+
import { createRef } from 'react';
|
|
6
6
|
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
7
7
|
import { PageIndicator } from './PageIndicator';
|
|
8
8
|
|
|
@@ -162,7 +162,7 @@ describe('PageIndicator Component', () => {
|
|
|
162
162
|
|
|
163
163
|
describe('Props', () => {
|
|
164
164
|
it('should accept ref prop', () => {
|
|
165
|
-
const ref =
|
|
165
|
+
const ref = createRef<React.ElementRef<typeof PageIndicator>>();
|
|
166
166
|
renderWithProvider(
|
|
167
167
|
<PageIndicator
|
|
168
168
|
ref={ref}
|
|
@@ -57,10 +57,14 @@ Use `onClear` to extend the default clear behavior with custom logic.
|
|
|
57
57
|
|
|
58
58
|
### Disabled State
|
|
59
59
|
|
|
60
|
-
The search input can be disabled using the `
|
|
60
|
+
The search input can be fully disabled using the `disabled` prop, which prevents interaction and applies a muted visual style.
|
|
61
61
|
|
|
62
62
|
<Canvas of={SearchInputStories.DisabledSearchInput} />
|
|
63
63
|
|
|
64
|
+
### Read-Only State
|
|
65
|
+
|
|
66
|
+
Alternatively, use `editable={false}` to prevent editing without applying the muted visual style. This is useful for displaying non-editable values that should still look like regular inputs.
|
|
67
|
+
|
|
64
68
|
### Error State
|
|
65
69
|
|
|
66
70
|
The search component supports error handling through `errorMessage` which displays an error message below the input with error styling including a red border and text color.
|
|
@@ -273,7 +277,15 @@ Use the `keyboardType` prop to show the appropriate keyboard:
|
|
|
273
277
|
|
|
274
278
|
### Disabled State
|
|
275
279
|
|
|
276
|
-
Use the `
|
|
280
|
+
Use the `disabled` prop to disable the search input with a muted visual style:
|
|
281
|
+
|
|
282
|
+
```tsx
|
|
283
|
+
<SearchInput placeholder='Search' value='Current search' disabled />
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Read-Only State
|
|
287
|
+
|
|
288
|
+
Use the `editable` prop to make the search input non-editable without the muted visual style:
|
|
277
289
|
|
|
278
290
|
```tsx
|
|
279
291
|
<SearchInput placeholder='Search' value='Current search' editable={false} />
|
|
@@ -19,24 +19,6 @@ const meta: Meta<typeof SearchInput> = {
|
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
-
argTypes: {
|
|
23
|
-
placeholder: {
|
|
24
|
-
control: 'text',
|
|
25
|
-
description: 'Placeholder text when input is empty',
|
|
26
|
-
},
|
|
27
|
-
errorMessage: {
|
|
28
|
-
control: 'text',
|
|
29
|
-
description: 'Error message to display below input',
|
|
30
|
-
},
|
|
31
|
-
editable: {
|
|
32
|
-
control: 'boolean',
|
|
33
|
-
description: 'Whether the input is editable',
|
|
34
|
-
},
|
|
35
|
-
hideClearButton: {
|
|
36
|
-
control: 'boolean',
|
|
37
|
-
description: 'Hide the clear button',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
22
|
};
|
|
41
23
|
|
|
42
24
|
export default meta;
|
|
@@ -105,7 +87,7 @@ export const DisabledSearchInput: Story = {
|
|
|
105
87
|
),
|
|
106
88
|
args: {
|
|
107
89
|
placeholder: 'Search products',
|
|
108
|
-
|
|
90
|
+
disabled: true,
|
|
109
91
|
hideClearButton: false,
|
|
110
92
|
},
|
|
111
93
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
|
|
1
2
|
import { useStyleSheet } from '../../../styles';
|
|
2
3
|
import { Search as SearchIcon } from '../../Symbols';
|
|
3
4
|
import { BaseInput } from '../BaseInput';
|
|
@@ -8,18 +9,24 @@ export const SearchInput = ({
|
|
|
8
9
|
style,
|
|
9
10
|
containerStyle,
|
|
10
11
|
inputStyle,
|
|
12
|
+
disabled: disabledProp,
|
|
11
13
|
ref,
|
|
12
14
|
...props
|
|
13
15
|
}: SearchInputProps) => {
|
|
16
|
+
const disabled = useDisabledContext({
|
|
17
|
+
consumerName: 'SearchInput',
|
|
18
|
+
mergeWith: { disabled: disabledProp },
|
|
19
|
+
});
|
|
14
20
|
const styles = useAppearanceStyles(appearance);
|
|
15
21
|
|
|
16
22
|
return (
|
|
17
23
|
<BaseInput
|
|
18
24
|
ref={ref}
|
|
19
|
-
prefix={<SearchIcon size={20}
|
|
25
|
+
prefix={<SearchIcon size={20} accessible={false} disabled={disabled} />}
|
|
20
26
|
style={style}
|
|
21
27
|
containerStyle={[containerStyle, styles.container]}
|
|
22
28
|
inputStyle={[inputStyle, styles.input]}
|
|
29
|
+
disabled={disabledProp}
|
|
23
30
|
{...props}
|
|
24
31
|
/>
|
|
25
32
|
);
|
|
@@ -61,7 +61,6 @@ Use the library as part of `@ledgerhq/lumen-ui-rnative`. See the [Setup Guide
|
|
|
61
61
|
Control selected value in state at the top level and pass it to SegmentedControl. Buttons use value to identify themselves; selected state is derived from context.
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
|
-
import React from 'react';
|
|
65
64
|
import { SegmentedControl, SegmentedControlButton } from '@ledgerhq/lumen-ui-rnative';
|
|
66
65
|
|
|
67
66
|
export default function Example() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
-
import
|
|
2
|
+
import { useState } from 'react';
|
|
3
3
|
import { Coins, Nft, TransferHorizontal, Settings } from '../../Symbols';
|
|
4
4
|
import { Box } from '../Utility';
|
|
5
5
|
import { SegmentedControl, SegmentedControlButton } from './SegmentedControl';
|
|
@@ -14,29 +14,22 @@ const meta = {
|
|
|
14
14
|
layout: 'centered',
|
|
15
15
|
backgrounds: { default: 'light' },
|
|
16
16
|
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
selectedValue: {
|
|
32
|
-
control: 'text',
|
|
33
|
-
},
|
|
34
|
-
children: {
|
|
35
|
-
control: false,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
17
|
+
decorators: [
|
|
18
|
+
(Story) => (
|
|
19
|
+
<Box
|
|
20
|
+
lx={{
|
|
21
|
+
width: 's320',
|
|
22
|
+
flexDirection: 'row',
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<Story />
|
|
27
|
+
</Box>
|
|
28
|
+
),
|
|
29
|
+
],
|
|
38
30
|
args: {
|
|
39
31
|
appearance: 'background',
|
|
32
|
+
tabLayout: 'fixed',
|
|
40
33
|
},
|
|
41
34
|
} satisfies Meta<typeof SegmentedControl>;
|
|
42
35
|
|
|
@@ -49,20 +42,16 @@ export const Base: Story = {
|
|
|
49
42
|
const [state, setState] = useState('send');
|
|
50
43
|
|
|
51
44
|
return (
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
</SegmentedControlButton>
|
|
63
|
-
<SegmentedControlButton value='buy'>Buy</SegmentedControlButton>
|
|
64
|
-
</SegmentedControl>
|
|
65
|
-
</Box>
|
|
45
|
+
<SegmentedControl
|
|
46
|
+
{...args}
|
|
47
|
+
selectedValue={state}
|
|
48
|
+
onSelectedChange={setState}
|
|
49
|
+
accessibilityLabel='Transaction type'
|
|
50
|
+
>
|
|
51
|
+
<SegmentedControlButton value='send'>Send</SegmentedControlButton>
|
|
52
|
+
<SegmentedControlButton value='receive'>Receive</SegmentedControlButton>
|
|
53
|
+
<SegmentedControlButton value='buy'>Buy</SegmentedControlButton>
|
|
54
|
+
</SegmentedControl>
|
|
66
55
|
);
|
|
67
56
|
},
|
|
68
57
|
};
|
|
@@ -96,23 +85,60 @@ export const WithIcons: Story = {
|
|
|
96
85
|
},
|
|
97
86
|
};
|
|
98
87
|
|
|
88
|
+
export const TabLayoutShowcase: Story = {
|
|
89
|
+
args: {} as React.ComponentProps<typeof SegmentedControl>,
|
|
90
|
+
render: (args) => {
|
|
91
|
+
const [fitState, setFitState] = useState('send');
|
|
92
|
+
const [fixedState, setFixedState] = useState('send');
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Box lx={{ gap: 's24' }} style={{ width: '100%' }}>
|
|
96
|
+
<SegmentedControl
|
|
97
|
+
{...args}
|
|
98
|
+
tabLayout='fit'
|
|
99
|
+
selectedValue={fitState}
|
|
100
|
+
onSelectedChange={setFitState}
|
|
101
|
+
accessibilityLabel='Fit layout'
|
|
102
|
+
>
|
|
103
|
+
<SegmentedControlButton value='send'>Send</SegmentedControlButton>
|
|
104
|
+
<SegmentedControlButton value='receive'>
|
|
105
|
+
Receive
|
|
106
|
+
</SegmentedControlButton>
|
|
107
|
+
<SegmentedControlButton value='buy'>Buy</SegmentedControlButton>
|
|
108
|
+
</SegmentedControl>
|
|
109
|
+
<SegmentedControl
|
|
110
|
+
{...args}
|
|
111
|
+
tabLayout='fixed'
|
|
112
|
+
selectedValue={fixedState}
|
|
113
|
+
onSelectedChange={setFixedState}
|
|
114
|
+
accessibilityLabel='Fixed layout'
|
|
115
|
+
>
|
|
116
|
+
<SegmentedControlButton value='send'>Send</SegmentedControlButton>
|
|
117
|
+
<SegmentedControlButton value='receive'>
|
|
118
|
+
Receive
|
|
119
|
+
</SegmentedControlButton>
|
|
120
|
+
<SegmentedControlButton value='buy'>Buy</SegmentedControlButton>
|
|
121
|
+
</SegmentedControl>
|
|
122
|
+
</Box>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
|
|
99
127
|
export const Disabled: Story = {
|
|
100
128
|
args: {} as React.ComponentProps<typeof SegmentedControl>,
|
|
101
129
|
render: (args) => (
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
</SegmentedControl>
|
|
116
|
-
</Box>
|
|
130
|
+
<SegmentedControl
|
|
131
|
+
{...args}
|
|
132
|
+
selectedValue='receive'
|
|
133
|
+
onSelectedChange={() => {
|
|
134
|
+
/* empty */
|
|
135
|
+
}}
|
|
136
|
+
accessibilityLabel='Transaction type (disabled)'
|
|
137
|
+
disabled
|
|
138
|
+
>
|
|
139
|
+
<SegmentedControlButton value='send'>Send</SegmentedControlButton>
|
|
140
|
+
<SegmentedControlButton value='receive'>Receive</SegmentedControlButton>
|
|
141
|
+
<SegmentedControlButton value='buy'>Buy</SegmentedControlButton>
|
|
142
|
+
</SegmentedControl>
|
|
117
143
|
),
|
|
118
144
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, jest } from '@jest/globals';
|
|
2
2
|
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
3
|
import { render, fireEvent } from '@testing-library/react-native';
|
|
4
|
-
import React from 'react';
|
|
5
4
|
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
6
5
|
import { SegmentedControl, SegmentedControlButton } from './SegmentedControl';
|
|
7
6
|
|