@ledgerhq/lumen-ui-rnative 0.0.43 → 0.0.45
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/.storybook/Decorator.tsx +78 -13
- package/.storybook/docs/getting-started/ThemeProvider.mdx +1 -1
- package/.storybook/docs/style-system/lx.mdx +144 -0
- package/.storybook/docs/style-system/useCreate.mdx +95 -0
- package/.storybook/docs/style-system/useTheme.mdx +52 -0
- package/.storybook/preview-head.html +2 -2
- package/.storybook/{preview.ts → preview.tsx} +6 -1
- package/dist/package.json +2 -3
- package/dist/src/lib/Components/AddressInput/AddressInput.js +1 -1
- package/dist/src/lib/Components/AddressInput/AddressInput.stories.d.ts +7 -1
- package/dist/src/lib/Components/AddressInput/AddressInput.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/AddressInput/AddressInput.stories.js +98 -9
- package/dist/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
- package/dist/src/lib/Components/AmountInput/AmountInput.js +3 -3
- package/dist/src/lib/Components/AmountInput/AmountInput.stories.d.ts +10 -1
- package/dist/src/lib/Components/AmountInput/AmountInput.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/AmountInput/AmountInput.stories.js +162 -9
- package/dist/src/lib/Components/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/src/lib/Components/BaseInput/BaseInput.js +2 -19
- package/dist/src/lib/Components/BottomSheet/BottomSheet.js +1 -1
- package/dist/src/lib/Components/BottomSheet/BottomSheet.stories.js +8 -8
- package/dist/src/lib/Components/Button/BaseButton.d.ts +3 -3
- package/dist/src/lib/Components/Button/BaseButton.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/BaseButton.js +99 -119
- package/dist/src/lib/Components/Button/Button.d.ts +4 -26
- package/dist/src/lib/Components/Button/Button.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/Button.js +2 -2
- package/dist/src/lib/Components/Button/Button.stories.d.ts +1 -1
- package/dist/src/lib/Components/Button/Button.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/Button.stories.js +25 -48
- package/dist/src/lib/Components/Button/index.d.ts +1 -1
- package/dist/src/lib/Components/Button/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Button/index.js +1 -1
- package/dist/src/lib/Components/Button/{BaseButton.types.d.ts → types.d.ts} +15 -10
- package/dist/src/lib/Components/Button/types.d.ts.map +1 -0
- package/dist/src/lib/Components/CardButton/CardButton.d.ts +4 -3
- package/dist/src/lib/Components/CardButton/CardButton.d.ts.map +1 -1
- package/dist/src/lib/Components/CardButton/CardButton.js +65 -71
- package/dist/src/lib/Components/CardButton/CardButton.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/CardButton/CardButton.stories.js +28 -15
- package/dist/src/lib/Components/CardButton/index.d.ts +1 -1
- package/dist/src/lib/Components/CardButton/index.d.ts.map +1 -1
- package/dist/src/lib/Components/CardButton/index.js +1 -1
- package/dist/src/lib/Components/CardButton/{CardButton.types.d.ts → types.d.ts} +5 -4
- package/dist/src/lib/Components/CardButton/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Icon/Icon.d.ts +6 -3
- package/dist/src/lib/Components/Icon/Icon.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/Icon.js +24 -25
- package/dist/src/lib/Components/Icon/Icon.stories.d.ts +2 -2
- package/dist/src/lib/Components/Icon/Icon.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/Icon.stories.js +73 -19
- package/dist/src/lib/Components/Icon/createIcon.d.ts +1 -1
- package/dist/src/lib/Components/Icon/createIcon.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/createIcon.js +1 -2
- package/dist/src/lib/Components/Icon/index.d.ts +1 -1
- package/dist/src/lib/Components/Icon/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/index.js +1 -1
- package/dist/src/lib/Components/Icon/{Icon.types.d.ts → types.d.ts} +7 -4
- package/dist/src/lib/Components/Icon/types.d.ts.map +1 -0
- package/dist/src/lib/Components/IconButton/IconButton.d.ts +2 -19
- package/dist/src/lib/Components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/src/lib/Components/IconButton/IconButton.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/IconButton/IconButton.stories.js +9 -11
- package/dist/src/lib/Components/IconButton/index.d.ts +1 -0
- package/dist/src/lib/Components/IconButton/index.d.ts.map +1 -1
- package/dist/src/lib/Components/IconButton/index.js +1 -0
- package/dist/src/lib/Components/IconButton/types.d.ts +12 -0
- package/dist/src/lib/Components/IconButton/types.d.ts.map +1 -0
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts +2 -2
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.figma.js +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.js +34 -34
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.d.ts +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.js +22 -9
- package/dist/src/lib/Components/InteractiveIcon/types.d.ts +3 -7
- package/dist/src/lib/Components/InteractiveIcon/types.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/Link.d.ts +7 -77
- package/dist/src/lib/Components/Link/Link.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/Link.js +59 -75
- package/dist/src/lib/Components/Link/Link.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/Link.stories.js +34 -11
- package/dist/src/lib/Components/Link/index.d.ts +1 -0
- package/dist/src/lib/Components/Link/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Link/index.js +1 -0
- package/dist/src/lib/Components/Link/types.d.ts +43 -0
- package/dist/src/lib/Components/Link/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Link/types.js +1 -0
- package/dist/src/lib/Components/Search/Search.stories.d.ts +6 -1
- package/dist/src/lib/Components/Search/Search.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Search/Search.stories.js +71 -9
- package/dist/src/lib/Components/Select/Select.d.ts.map +1 -1
- package/dist/src/lib/Components/Select/Select.js +1 -17
- package/dist/src/lib/Components/Spinner/Spinner.d.ts +13 -16
- package/dist/src/lib/Components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/src/lib/Components/Spinner/Spinner.js +33 -5
- package/dist/src/lib/Components/Spinner/Spinner.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Spinner/Spinner.stories.js +1 -1
- package/dist/src/lib/Components/Spinner/index.d.ts +1 -0
- package/dist/src/lib/Components/Spinner/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Spinner/index.js +1 -0
- package/dist/src/lib/Components/Spinner/types.d.ts +15 -0
- package/dist/src/lib/Components/Spinner/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Spinner/types.js +1 -0
- package/dist/src/lib/Components/Tag/Tag.d.ts +2 -1
- package/dist/src/lib/Components/Tag/Tag.d.ts.map +1 -1
- package/dist/src/lib/Components/Tag/Tag.js +15 -4
- package/dist/src/lib/Components/Tag/Tag.stories.js +1 -1
- package/dist/src/lib/Components/Tag/Tag.types.d.ts +7 -1
- package/dist/src/lib/Components/Tag/Tag.types.d.ts.map +1 -1
- package/dist/src/lib/Components/TextInput/TextInput.stories.d.ts +8 -1
- package/dist/src/lib/Components/TextInput/TextInput.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/TextInput/TextInput.stories.js +104 -9
- package/dist/src/lib/Components/Tile/Tile.d.ts.map +1 -1
- package/dist/src/lib/Components/Tile/Tile.js +54 -8
- package/dist/src/lib/Components/Tile/types.d.ts +14 -1
- package/dist/src/lib/Components/Tile/types.d.ts.map +1 -1
- package/dist/src/lib/Components/Tooltip/Tooltip.stories.js +2 -2
- package/dist/src/lib/Components/Utility/Box/Box.d.ts +39 -0
- package/dist/src/lib/Components/Utility/Box/Box.d.ts.map +1 -0
- package/dist/src/lib/Components/{Box → Utility/Box}/Box.js +10 -11
- package/dist/src/lib/Components/Utility/Box/Box.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/{Box → Utility/Box}/Box.stories.js +13 -12
- package/dist/src/lib/Components/Utility/Box/index.d.ts +2 -0
- package/dist/src/lib/Components/Utility/Box/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.d.ts +34 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.js +33 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.d.ts +7 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/Pressable.stories.js +47 -0
- package/dist/src/lib/Components/Utility/Pressable/index.d.ts +3 -0
- package/dist/src/lib/Components/Utility/Pressable/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/index.js +1 -0
- package/dist/src/lib/Components/Utility/Pressable/types.d.ts +3 -0
- package/dist/src/lib/Components/Utility/Pressable/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/Pressable/types.js +1 -0
- package/dist/src/lib/Components/Utility/Text/Text.d.ts +40 -0
- package/dist/src/lib/Components/Utility/Text/Text.d.ts.map +1 -0
- package/dist/src/lib/Components/{Text → Utility/Text}/Text.js +13 -9
- package/dist/src/lib/Components/Utility/Text/Text.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/{Text → Utility/Text}/Text.stories.js +3 -3
- package/dist/src/lib/Components/Utility/Text/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/index.d.ts +4 -0
- package/dist/src/lib/Components/Utility/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Utility/index.js +3 -0
- package/dist/src/lib/Components/index.d.ts +1 -3
- package/dist/src/lib/Components/index.d.ts.map +1 -1
- package/dist/src/lib/Components/index.js +1 -3
- package/dist/src/lib/utils/components/InjectStylesIntoChildren.d.ts +6 -5
- package/dist/src/lib/utils/components/InjectStylesIntoChildren.d.ts.map +1 -1
- package/dist/src/lib/utils/components/InjectStylesIntoChildren.js +6 -6
- package/dist/src/styles/LumenStyleSheet.d.ts +1 -1
- package/dist/src/styles/LumenStyleSheet.d.ts.map +1 -1
- package/dist/src/styles/Provider/createStylesheetTheme.d.ts +0 -1
- package/dist/src/styles/Provider/createStylesheetTheme.d.ts.map +1 -1
- package/dist/src/styles/Provider/createStylesheetTheme.js +0 -1
- package/dist/src/styles/create/useCreate.d.ts +2 -1
- package/dist/src/styles/create/useCreate.d.ts.map +1 -1
- package/dist/src/styles/create/useCreate.js +5 -5
- package/dist/src/styles/factories/areLxPropsEqual.d.ts +3 -0
- package/dist/src/styles/factories/areLxPropsEqual.d.ts.map +1 -0
- package/dist/src/styles/factories/areLxPropsEqual.js +15 -0
- package/dist/src/styles/factories/createStyledPressable.d.ts +26 -0
- package/dist/src/styles/factories/createStyledPressable.d.ts.map +1 -0
- package/dist/src/styles/factories/createStyledPressable.js +61 -0
- package/dist/src/styles/factories/createStyledText.d.ts +15 -26
- package/dist/src/styles/factories/createStyledText.d.ts.map +1 -1
- package/dist/src/styles/factories/createStyledText.js +13 -29
- package/dist/src/styles/factories/createStyledView.d.ts +7 -27
- package/dist/src/styles/factories/createStyledView.d.ts.map +1 -1
- package/dist/src/styles/factories/createStyledView.js +10 -30
- package/dist/src/styles/factories/index.d.ts +4 -0
- package/dist/src/styles/factories/index.d.ts.map +1 -0
- package/dist/src/styles/factories/index.js +3 -0
- package/dist/src/styles/index.d.ts +2 -3
- package/dist/src/styles/index.d.ts.map +1 -1
- package/dist/src/styles/index.js +2 -3
- package/dist/src/styles/resolveStyle/resolveConfig.d.ts +7 -7
- package/dist/src/styles/resolveStyle/resolveConfig.d.ts.map +1 -1
- package/dist/src/styles/resolveStyle/resolveConfig.js +9 -9
- package/dist/src/styles/resolveStyle/resolveStyle.d.ts +6 -20
- package/dist/src/styles/resolveStyle/resolveStyle.d.ts.map +1 -1
- package/dist/src/styles/resolveStyle/resolveStyle.js +4 -29
- package/dist/src/styles/types/create.types.d.ts +1 -1
- package/dist/src/styles/types/create.types.d.ts.map +1 -1
- package/dist/src/styles/types/styled.types.d.ts +72 -50
- package/dist/src/styles/types/styled.types.d.ts.map +1 -1
- package/dist/src/styles/types/utility.types.d.ts.map +1 -1
- package/dist/src/styles/utils/index.d.ts +2 -0
- package/dist/src/styles/utils/index.d.ts.map +1 -0
- package/dist/src/styles/utils/index.js +1 -0
- package/dist/src/styles/utils/mergeStyles.d.ts +16 -0
- package/dist/src/styles/utils/mergeStyles.d.ts.map +1 -0
- package/dist/src/styles/utils/mergeStyles.js +20 -0
- package/package.json +3 -4
- package/src/lib/Components/AddressInput/AddressInput.mdx +15 -4
- package/src/lib/Components/AddressInput/AddressInput.stories.tsx +133 -17
- package/src/lib/Components/AddressInput/AddressInput.tsx +1 -1
- package/src/lib/Components/AmountInput/AmountInput.mdx +20 -1
- package/src/lib/Components/AmountInput/AmountInput.stories.tsx +180 -17
- package/src/lib/Components/AmountInput/AmountInput.tsx +24 -15
- package/src/lib/Components/Banner/Banner.test.tsx +48 -15
- package/src/lib/Components/BaseInput/BaseInput.tsx +6 -35
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +8 -8
- package/src/lib/Components/BottomSheet/BottomSheet.tsx +1 -1
- package/src/lib/Components/Button/BaseButton.test.tsx +149 -0
- package/src/lib/Components/Button/BaseButton.tsx +193 -148
- package/src/lib/Components/Button/Button.mdx +34 -31
- package/src/lib/Components/Button/Button.stories.tsx +37 -58
- package/src/lib/Components/Button/Button.tsx +4 -11
- package/src/lib/Components/Button/index.ts +1 -1
- package/src/lib/Components/Button/{BaseButton.types.ts → types.ts} +14 -8
- package/src/lib/Components/CardButton/CardButton.mdx +15 -25
- package/src/lib/Components/CardButton/CardButton.stories.tsx +48 -22
- package/src/lib/Components/CardButton/CardButton.test.tsx +141 -0
- package/src/lib/Components/CardButton/CardButton.tsx +142 -108
- package/src/lib/Components/CardButton/index.ts +1 -1
- package/src/lib/Components/CardButton/{CardButton.types.ts → types.ts} +4 -3
- package/src/lib/Components/Checkbox/Checkbox.mdx +1 -1
- package/src/lib/Components/Checkbox/Checkbox.test.tsx +42 -17
- package/src/lib/Components/Icon/Icon.stories.tsx +143 -73
- package/src/lib/Components/Icon/Icon.test.tsx +84 -0
- package/src/lib/Components/Icon/Icon.tsx +32 -28
- package/src/lib/Components/Icon/createIcon.ts +2 -3
- package/src/lib/Components/Icon/index.ts +1 -1
- package/src/lib/Components/Icon/{Icon.types.ts → types.ts} +4 -3
- package/src/lib/Components/IconButton/IconButton.mdx +13 -10
- package/src/lib/Components/IconButton/IconButton.stories.tsx +12 -14
- package/src/lib/Components/IconButton/IconButton.test.tsx +141 -0
- package/src/lib/Components/IconButton/IconButton.tsx +3 -13
- package/src/lib/Components/IconButton/index.ts +1 -0
- package/src/lib/Components/IconButton/types.ts +12 -0
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.figma.tsx +1 -1
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.mdx +25 -27
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.stories.tsx +82 -43
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.test.tsx +30 -19
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.tsx +78 -45
- package/src/lib/Components/InteractiveIcon/types.ts +4 -7
- package/src/lib/Components/Link/Link.mdx +8 -18
- package/src/lib/Components/Link/Link.stories.tsx +56 -25
- package/src/lib/Components/Link/Link.test.tsx +141 -51
- package/src/lib/Components/Link/Link.tsx +128 -150
- package/src/lib/Components/Link/index.ts +1 -0
- package/src/lib/Components/Link/types.ts +44 -0
- package/src/lib/Components/Search/Search.mdx +14 -1
- package/src/lib/Components/Search/Search.stories.tsx +94 -15
- package/src/lib/Components/Select/Select.test.tsx +8 -4
- package/src/lib/Components/Select/Select.tsx +4 -31
- package/src/lib/Components/Spinner/Spinner.stories.tsx +1 -5
- package/src/lib/Components/Spinner/Spinner.tsx +60 -34
- package/src/lib/Components/Spinner/index.ts +1 -0
- package/src/lib/Components/Spinner/types.ts +15 -0
- package/src/lib/Components/Switch/Switch.mdx +1 -1
- package/src/lib/Components/Tag/Tag.stories.tsx +2 -2
- package/src/lib/Components/Tag/Tag.tsx +22 -6
- package/src/lib/Components/Tag/Tag.types.ts +7 -8
- package/src/lib/Components/TextInput/TextInput.mdx +24 -4
- package/src/lib/Components/TextInput/TextInput.stories.tsx +131 -15
- package/src/lib/Components/Tile/Tile.test.tsx +100 -63
- package/src/lib/Components/Tile/Tile.tsx +64 -13
- package/src/lib/Components/Tile/types.ts +14 -1
- package/src/lib/Components/Tooltip/Tooltip.stories.tsx +2 -2
- package/src/lib/Components/Tooltip/Tooltip.test.tsx +8 -4
- package/src/lib/Components/{Box → Utility/Box}/Box.mdx +15 -13
- package/src/lib/Components/{Box → Utility/Box}/Box.stories.tsx +13 -11
- package/src/lib/Components/{Box → Utility/Box}/Box.tsx +11 -12
- package/src/lib/Components/Utility/Box/index.ts +1 -0
- package/src/lib/Components/Utility/Pressable/Pressable.mdx +103 -0
- package/src/lib/Components/Utility/Pressable/Pressable.stories.tsx +51 -0
- package/src/lib/Components/Utility/Pressable/Pressable.test.tsx +221 -0
- package/src/lib/Components/Utility/Pressable/Pressable.tsx +34 -0
- package/src/lib/Components/Utility/Pressable/index.ts +2 -0
- package/src/lib/Components/Utility/Pressable/types.ts +3 -0
- package/src/lib/Components/{Text → Utility/Text}/Text.mdx +15 -7
- package/src/lib/Components/{Text → Utility/Text}/Text.stories.tsx +3 -3
- package/src/lib/Components/Utility/Text/Text.tsx +39 -0
- package/src/lib/Components/Utility/index.ts +3 -0
- package/src/lib/Components/index.ts +1 -3
- package/src/lib/utils/components/InjectStylesIntoChildren.tsx +23 -14
- package/src/styles/Provider/createStylesheetTheme.ts +0 -1
- package/src/styles/create/useCreate.ts +8 -4
- package/src/styles/factories/areLxPropsEqual.ts +32 -0
- package/src/styles/factories/createStyledPressable.test.tsx +253 -0
- package/src/styles/factories/createStyledPressable.tsx +97 -0
- package/src/styles/factories/createStyledText.test.tsx +28 -20
- package/src/styles/factories/createStyledText.tsx +29 -49
- package/src/styles/factories/createStyledView.test.tsx +22 -16
- package/src/styles/factories/createStyledView.tsx +19 -53
- package/src/styles/factories/index.ts +3 -0
- package/src/styles/index.ts +2 -3
- package/src/styles/resolveStyle/resolveConfig.ts +16 -15
- package/src/styles/resolveStyle/resolveStyle.test.ts +13 -141
- package/src/styles/resolveStyle/resolveStyle.ts +10 -60
- package/src/styles/types/create.types.ts +1 -1
- package/src/styles/types/styled.types.ts +73 -105
- package/src/styles/types/utility.types.ts +1 -0
- package/src/styles/utils/index.ts +1 -0
- package/src/styles/utils/mergeStyles.test.ts +45 -0
- package/src/styles/utils/mergeStyles.ts +25 -0
- package/.storybook/docs/getting-started/StyleSystem.mdx +0 -133
- package/dist/src/lib/Components/Box/Box.d.ts +0 -592
- package/dist/src/lib/Components/Box/Box.d.ts.map +0 -1
- package/dist/src/lib/Components/Box/Box.stories.d.ts.map +0 -1
- package/dist/src/lib/Components/Box/Box.types.d.ts +0 -3
- package/dist/src/lib/Components/Box/Box.types.d.ts.map +0 -1
- package/dist/src/lib/Components/Box/index.d.ts +0 -3
- package/dist/src/lib/Components/Box/index.d.ts.map +0 -1
- package/dist/src/lib/Components/Button/BaseButton.types.d.ts.map +0 -1
- package/dist/src/lib/Components/CardButton/CardButton.types.d.ts.map +0 -1
- package/dist/src/lib/Components/Icon/Icon.types.d.ts.map +0 -1
- package/dist/src/lib/Components/Text/Text.d.ts +0 -602
- package/dist/src/lib/Components/Text/Text.d.ts.map +0 -1
- package/dist/src/lib/Components/Text/Text.stories.d.ts.map +0 -1
- package/dist/src/lib/Components/Text/index.d.ts.map +0 -1
- package/dist/src/lib/Components/_ToRemove/ToRemove.d.ts +0 -9
- package/dist/src/lib/Components/_ToRemove/ToRemove.d.ts.map +0 -1
- package/dist/src/lib/Components/_ToRemove/ToRemove.js +0 -43
- package/dist/src/styles/utils/styleVarianceAuthority.d.ts +0 -30
- package/dist/src/styles/utils/styleVarianceAuthority.d.ts.map +0 -1
- package/dist/src/styles/utils/styleVarianceAuthority.js +0 -97
- package/src/lib/Components/Box/Box.types.ts +0 -3
- package/src/lib/Components/Box/index.ts +0 -2
- package/src/lib/Components/Text/Text.tsx +0 -35
- package/src/lib/Components/_ToRemove/ToRemove.tsx +0 -65
- package/src/styles/utils/styleVarianceAuthority.test.ts +0 -302
- package/src/styles/utils/styleVarianceAuthority.ts +0 -154
- /package/dist/src/lib/Components/{Box/Box.types.js → Button/types.js} +0 -0
- /package/dist/src/lib/Components/{Button/BaseButton.types.js → CardButton/types.js} +0 -0
- /package/dist/src/lib/Components/{CardButton/CardButton.types.js → Icon/types.js} +0 -0
- /package/dist/src/lib/Components/{Icon/Icon.types.js → IconButton/types.js} +0 -0
- /package/dist/src/lib/Components/{Box → Utility/Box}/Box.stories.d.ts +0 -0
- /package/dist/src/lib/Components/{Box → Utility/Box}/index.js +0 -0
- /package/dist/src/lib/Components/{Text → Utility/Text}/Text.stories.d.ts +0 -0
- /package/dist/src/lib/Components/{Text → Utility/Text}/index.d.ts +0 -0
- /package/dist/src/lib/Components/{Text → Utility/Text}/index.js +0 -0
- /package/src/lib/Components/{Text → Utility/Text}/index.ts +0 -0
|
@@ -1,81 +1,171 @@
|
|
|
1
1
|
import { describe, it, expect, jest, beforeEach } from '@jest/globals';
|
|
2
|
-
import {
|
|
2
|
+
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
|
+
import { render, fireEvent, screen } from '@testing-library/react-native';
|
|
4
|
+
import React from 'react';
|
|
3
5
|
import { Linking } from 'react-native';
|
|
6
|
+
|
|
7
|
+
import { Information } from '../../Symbols';
|
|
8
|
+
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
4
9
|
import { Link } from './Link';
|
|
10
|
+
import { LinkProps } from './types';
|
|
5
11
|
|
|
6
12
|
jest.mock('react-native/Libraries/Linking/Linking', () => ({
|
|
7
13
|
openURL: jest.fn(() => Promise.resolve()),
|
|
8
14
|
}));
|
|
9
15
|
|
|
16
|
+
const renderWithProvider = (component: React.ReactElement) => {
|
|
17
|
+
return render(
|
|
18
|
+
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
19
|
+
{component}
|
|
20
|
+
</ThemeProvider>,
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const typographies = ledgerLiveThemes.dark.typographies.sm;
|
|
25
|
+
const { colors, spacings } = ledgerLiveThemes.dark;
|
|
26
|
+
|
|
10
27
|
describe('Link Component', () => {
|
|
11
28
|
beforeEach(() => {
|
|
12
29
|
jest.clearAllMocks();
|
|
13
30
|
});
|
|
14
31
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
32
|
+
describe('Rendering', () => {
|
|
33
|
+
it('should render children and have link accessibility role', () => {
|
|
34
|
+
renderWithProvider(
|
|
35
|
+
<Link href='https://example.com' testID='link'>
|
|
36
|
+
Click me
|
|
37
|
+
</Link>,
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
expect(screen.getByText('Click me').props.children).toBe('Click me');
|
|
41
|
+
expect(screen.getByTestId('link').props.accessibilityRole).toBe('link');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should truncate text to single line', () => {
|
|
45
|
+
renderWithProvider(<Link href='https://example.com'>Link</Link>);
|
|
46
|
+
expect(screen.getByText('Link').props.numberOfLines).toBe(1);
|
|
47
|
+
});
|
|
21
48
|
});
|
|
22
49
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
50
|
+
describe('Appearances', () => {
|
|
51
|
+
it.each([
|
|
52
|
+
['base', colors.text.base],
|
|
53
|
+
['accent', colors.text.interactive],
|
|
54
|
+
])(
|
|
55
|
+
'should apply %s appearance with correct text color',
|
|
56
|
+
(appearance, expectedColor) => {
|
|
57
|
+
renderWithProvider(
|
|
58
|
+
<Link
|
|
59
|
+
href='https://example.com'
|
|
60
|
+
appearance={appearance as LinkProps['appearance']}
|
|
61
|
+
>
|
|
62
|
+
Link
|
|
63
|
+
</Link>,
|
|
64
|
+
);
|
|
65
|
+
expect(screen.getByText('Link').props.style.color).toBe(expectedColor);
|
|
66
|
+
},
|
|
26
67
|
);
|
|
27
|
-
|
|
28
|
-
fireEvent.press(getByText('Click me'));
|
|
29
|
-
|
|
30
|
-
expect(Linking.openURL).toHaveBeenCalledWith('https://example.com');
|
|
31
|
-
expect(Linking.openURL).toHaveBeenCalledTimes(1);
|
|
32
68
|
});
|
|
33
69
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
70
|
+
describe('Sizes', () => {
|
|
71
|
+
it.each([
|
|
72
|
+
['sm', typographies.body2SemiBold, spacings.s4],
|
|
73
|
+
['md', typographies.body1SemiBold, spacings.s8],
|
|
74
|
+
])(
|
|
75
|
+
'should apply %s size with correct typography and gap',
|
|
76
|
+
(size, typography, expectedGap) => {
|
|
77
|
+
renderWithProvider(
|
|
78
|
+
<Link href='https://example.com' size={size as LinkProps['size']}>
|
|
79
|
+
Link
|
|
80
|
+
</Link>,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const textStyle = screen.getByText('Link').props.style;
|
|
84
|
+
expect(textStyle.fontSize).toBe(typography.fontSize);
|
|
85
|
+
expect(textStyle.fontWeight).toBe(typography.fontWeight);
|
|
86
|
+
expect(screen.getByTestId('link-content').props.style.gap).toBe(
|
|
87
|
+
expectedGap,
|
|
88
|
+
);
|
|
89
|
+
},
|
|
40
90
|
);
|
|
41
|
-
|
|
42
|
-
fireEvent.press(getByText('Custom Press'));
|
|
43
|
-
|
|
44
|
-
expect(onPress).toHaveBeenCalledTimes(1);
|
|
45
|
-
expect(Linking.openURL).not.toHaveBeenCalled();
|
|
46
91
|
});
|
|
47
92
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
93
|
+
describe('Underline', () => {
|
|
94
|
+
it.each([
|
|
95
|
+
[true, 'underline'],
|
|
96
|
+
[false, 'none'],
|
|
97
|
+
])(
|
|
98
|
+
'should have textDecorationLine=%s when underline=%s',
|
|
99
|
+
(underline, expectedDecoration) => {
|
|
100
|
+
renderWithProvider(
|
|
101
|
+
<Link href='https://example.com' underline={underline}>
|
|
102
|
+
Link
|
|
103
|
+
</Link>,
|
|
104
|
+
);
|
|
105
|
+
expect(screen.getByText('Link').props.style.textDecorationLine).toBe(
|
|
106
|
+
expectedDecoration,
|
|
107
|
+
);
|
|
108
|
+
},
|
|
63
109
|
);
|
|
110
|
+
});
|
|
64
111
|
|
|
65
|
-
|
|
66
|
-
|
|
112
|
+
describe('Icons', () => {
|
|
113
|
+
it('should render leading icon when provided', () => {
|
|
114
|
+
renderWithProvider(
|
|
115
|
+
<Link href='https://example.com' icon={Information}>
|
|
116
|
+
With Icon
|
|
117
|
+
</Link>,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const children = React.Children.toArray(
|
|
121
|
+
screen.getByTestId('link-content').props.children,
|
|
122
|
+
);
|
|
123
|
+
expect(children.length).toBe(2); // icon + text wrapper
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should render external link icon when isExternal is true', () => {
|
|
127
|
+
renderWithProvider(
|
|
128
|
+
<Link href='https://example.com' isExternal>
|
|
129
|
+
External
|
|
130
|
+
</Link>,
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const children = React.Children.toArray(
|
|
134
|
+
screen.getByTestId('link-content').props.children,
|
|
135
|
+
);
|
|
136
|
+
expect(children.length).toBe(2); // text wrapper + external icon
|
|
137
|
+
});
|
|
67
138
|
});
|
|
68
139
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
140
|
+
describe('Interactions', () => {
|
|
141
|
+
it.each([
|
|
142
|
+
['https://example.com', 'https://example.com'],
|
|
143
|
+
['mailto:test@example.com', 'mailto:test@example.com'],
|
|
144
|
+
['tel:+1234567890', 'tel:+1234567890'],
|
|
145
|
+
])(
|
|
146
|
+
'should call Linking.openURL with %s when pressed',
|
|
147
|
+
(href, expectedUrl) => {
|
|
148
|
+
renderWithProvider(<Link href={href}>Link</Link>);
|
|
149
|
+
|
|
150
|
+
fireEvent.press(screen.getByText('Link'));
|
|
151
|
+
|
|
152
|
+
expect(Linking.openURL).toHaveBeenCalledTimes(1);
|
|
153
|
+
expect(Linking.openURL).toHaveBeenCalledWith(expectedUrl);
|
|
154
|
+
},
|
|
72
155
|
);
|
|
73
156
|
|
|
74
|
-
|
|
75
|
-
|
|
157
|
+
it('should call custom onPress instead of Linking.openURL', () => {
|
|
158
|
+
const onPress = jest.fn();
|
|
159
|
+
renderWithProvider(
|
|
160
|
+
<Link href='https://example.com' onPress={onPress}>
|
|
161
|
+
Custom
|
|
162
|
+
</Link>,
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
fireEvent.press(screen.getByText('Custom'));
|
|
76
166
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
167
|
+
expect(onPress).toHaveBeenCalledTimes(1);
|
|
168
|
+
expect(Linking.openURL).not.toHaveBeenCalled();
|
|
169
|
+
});
|
|
80
170
|
});
|
|
81
171
|
});
|
|
@@ -1,97 +1,70 @@
|
|
|
1
|
-
import { cn } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
-
import { cva } from 'class-variance-authority';
|
|
3
1
|
import React from 'react';
|
|
4
|
-
import { Linking,
|
|
2
|
+
import { Linking, Text, View } from 'react-native';
|
|
3
|
+
import { LumenStyleSheet, mergeStyles } from '../../../styles';
|
|
5
4
|
import { ExternalLink } from '../../Symbols';
|
|
6
5
|
import { IconSize } from '../Icon';
|
|
6
|
+
import { Pressable } from '../Utility';
|
|
7
|
+
import { LinkProps } from './types';
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
accent: '',
|
|
13
|
-
},
|
|
14
|
-
underline: {
|
|
15
|
-
true: 'underline underline-offset-2',
|
|
16
|
-
false: '',
|
|
17
|
-
},
|
|
18
|
-
size: {
|
|
19
|
-
sm: 'body-2-semi-bold',
|
|
20
|
-
md: 'body-1-semi-bold',
|
|
21
|
-
},
|
|
22
|
-
pressed: {
|
|
23
|
-
true: '',
|
|
24
|
-
false: '',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
compoundVariants: [
|
|
28
|
-
{
|
|
29
|
-
appearance: 'base',
|
|
30
|
-
pressed: false,
|
|
31
|
-
className: 'text-base',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
appearance: 'base',
|
|
35
|
-
pressed: true,
|
|
36
|
-
className: 'text-base-pressed',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
appearance: 'accent',
|
|
40
|
-
pressed: false,
|
|
41
|
-
className: 'text-interactive',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
appearance: 'accent',
|
|
45
|
-
pressed: true,
|
|
46
|
-
className: 'text-interactive-pressed',
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
defaultVariants: {
|
|
50
|
-
appearance: 'base',
|
|
51
|
-
size: 'md',
|
|
52
|
-
underline: true,
|
|
53
|
-
pressed: false,
|
|
54
|
-
},
|
|
55
|
-
});
|
|
9
|
+
const iconSizeMap: Record<Size, IconSize> = {
|
|
10
|
+
sm: 16,
|
|
11
|
+
md: 20,
|
|
12
|
+
};
|
|
56
13
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
14
|
+
type Appearance = NonNullable<LinkProps['appearance']>;
|
|
15
|
+
type Size = NonNullable<LinkProps['size']>;
|
|
16
|
+
|
|
17
|
+
type StyleParams = {
|
|
18
|
+
appearance: Appearance;
|
|
19
|
+
size: Size;
|
|
20
|
+
underline: boolean;
|
|
21
|
+
pressed: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const useStyles = ({ appearance, size, underline, pressed }: StyleParams) => {
|
|
25
|
+
return LumenStyleSheet.useCreate(
|
|
26
|
+
(t) => {
|
|
27
|
+
const textColors: Record<Appearance, string> = {
|
|
28
|
+
base: t.colors.text.base,
|
|
29
|
+
accent: t.colors.text.interactive,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const pressedTextColors: Record<Appearance, string> = {
|
|
33
|
+
base: t.colors.text.basePressed,
|
|
34
|
+
accent: t.colors.text.interactivePressed,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const typography =
|
|
38
|
+
size === 'sm'
|
|
39
|
+
? t.typographies.body2SemiBold
|
|
40
|
+
: t.typographies.body1SemiBold;
|
|
41
|
+
const gap = size === 'sm' ? t.spacings.s4 : t.spacings.s8;
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
container: {
|
|
45
|
+
flexDirection: 'row',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
gap,
|
|
48
|
+
},
|
|
49
|
+
textWrapper: {
|
|
50
|
+
flexShrink: 1,
|
|
51
|
+
},
|
|
52
|
+
text: mergeStyles(typography, {
|
|
53
|
+
color: pressed
|
|
54
|
+
? pressedTextColors[appearance]
|
|
55
|
+
: textColors[appearance],
|
|
56
|
+
textDecorationLine: underline ? 'underline' : 'none',
|
|
57
|
+
}),
|
|
58
|
+
icon: {
|
|
59
|
+
flexShrink: 0,
|
|
60
|
+
color: pressed
|
|
61
|
+
? pressedTextColors[appearance]
|
|
62
|
+
: textColors[appearance],
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
[appearance, size, underline, pressed],
|
|
67
|
+
);
|
|
95
68
|
};
|
|
96
69
|
|
|
97
70
|
/**
|
|
@@ -101,7 +74,7 @@ export type LinkProps = Omit<PressableProps, 'onPress' | 'children'> & {
|
|
|
101
74
|
* @see {@link https://ldls.vercel.app/?path=/docs/components-link-overview--docs Storybook}
|
|
102
75
|
* @see {@link https://ldls.vercel.app/?path=/docs/components-link-implementation--docs#dos-and-donts Guidelines}
|
|
103
76
|
*
|
|
104
|
-
* @warning The `
|
|
77
|
+
* @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
|
|
105
78
|
* Do not use it to modify the link's core appearance (colors, padding, etc). Use the `appearance` and `underline` props instead.
|
|
106
79
|
*
|
|
107
80
|
* @example
|
|
@@ -135,10 +108,11 @@ export const Link = React.forwardRef<
|
|
|
135
108
|
>(
|
|
136
109
|
(
|
|
137
110
|
{
|
|
138
|
-
|
|
111
|
+
lx,
|
|
112
|
+
style,
|
|
139
113
|
children,
|
|
140
|
-
appearance,
|
|
141
|
-
size,
|
|
114
|
+
appearance = 'base',
|
|
115
|
+
size = 'md',
|
|
142
116
|
underline = true,
|
|
143
117
|
icon,
|
|
144
118
|
isExternal = false,
|
|
@@ -148,14 +122,6 @@ export const Link = React.forwardRef<
|
|
|
148
122
|
},
|
|
149
123
|
ref,
|
|
150
124
|
) => {
|
|
151
|
-
const iconSizeMap: { [key: string]: IconSize } = {
|
|
152
|
-
sm: 16,
|
|
153
|
-
md: 20,
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const calculatedIconSize = size ? iconSizeMap[size] : 20;
|
|
157
|
-
const IconComponent = icon;
|
|
158
|
-
|
|
159
125
|
const handlePress = async () => {
|
|
160
126
|
if (onPress) {
|
|
161
127
|
onPress();
|
|
@@ -167,64 +133,76 @@ export const Link = React.forwardRef<
|
|
|
167
133
|
return (
|
|
168
134
|
<Pressable
|
|
169
135
|
ref={ref}
|
|
170
|
-
|
|
136
|
+
lx={lx}
|
|
137
|
+
style={[style, { flexShrink: 1 }]}
|
|
171
138
|
onPress={handlePress}
|
|
172
139
|
accessibilityRole='link'
|
|
173
140
|
{...props}
|
|
174
141
|
>
|
|
175
142
|
{({ pressed }) => (
|
|
176
|
-
<
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
143
|
+
<LinkContent
|
|
144
|
+
appearance={appearance}
|
|
145
|
+
size={size}
|
|
146
|
+
underline={underline}
|
|
147
|
+
pressed={pressed}
|
|
148
|
+
icon={icon}
|
|
149
|
+
isExternal={isExternal}
|
|
181
150
|
>
|
|
182
|
-
{
|
|
183
|
-
|
|
184
|
-
className={cn(
|
|
185
|
-
'flex-shrink-0',
|
|
186
|
-
linkTextVariants({
|
|
187
|
-
appearance,
|
|
188
|
-
size,
|
|
189
|
-
underline,
|
|
190
|
-
pressed,
|
|
191
|
-
}),
|
|
192
|
-
)}
|
|
193
|
-
size={calculatedIconSize}
|
|
194
|
-
/>
|
|
195
|
-
)}
|
|
196
|
-
<View className='shrink'>
|
|
197
|
-
<Text
|
|
198
|
-
numberOfLines={1}
|
|
199
|
-
className={linkTextVariants({
|
|
200
|
-
appearance,
|
|
201
|
-
size,
|
|
202
|
-
underline,
|
|
203
|
-
pressed,
|
|
204
|
-
})}
|
|
205
|
-
>
|
|
206
|
-
{children}
|
|
207
|
-
</Text>
|
|
208
|
-
</View>
|
|
209
|
-
{isExternal && (
|
|
210
|
-
<ExternalLink
|
|
211
|
-
size={calculatedIconSize}
|
|
212
|
-
className={cn(
|
|
213
|
-
'flex-shrink-0',
|
|
214
|
-
linkTextVariants({
|
|
215
|
-
appearance,
|
|
216
|
-
size,
|
|
217
|
-
underline,
|
|
218
|
-
pressed,
|
|
219
|
-
}),
|
|
220
|
-
)}
|
|
221
|
-
accessible={false}
|
|
222
|
-
/>
|
|
223
|
-
)}
|
|
224
|
-
</View>
|
|
151
|
+
{children}
|
|
152
|
+
</LinkContent>
|
|
225
153
|
)}
|
|
226
154
|
</Pressable>
|
|
227
155
|
);
|
|
228
156
|
},
|
|
229
157
|
);
|
|
158
|
+
|
|
159
|
+
type LinkContentProps = {
|
|
160
|
+
appearance: Appearance;
|
|
161
|
+
size: Size;
|
|
162
|
+
underline: boolean;
|
|
163
|
+
pressed: boolean;
|
|
164
|
+
icon: LinkProps['icon'];
|
|
165
|
+
isExternal: boolean;
|
|
166
|
+
children: React.ReactNode;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const LinkContent: React.FC<LinkContentProps> = ({
|
|
170
|
+
appearance,
|
|
171
|
+
size,
|
|
172
|
+
underline,
|
|
173
|
+
pressed,
|
|
174
|
+
icon,
|
|
175
|
+
isExternal,
|
|
176
|
+
children,
|
|
177
|
+
}) => {
|
|
178
|
+
const calculatedIconSize = iconSizeMap[size];
|
|
179
|
+
const IconComponent = icon;
|
|
180
|
+
const styles = useStyles({
|
|
181
|
+
appearance,
|
|
182
|
+
size,
|
|
183
|
+
underline,
|
|
184
|
+
pressed,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<View style={styles.container} testID='link-content'>
|
|
189
|
+
{IconComponent && (
|
|
190
|
+
<IconComponent size={calculatedIconSize} style={styles.icon} />
|
|
191
|
+
)}
|
|
192
|
+
<View style={styles.textWrapper}>
|
|
193
|
+
<Text style={styles.text} numberOfLines={1}>
|
|
194
|
+
{children}
|
|
195
|
+
</Text>
|
|
196
|
+
</View>
|
|
197
|
+
{isExternal && (
|
|
198
|
+
<ExternalLink
|
|
199
|
+
size={calculatedIconSize}
|
|
200
|
+
style={styles.icon}
|
|
201
|
+
accessible={false}
|
|
202
|
+
/>
|
|
203
|
+
)}
|
|
204
|
+
</View>
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
|
|
230
208
|
Link.displayName = 'Link';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { StyledPressableProps } from '../../../styles';
|
|
4
|
+
import { IconSize } from '../Icon';
|
|
5
|
+
|
|
6
|
+
export type LinkProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The visual style of the link.
|
|
9
|
+
* @default base
|
|
10
|
+
*/
|
|
11
|
+
appearance?: 'base' | 'accent';
|
|
12
|
+
/**
|
|
13
|
+
* The size variant of the link.
|
|
14
|
+
* @default md
|
|
15
|
+
*/
|
|
16
|
+
size?: 'sm' | 'md';
|
|
17
|
+
/**
|
|
18
|
+
* Whether to underline the link text.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
underline?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* An optional icon component to render inside the link.
|
|
24
|
+
* The icon styles are defined by the link. Please do not override them.
|
|
25
|
+
*/
|
|
26
|
+
icon?: React.ComponentType<{
|
|
27
|
+
size?: IconSize;
|
|
28
|
+
style?: StyleProp<ViewStyle>;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* If true, displays an external link icon next to the link text.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
isExternal?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The URL to navigate to
|
|
37
|
+
*/
|
|
38
|
+
href?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Custom press handler (overrides default href navigation)
|
|
41
|
+
*/
|
|
42
|
+
onPress?: () => void;
|
|
43
|
+
} & PropsWithChildren &
|
|
44
|
+
Omit<StyledPressableProps, 'onPress' | 'children'>;
|
|
@@ -18,7 +18,10 @@ The Search component is a specialized input field designed specifically for sear
|
|
|
18
18
|
|
|
19
19
|
> View in [Figma](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=2248-3468&m=dev).
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
> ⚠️ **Note on Web Preview:** The Storybook preview below may display visual inconsistencies as certain React Native APIs (such as Reanimated animations) cannot be fully translated to web environments. While the component's functionality should accurately represent the native implementation, it may not render as intended. For the complete native experience, please refer to the component on an actual iOS or Android device.
|
|
22
|
+
|
|
23
|
+
<Canvas of={SearchStories.Base} />
|
|
24
|
+
<Controls of={SearchStories.Base} />
|
|
22
25
|
|
|
23
26
|
## Anatomy
|
|
24
27
|
|
|
@@ -36,24 +39,34 @@ Uses placeholder text instead of floating labels for better search UX. Styled wi
|
|
|
36
39
|
|
|
37
40
|
A clear button (×) appears **automatically** when input has content.
|
|
38
41
|
|
|
42
|
+
<Canvas of={SearchStories.WithContent} />
|
|
43
|
+
|
|
39
44
|
> **Note:** The clear button only clears the input content/value. It does not clear error states - you must handle error state clearing separately in your component logic.
|
|
40
45
|
|
|
41
46
|
#### **Hiding the Clear Button**
|
|
42
47
|
|
|
43
48
|
Use `hideClearButton` to prevent the clear button from appearing.
|
|
44
49
|
|
|
50
|
+
<Canvas of={SearchStories.WithHiddenClearButton} />
|
|
51
|
+
|
|
45
52
|
#### **Extending the Clear Behavior**
|
|
46
53
|
|
|
47
54
|
Use `onClear` to extend the default clear behavior with custom logic.
|
|
48
55
|
|
|
56
|
+
<Canvas of={SearchStories.WithClearCallback} />
|
|
57
|
+
|
|
49
58
|
### Disabled State
|
|
50
59
|
|
|
51
60
|
The search input can be disabled using the `editable` prop set to `false`.
|
|
52
61
|
|
|
62
|
+
<Canvas of={SearchStories.DisabledSearch} />
|
|
63
|
+
|
|
53
64
|
### Error State
|
|
54
65
|
|
|
55
66
|
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.
|
|
56
67
|
|
|
68
|
+
<Canvas of={SearchStories.WithError} />
|
|
69
|
+
|
|
57
70
|
The error message will be automatically:
|
|
58
71
|
|
|
59
72
|
- Connected to the input
|